Index: components/data_reduction_proxy/content/data_reduction_proxy_ui_manager.h |
diff --git a/components/data_reduction_proxy/content/data_reduction_proxy_ui_manager.h b/components/data_reduction_proxy/content/data_reduction_proxy_ui_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ab1de29056ee1f7b7c774ba8fe31845169d499c |
--- /dev/null |
+++ b/components/data_reduction_proxy/content/data_reduction_proxy_ui_manager.h |
@@ -0,0 +1,84 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
bengr
2014/10/31 17:06:48
It's 2014, fyi. :)
megjablon
2014/12/11 23:32:06
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+// |
+// The data reduction proxy ui manager handles displaying blocking pages. After |
+// a page is loaded from the blocking page, another blocking page will not be |
+// shown for 5 minutes. |
+ |
+#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_UI_MANAGER_H_ |
+#define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_UI_MANAGER_H_ |
+ |
+#include <vector> |
+ |
+#include "base/callback.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/time/time.h" |
+#include "url/gurl.h" |
+ |
+namespace base { |
+class Time; |
+class Thread; |
+} |
+ |
+namespace data_reduction_proxy { |
+ |
+enum DRPBlockingPageType { |
+ // No blocking page. |
+ DRP_NO_PAGE, |
+ |
+ // The bypass is due to illegal or blacklisted content that cannot go through |
+ // the data reduction proxy. |
+ DRP_ILLEGAL_OR_BLACKLISTED, |
+ |
+ // The bypass is due to difficulties connecting to the proxy. |
+ DRP_TECHNICAL_DIFFICULTIES, |
+}; |
+ |
+// Construction needs to happen on the main thread. |
+class DataReductionProxyUIManager |
+ : public base::RefCountedThreadSafe<DataReductionProxyUIManager> { |
+ public: |
+ // Passed a boolean indicating whether or not it is OK to proceed with |
+ // loading an URL. |
+ typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback; |
+ |
+ // Structure used to pass parameters between the IO and UI thread when |
+ // interacting with the blocking page. |
+ struct BypassResource { |
+ BypassResource(); |
+ ~BypassResource(); |
+ |
+ GURL url; |
+ bool is_subresource; |
+ DRPBlockingPageType blocking_page_type; |
bengr
2014/10/31 17:06:48
Spell out DataReductionProxy instead of using DRP
megjablon
2014/12/11 23:32:06
Removing the blocking page type since this page is
|
+ UrlCheckCallback callback; // This is called back on the IO thread. |
+ int render_process_host_id; |
+ int render_view_id; |
+ }; |
+ |
+ DataReductionProxyUIManager(); |
+ |
+ // Called on the UI thread to display an interstitial page. |
+ // |url| is the url of the resource that matches a safe browsing list. |
+ // If the request contained a chain of redirects, |url| is the last url |
+ // in the chain, and |original_url| is the first one (the root of the |
+ // chain). Otherwise, |original_url| = |url|. |
+ virtual void DisplayBlockingPage(const BypassResource& resource); |
+ |
+ // The blocking page on the UI thread has completed. |
+ void OnBlockingPageDone(const std::vector<BypassResource>& resources, |
+ bool proceed); |
+ |
+ private: |
+ virtual ~DataReductionProxyUIManager(); |
+ |
+ friend class base::RefCountedThreadSafe<DataReductionProxyUIManager>; |
bengr
2014/10/31 17:06:48
Why do you need to friend the UIManager?
megjablon
2014/12/11 23:32:06
https://code.google.com/p/chromium/codesearch#chro
|
+ base::Time proceed_blocking_page_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUIManager); |
+}; |
+ |
+} // namespace data_reduction_proxy |
+ |
+#endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_UI_MANAGER_H_ |