Index: components/data_reduction_proxy/content/browser/data_reduction_proxy_ui_manager.h |
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_ui_manager.h b/components/data_reduction_proxy/content/browser/data_reduction_proxy_ui_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a4496baa37ce7231a30dab21e089e5572a45cdb2 |
--- /dev/null |
+++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_ui_manager.h |
@@ -0,0 +1,73 @@ |
+// 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_UI_MANAGER_H_ |
+#define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_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; |
bengr
2014/12/29 18:45:42
Remove this forward declaration.
megjablon
2014/12/30 23:40:01
Done.
|
+class Thread; |
bengr
2014/12/29 18:45:42
Why is this needed?
megjablon
2014/12/30 23:40:01
No longer needed. Removed.
|
+} |
+ |
+namespace data_reduction_proxy { |
+ |
+// 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; |
+ UrlCheckCallback callback; // This is called back on the IO thread. |
+ int render_process_host_id; |
+ int render_view_id; |
+ }; |
+ |
+ // 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. |
+ 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: |
+ // Ref counted classes have private destructors to avoid any code deleting the |
+ // object accidentally while there are still references to it. |
+ friend class base::RefCountedThreadSafe<DataReductionProxyUIManager>; |
+ |
+ virtual ~DataReductionProxyUIManager(); |
+ |
+ base::Time proceed_blocking_page_; |
bengr
2014/12/29 18:45:42
Why is this a Time? Consider a more descriptive va
megjablon
2014/12/30 23:40:01
What other type do you suggest?
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUIManager); |
+}; |
+ |
+} // namespace data_reduction_proxy |
+ |
+#endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_UI_MANAGER_H_ |