Index: components/data_reduction_proxy/content/data_reduction_proxy_resource_throttle.h |
diff --git a/components/data_reduction_proxy/content/data_reduction_proxy_resource_throttle.h b/components/data_reduction_proxy/content/data_reduction_proxy_resource_throttle.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..643c57da828c8681c86794b1c0b6c5b2f78026b4 |
--- /dev/null |
+++ b/components/data_reduction_proxy/content/data_reduction_proxy_resource_throttle.h |
@@ -0,0 +1,75 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_RESOURCE_THROTTLE_H_ |
+#define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_RESOURCE_THROTTLE_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "components/data_reduction_proxy/content/data_reduction_proxy_ui_service.h" |
bengr
2014/10/31 17:06:48
Remove.
megjablon
2014/12/11 23:32:06
Done.
|
+#include "content/public/browser/resource_throttle.h" |
+#include "content/public/common/resource_type.h" |
+ |
+namespace net { |
+class URLRequest; |
+} |
+ |
+namespace data_reduction_proxy { |
+ |
+class DataReductionProxyParams; |
+class DataReductionProxyUIManager; |
bengr
2014/10/31 17:06:48
class DataReductionProxyUIService;
class DataReduc
megjablon
2014/12/11 23:32:05
Done.
|
+ |
+class DataReductionProxyResourceThrottle |
+ : public content::ResourceThrottle, |
+ public base::SupportsWeakPtr<DataReductionProxyResourceThrottle> { |
+ public: |
+ DataReductionProxyResourceThrottle( |
+ net::URLRequest* request, |
+ 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.
|
+ DataReductionProxyUIService* ui_service, |
+ DataReductionProxyParams* params); |
+ |
+ virtual ~DataReductionProxyResourceThrottle(); |
+ |
+ 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.
|
+ 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.
|
+ virtual void WillProcessResponse(bool* defer) override; |
+ 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.
|
+ |
+ private: |
+ enum State { |
+ NOT_BYPASSED, |
+ LOCAL_BYPASS, |
+ REMOTE_BYPASS, |
+ }; |
+ |
+ static const char* kProceedHeader; |
bengr
2014/10/31 17:06:48
Is this used?
megjablon
2014/12/11 23:32:05
No. Removed.
|
+ |
+ // 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.
|
+ // thread. Sets defer to true. |
+ void DisplayBlockingPage(bool* defer); |
+ |
+ // Called on the IO thread when the user has decided to proceed with the |
+ // current request, or go back. |
+ void OnBlockingPageComplete(bool proceed); |
+ |
+ // Starts displaying the data reduction proxy interstitial page if it is not |
+ // prerendering. Called on the UI thread. |
+ static void StartDisplayingBlockingPage( |
+ const base::WeakPtr<DataReductionProxyResourceThrottle>& throttle, |
+ scoped_refptr<DataReductionProxyUIManager> ui_manager, |
+ const DataReductionProxyUIManager::BypassResource& resource); |
+ |
+ State state_; |
+ 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.
|
+ DataReductionProxyUIService* ui_service_; |
+ DataReductionProxyParams* params_; |
+ const bool is_subresource_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DataReductionProxyResourceThrottle); |
+}; |
+ |
+} // namespace data_reduction_proxy |
+ |
+#endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_RESOURCE_THROTTLE_H_ |