OLD | NEW |
---|---|
(Empty) | |
1 // 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.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 // | |
5 // The data reduction proxy ui manager handles displaying blocking pages. After | |
6 // a page is loaded from the blocking page, another blocking page will not be | |
7 // shown for 5 minutes. | |
8 | |
9 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_UI_MANAGER_ H_ | |
10 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_UI_MANAGER_ H_ | |
11 | |
12 #include <vector> | |
13 | |
14 #include "base/callback.h" | |
15 #include "base/memory/ref_counted.h" | |
16 #include "base/time/time.h" | |
17 #include "url/gurl.h" | |
18 | |
19 namespace base { | |
20 class Time; | |
21 class Thread; | |
22 } | |
23 | |
24 namespace data_reduction_proxy { | |
25 | |
26 enum DRPBlockingPageType { | |
27 // No blocking page. | |
28 DRP_NO_PAGE, | |
29 | |
30 // The bypass is due to illegal or blacklisted content that cannot go through | |
31 // the data reduction proxy. | |
32 DRP_ILLEGAL_OR_BLACKLISTED, | |
33 | |
34 // The bypass is due to difficulties connecting to the proxy. | |
35 DRP_TECHNICAL_DIFFICULTIES, | |
36 }; | |
37 | |
38 // Construction needs to happen on the main thread. | |
39 class DataReductionProxyUIManager | |
40 : public base::RefCountedThreadSafe<DataReductionProxyUIManager> { | |
41 public: | |
42 // Passed a boolean indicating whether or not it is OK to proceed with | |
43 // loading an URL. | |
44 typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback; | |
45 | |
46 // Structure used to pass parameters between the IO and UI thread when | |
47 // interacting with the blocking page. | |
48 struct BypassResource { | |
49 BypassResource(); | |
50 ~BypassResource(); | |
51 | |
52 GURL url; | |
53 bool is_subresource; | |
54 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
| |
55 UrlCheckCallback callback; // This is called back on the IO thread. | |
56 int render_process_host_id; | |
57 int render_view_id; | |
58 }; | |
59 | |
60 DataReductionProxyUIManager(); | |
61 | |
62 // Called on the UI thread to display an interstitial page. | |
63 // |url| is the url of the resource that matches a safe browsing list. | |
64 // If the request contained a chain of redirects, |url| is the last url | |
65 // in the chain, and |original_url| is the first one (the root of the | |
66 // chain). Otherwise, |original_url| = |url|. | |
67 virtual void DisplayBlockingPage(const BypassResource& resource); | |
68 | |
69 // The blocking page on the UI thread has completed. | |
70 void OnBlockingPageDone(const std::vector<BypassResource>& resources, | |
71 bool proceed); | |
72 | |
73 private: | |
74 virtual ~DataReductionProxyUIManager(); | |
75 | |
76 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
| |
77 base::Time proceed_blocking_page_; | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUIManager); | |
80 }; | |
81 | |
82 } // namespace data_reduction_proxy | |
83 | |
84 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_DATA_REDUCTION_PROXY_UI_MANAG ER_H_ | |
OLD | NEW |