OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_UI_
MANAGER_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_UI_
MANAGER_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_UI_
MANAGER_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_UI_
MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // checks if WebContents exists for the RenderViewHost retreived from these | 49 // checks if WebContents exists for the RenderViewHost retreived from these |
50 // id's. | 50 // id's. |
51 virtual bool IsTabClosed(const BypassResource& resource) const; | 51 virtual bool IsTabClosed(const BypassResource& resource) const; |
52 | 52 |
53 // Called on the UI thread to display a blocking page. |url| is the url | 53 // Called on the UI thread to display a blocking page. |url| is the url |
54 // of the resource that bypassed. If the request contained a chain of | 54 // of the resource that bypassed. If the request contained a chain of |
55 // redirects, |url| is the last url in the chain, and |original_url| is the | 55 // redirects, |url| is the last url in the chain, and |original_url| is the |
56 // first one (the root of the chain). Otherwise, |original_url| = |url|. | 56 // first one (the root of the chain). Otherwise, |original_url| = |url|. |
57 virtual void DisplayBlockingPage(const BypassResource& resource); | 57 virtual void DisplayBlockingPage(const BypassResource& resource); |
58 | 58 |
| 59 // Virtual for testing purposes. |
| 60 virtual void ShowBlockingPage(const BypassResource& resource); |
| 61 |
59 // The blocking page on the UI thread has completed. | 62 // The blocking page on the UI thread has completed. |
60 void OnBlockingPageDone(const BypassResource& resource, bool proceed); | 63 void OnBlockingPageDone(const std::vector<BypassResource>& resources, |
| 64 bool proceed); |
61 | 65 |
62 private: | 66 private: |
63 // Ref counted classes have private destructors to avoid any code deleting the | 67 // Ref counted classes have private destructors to avoid any code deleting the |
64 // object accidentally while there are still references to it. | 68 // object accidentally while there are still references to it. |
65 friend class base::RefCountedThreadSafe<DataReductionProxyUIManager>; | 69 friend class base::RefCountedThreadSafe<DataReductionProxyUIManager>; |
66 friend class TestDataReductionProxyUIManager; | 70 friend class TestDataReductionProxyUIManager; |
67 | 71 |
68 virtual ~DataReductionProxyUIManager(); | 72 virtual ~DataReductionProxyUIManager(); |
69 | 73 |
70 // Records the last time the blocking page was shown. Once the blocking page | 74 // Records the last time the blocking page was shown. Once the blocking page |
71 // is shown, it is not displayed for a period of time. | 75 // is shown, it is not displayed for a period of time. |
72 base::Time blocking_page_last_shown_; | 76 base::Time blocking_page_last_shown_; |
73 | 77 |
74 // A task runner to ensure that calls to DisplayBlockingPage take place on the | 78 // A task runner to ensure that calls to DisplayBlockingPage take place on the |
75 // UI thread. | 79 // UI thread. |
76 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 80 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
77 | 81 |
78 // A task runner to post OnBlockingPageDone to the IO thread. | 82 // A task runner to post OnBlockingPageDone to the IO thread. |
79 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 83 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
80 | 84 |
81 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUIManager); | 85 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUIManager); |
82 }; | 86 }; |
83 | 87 |
84 } // namespace data_reduction_proxy | 88 } // namespace data_reduction_proxy |
85 | 89 |
86 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_
UI_MANAGER_H_ | 90 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_DATA_REDUCTION_PROXY_
UI_MANAGER_H_ |
OLD | NEW |