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

Side by Side Diff: components/data_reduction_proxy/content/browser/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: Addressing comments Created 6 years 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_BROWSER_DATA_REDUCTION_PROXY_RES OURCE_THROTTLE_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_RES OURCE_THROTTLE_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_u i_manager.h"
11 #include "content/public/browser/resource_throttle.h"
12 #include "content/public/common/resource_type.h"
13 #include "url/gurl.h"
14
15 namespace net {
16 class URLRequest;
17 }
18
19 namespace data_reduction_proxy {
20
21 class DataReductionProxyParams;
22 class DataReductionProxyUIManager;
23 class DataReductionProxyUIService;
24
25 class DataReductionProxyResourceThrottle
bengr 2014/12/17 00:30:20 Comment.
megjablon 2014/12/23 02:18:04 Done.
26 : public content::ResourceThrottle,
27 public base::SupportsWeakPtr<DataReductionProxyResourceThrottle> {
28 public:
29 DataReductionProxyResourceThrottle(
bengr 2014/12/17 00:30:20 Comment.
megjablon 2014/12/23 02:18:04 Done.
30 net::URLRequest* request,
bengr 2014/12/17 00:30:20 Can this be const?
megjablon 2014/12/23 02:18:04 Done.
31 content::ResourceType resource_type,
32 DataReductionProxyUIService* ui_service,
bengr 2014/12/17 00:30:20 Can this be const?
megjablon 2014/12/23 02:18:04 Done.
33 const DataReductionProxyParams* params);
34
35 virtual ~DataReductionProxyResourceThrottle();
36
37 // Overrides content::ResourceThrottle.
38 void WillStartUsingNetwork(bool* defer) override;
39 void WillRedirectRequest(const GURL& new_url, bool* defer) override;
40 void WillProcessResponse(bool* defer) override;
41 const char* GetNameForLogging() const override;
42
43 private:
44 enum State {
45 NOT_BYPASSED,
46 LOCAL_BYPASS,
47 REMOTE_BYPASS,
48 };
49
50 // Creates a bypass resource and calls StartDisplayingBlockingPage on the UI
51 // thread. Sets defer to true. A bypass resource is a structure used to pass
52 // parameters between the IO and UI thread when interacting with the blocking
53 // page.
54 void DisplayBlockingPage(bool* defer);
55
56 // Called on the IO thread when the user has decided to proceed with the
57 // current request, or go back.
58 void OnBlockingPageComplete(bool proceed);
59
60 // Starts displaying the data reduction proxy interstitial page if it is not
61 // prerendering. Called on the UI thread.
62 static void StartDisplayingBlockingPage(
63 const base::WeakPtr<DataReductionProxyResourceThrottle>& throttle,
64 scoped_refptr<DataReductionProxyUIManager> ui_manager,
65 const DataReductionProxyUIManager::BypassResource& resource);
66
67 State state_;
bengr 2014/12/17 00:30:20 Document all member variables.
megjablon 2014/12/23 02:18:05 Done.
68 // Guaranteed to be valid for the lifetime of this class.
69 net::URLRequest* request_;
70 DataReductionProxyUIService* ui_service_;
71 const DataReductionProxyParams* params_;
72 const bool is_subresource_;
73
74 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyResourceThrottle);
75 };
76
77 } // namespace data_reduction_proxy
78
79 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_ RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698