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 <unordered_map> | 8 #include <unordered_map> |
9 #include <vector> | 9 #include <vector> |
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/website_settings/permission_bubble_view.h" | 14 #include "chrome/browser/ui/website_settings/permission_bubble_view.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 { |
| 21 class PermissionReporterBrowserTest; |
| 22 } |
| 23 |
20 // Provides access to permissions bubbles. Allows clients to add a request | 24 // Provides access to permissions bubbles. Allows clients to add a request |
21 // callback interface to the existing permission bubble configuration. | 25 // callback interface to the existing permission bubble configuration. |
22 // Depending on the situation and policy, that may add new UI to an existing | 26 // Depending on the situation and policy, that may add new UI to an existing |
23 // permission bubble, create and show a new permission bubble, or provide no | 27 // permission bubble, create and show a new permission bubble, or provide no |
24 // visible UI action at all. (In that case, the request will be immediately | 28 // visible UI action at all. (In that case, the request will be immediately |
25 // informed that the permission request failed.) | 29 // informed that the permission request failed.) |
26 // | 30 // |
27 // A PermissionRequestManager is associated with a particular WebContents. | 31 // A PermissionRequestManager is associated with a particular WebContents. |
28 // Requests attached to a particular WebContents' PBM must outlive it. | 32 // Requests attached to a particular WebContents' PBM must outlive it. |
29 // | 33 // |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void set_auto_response_for_test(AutoResponseType response) { | 99 void set_auto_response_for_test(AutoResponseType response) { |
96 auto_response_for_test_ = response; | 100 auto_response_for_test_ = response; |
97 } | 101 } |
98 | 102 |
99 private: | 103 private: |
100 // TODO(felt): Update testing so that it doesn't involve a lot of friends. | 104 // TODO(felt): Update testing so that it doesn't involve a lot of friends. |
101 friend class GeolocationBrowserTest; | 105 friend class GeolocationBrowserTest; |
102 friend class GeolocationPermissionContextTests; | 106 friend class GeolocationPermissionContextTests; |
103 friend class MockPermissionBubbleFactory; | 107 friend class MockPermissionBubbleFactory; |
104 friend class MockPermissionBubbleView; | 108 friend class MockPermissionBubbleView; |
| 109 friend class safe_browsing::PermissionReporterBrowserTest; |
105 friend class PermissionRequestManagerTest; | 110 friend class PermissionRequestManagerTest; |
106 friend class PermissionContextBaseTests; | 111 friend class PermissionContextBaseTests; |
107 friend class content::WebContentsUserData<PermissionRequestManager>; | 112 friend class content::WebContentsUserData<PermissionRequestManager>; |
108 FRIEND_TEST_ALL_PREFIXES(DownloadTest, TestMultipleDownloadsBubble); | 113 FRIEND_TEST_ALL_PREFIXES(DownloadTest, TestMultipleDownloadsBubble); |
109 | 114 |
110 explicit PermissionRequestManager(content::WebContents* web_contents); | 115 explicit PermissionRequestManager(content::WebContents* web_contents); |
111 | 116 |
112 // WebContentsObserver: | 117 // WebContentsObserver: |
113 void DidNavigateMainFrame( | 118 void DidNavigateMainFrame( |
114 const content::LoadCommittedDetails& details, | 119 const content::LoadCommittedDetails& details, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Whether each of the requests in |requests_| is accepted by the user. | 189 // Whether each of the requests in |requests_| is accepted by the user. |
185 std::vector<bool> accept_states_; | 190 std::vector<bool> accept_states_; |
186 | 191 |
187 base::ObserverList<Observer> observer_list_; | 192 base::ObserverList<Observer> observer_list_; |
188 AutoResponseType auto_response_for_test_; | 193 AutoResponseType auto_response_for_test_; |
189 | 194 |
190 base::WeakPtrFactory<PermissionRequestManager> weak_factory_; | 195 base::WeakPtrFactory<PermissionRequestManager> weak_factory_; |
191 }; | 196 }; |
192 | 197 |
193 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ | 198 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ |
OLD | NEW |