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 CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" | 14 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/browser/web_contents_user_data.h" | 16 #include "content/public/browser/web_contents_user_data.h" |
17 | 17 |
18 class PermissionRequest; | 18 class PermissionRequest; |
19 | 19 |
20 namespace safe_browsing { | 20 namespace safe_browsing { |
21 class PermissionReporterBrowserTest; | 21 class PermissionReporterBrowserTest; |
22 } | 22 } |
23 | 23 |
24 namespace test { | 24 namespace test { |
| 25 class PermissionManagerStatusSourceTest; |
25 class PermissionRequestManagerTestApi; | 26 class PermissionRequestManagerTestApi; |
26 } | 27 } |
27 | 28 |
28 // Provides access to permissions bubbles. Allows clients to add a request | 29 // Provides access to permissions bubbles. Allows clients to add a request |
29 // callback interface to the existing permission bubble configuration. | 30 // callback interface to the existing permission bubble configuration. |
30 // Depending on the situation and policy, that may add new UI to an existing | 31 // Depending on the situation and policy, that may add new UI to an existing |
31 // permission bubble, create and show a new permission bubble, or provide no | 32 // permission bubble, create and show a new permission bubble, or provide no |
32 // visible UI action at all. (In that case, the request will be immediately | 33 // visible UI action at all. (In that case, the request will be immediately |
33 // informed that the permission request failed.) | 34 // informed that the permission request failed.) |
34 // | 35 // |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 friend class test::PermissionRequestManagerTestApi; | 115 friend class test::PermissionRequestManagerTestApi; |
115 | 116 |
116 // TODO(felt): Update testing to use the TestApi so that it doesn't involve a | 117 // TODO(felt): Update testing to use the TestApi so that it doesn't involve a |
117 // lot of friends. | 118 // lot of friends. |
118 friend class GeolocationBrowserTest; | 119 friend class GeolocationBrowserTest; |
119 friend class GeolocationPermissionContextTests; | 120 friend class GeolocationPermissionContextTests; |
120 friend class MockPermissionPrompt; | 121 friend class MockPermissionPrompt; |
121 friend class MockPermissionPromptFactory; | 122 friend class MockPermissionPromptFactory; |
122 friend class PermissionContextBaseTests; | 123 friend class PermissionContextBaseTests; |
123 friend class PermissionRequestManagerTest; | 124 friend class PermissionRequestManagerTest; |
| 125 friend class content::WebContentsUserData<PermissionRequestManager>; |
124 friend class safe_browsing::PermissionReporterBrowserTest; | 126 friend class safe_browsing::PermissionReporterBrowserTest; |
125 friend class content::WebContentsUserData<PermissionRequestManager>; | 127 friend class test::PermissionManagerStatusSourceTest; |
126 FRIEND_TEST_ALL_PREFIXES(DownloadTest, TestMultipleDownloadsBubble); | 128 FRIEND_TEST_ALL_PREFIXES(DownloadTest, TestMultipleDownloadsBubble); |
127 | 129 |
128 explicit PermissionRequestManager(content::WebContents* web_contents); | 130 explicit PermissionRequestManager(content::WebContents* web_contents); |
129 | 131 |
130 // WebContentsObserver: | 132 // WebContentsObserver: |
131 void DidFinishNavigation( | 133 void DidFinishNavigation( |
132 content::NavigationHandle* navigation_handle) override; | 134 content::NavigationHandle* navigation_handle) override; |
133 void DocumentOnLoadCompletedInMainFrame() override; | 135 void DocumentOnLoadCompletedInMainFrame() override; |
134 void DocumentLoadedInFrame( | 136 void DocumentLoadedInFrame( |
135 content::RenderFrameHost* render_frame_host) override; | 137 content::RenderFrameHost* render_frame_host) override; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // Whether the response to each request should be persisted. | 199 // Whether the response to each request should be persisted. |
198 bool persist_; | 200 bool persist_; |
199 | 201 |
200 base::ObserverList<Observer> observer_list_; | 202 base::ObserverList<Observer> observer_list_; |
201 AutoResponseType auto_response_for_test_; | 203 AutoResponseType auto_response_for_test_; |
202 | 204 |
203 base::WeakPtrFactory<PermissionRequestManager> weak_factory_; | 205 base::WeakPtrFactory<PermissionRequestManager> weak_factory_; |
204 }; | 206 }; |
205 | 207 |
206 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ | 208 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ |
OLD | NEW |