Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: components/data_reduction_proxy/content/data_reduction_proxy_resource_throttle.h

Issue 684223003: Data Reduction Proxy Interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_RESOURCE_TH ROTTLE_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_RESOURCE_TH ROTTLE_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/data_reduction_proxy/content/data_reduction_proxy_ui_servic e.h"
bengr 2014/10/31 17:06:48 Remove.
megjablon 2014/12/11 23:32:06 Done.
11 #include "content/public/browser/resource_throttle.h"
12 #include "content/public/common/resource_type.h"
13
14 namespace net {
15 class URLRequest;
16 }
17
18 namespace data_reduction_proxy {
19
20 class DataReductionProxyParams;
21 class DataReductionProxyUIManager;
bengr 2014/10/31 17:06:48 class DataReductionProxyUIService; class DataReduc
megjablon 2014/12/11 23:32:05 Done.
22
23 class DataReductionProxyResourceThrottle
24 : public content::ResourceThrottle,
25 public base::SupportsWeakPtr<DataReductionProxyResourceThrottle> {
26 public:
27 DataReductionProxyResourceThrottle(
28 net::URLRequest* request,
29 content::ResourceType resource_type,
bengr 2014/10/31 17:06:48 #include "content/public/common/resource_type.h"
megjablon 2014/12/11 23:32:06 Already there.
30 DataReductionProxyUIService* ui_service,
31 DataReductionProxyParams* params);
32
33 virtual ~DataReductionProxyResourceThrottle();
34
35 virtual void WillStartUsingNetwork(bool* defer) override;
bengr 2014/10/31 17:06:48 Add a comment that names the class these override.
megjablon 2014/12/11 23:32:05 Done.
36 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) override;
bengr 2014/10/31 17:06:48 #include "url/gurl.h"
megjablon 2014/12/11 23:32:05 Done.
37 virtual void WillProcessResponse(bool* defer) override;
38 virtual const char* GetNameForLogging() const override;
bengr 2014/10/31 17:06:48 The style is moving to not using the "virtual" key
megjablon 2014/12/11 23:32:05 Done.
39
40 private:
41 enum State {
42 NOT_BYPASSED,
43 LOCAL_BYPASS,
44 REMOTE_BYPASS,
45 };
46
47 static const char* kProceedHeader;
bengr 2014/10/31 17:06:48 Is this used?
megjablon 2014/12/11 23:32:05 No. Removed.
48
49 // Creates a bypass resource and calls StartDisplayingBlockingPage on the UI
bengr 2014/10/31 17:06:48 What's a "bypass resource"? Please clarify in the
megjablon 2014/12/11 23:32:05 Done.
50 // thread. Sets defer to true.
51 void DisplayBlockingPage(bool* defer);
52
53 // Called on the IO thread when the user has decided to proceed with the
54 // current request, or go back.
55 void OnBlockingPageComplete(bool proceed);
56
57 // Starts displaying the data reduction proxy interstitial page if it is not
58 // prerendering. Called on the UI thread.
59 static void StartDisplayingBlockingPage(
60 const base::WeakPtr<DataReductionProxyResourceThrottle>& throttle,
61 scoped_refptr<DataReductionProxyUIManager> ui_manager,
62 const DataReductionProxyUIManager::BypassResource& resource);
63
64 State state_;
65 net::URLRequest* request_;
bengr 2014/10/31 17:06:48 Is this guaranteed to be valid for the lifetime of
megjablon 2014/12/11 23:32:06 Done.
66 DataReductionProxyUIService* ui_service_;
67 DataReductionProxyParams* params_;
68 const bool is_subresource_;
69
70 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyResourceThrottle);
71 };
72
73 } // namespace data_reduction_proxy
74
75 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_RESOURCE _THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698