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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/content/browser/data_reduction_proxy_resource_throttle.h
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_resource_throttle.h b/components/data_reduction_proxy/content/browser/data_reduction_proxy_resource_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..76d7c4c59b35d46ce7de328524a5ba0942e8b667
--- /dev/null
+++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_resource_throttle.h
@@ -0,0 +1,79 @@
+// 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_BROWSER_DATA_REDUCTION_PROXY_RESOURCE_THROTTLE_H_
+#define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_RESOURCE_THROTTLE_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "components/data_reduction_proxy/content/browser/data_reduction_proxy_ui_manager.h"
+#include "content/public/browser/resource_throttle.h"
+#include "content/public/common/resource_type.h"
+#include "url/gurl.h"
+
+namespace net {
+class URLRequest;
+}
+
+namespace data_reduction_proxy {
+
+class DataReductionProxyParams;
+class DataReductionProxyUIManager;
+class DataReductionProxyUIService;
+
+class DataReductionProxyResourceThrottle
bengr 2014/12/17 00:30:20 Comment.
megjablon 2014/12/23 02:18:04 Done.
+ : public content::ResourceThrottle,
+ public base::SupportsWeakPtr<DataReductionProxyResourceThrottle> {
+ public:
+ DataReductionProxyResourceThrottle(
bengr 2014/12/17 00:30:20 Comment.
megjablon 2014/12/23 02:18:04 Done.
+ net::URLRequest* request,
bengr 2014/12/17 00:30:20 Can this be const?
megjablon 2014/12/23 02:18:04 Done.
+ content::ResourceType resource_type,
+ DataReductionProxyUIService* ui_service,
bengr 2014/12/17 00:30:20 Can this be const?
megjablon 2014/12/23 02:18:04 Done.
+ const DataReductionProxyParams* params);
+
+ virtual ~DataReductionProxyResourceThrottle();
+
+ // Overrides content::ResourceThrottle.
+ void WillStartUsingNetwork(bool* defer) override;
+ void WillRedirectRequest(const GURL& new_url, bool* defer) override;
+ void WillProcessResponse(bool* defer) override;
+ const char* GetNameForLogging() const override;
+
+ private:
+ enum State {
+ NOT_BYPASSED,
+ LOCAL_BYPASS,
+ REMOTE_BYPASS,
+ };
+
+ // Creates a bypass resource and calls StartDisplayingBlockingPage on the UI
+ // thread. Sets defer to true. A bypass resource is a structure used to pass
+ // parameters between the IO and UI thread when interacting with the blocking
+ // page.
+ 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_;
bengr 2014/12/17 00:30:20 Document all member variables.
megjablon 2014/12/23 02:18:05 Done.
+ // Guaranteed to be valid for the lifetime of this class.
+ net::URLRequest* request_;
+ DataReductionProxyUIService* ui_service_;
+ const DataReductionProxyParams* params_;
+ const bool is_subresource_;
+
+ DISALLOW_COPY_AND_ASSIGN(DataReductionProxyResourceThrottle);
+};
+
+} // namespace data_reduction_proxy
+
+#endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_RESOURCE_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698