Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome/browser/permissions/permission_request_manager.h

Issue 2770423002: Do not show permission bubble when browser is not active (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 static bool IsEnabled(); 95 static bool IsEnabled();
96 96
97 // Get the native window of the bubble. 97 // Get the native window of the bubble.
98 // TODO(hcarmona): Remove this as part of the bubble API work. 98 // TODO(hcarmona): Remove this as part of the bubble API work.
99 gfx::NativeWindow GetBubbleWindow(); 99 gfx::NativeWindow GetBubbleWindow();
100 100
101 // For observing the status of the permission bubble manager. 101 // For observing the status of the permission bubble manager.
102 void AddObserver(Observer* observer); 102 void AddObserver(Observer* observer);
103 void RemoveObserver(Observer* observer); 103 void RemoveObserver(Observer* observer);
104 104
105 // Called when |web_contents()| is active, and its browser's visibility
106 // changed.
107 void OnBrowserVisibilityChanged(bool visible);
108
105 // Do NOT use this methods in production code. Use this methods in browser 109 // Do NOT use this methods in production code. Use this methods in browser
106 // tests that need to accept or deny permissions when requested in 110 // tests that need to accept or deny permissions when requested in
107 // JavaScript. Your test needs to set this appropriately, and then the bubble 111 // JavaScript. Your test needs to set this appropriately, and then the bubble
108 // will proceed as desired as soon as Show() is called. 112 // will proceed as desired as soon as Show() is called.
109 void set_auto_response_for_test(AutoResponseType response) { 113 void set_auto_response_for_test(AutoResponseType response) {
110 auto_response_for_test_ = response; 114 auto_response_for_test_ = response;
111 } 115 }
112 116
113 private: 117 private:
114 friend class test::PermissionRequestManagerTestApi; 118 friend class test::PermissionRequestManagerTestApi;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void NotifyBubbleAdded(); 183 void NotifyBubbleAdded();
180 184
181 void DoAutoResponseForTesting(); 185 void DoAutoResponseForTesting();
182 186
183 // Factory to be used to create views when needed. 187 // Factory to be used to create views when needed.
184 PermissionPrompt::Factory view_factory_; 188 PermissionPrompt::Factory view_factory_;
185 189
186 // The UI surface to be used to display the permissions requests. 190 // The UI surface to be used to display the permissions requests.
187 std::unique_ptr<PermissionPrompt> view_; 191 std::unique_ptr<PermissionPrompt> view_;
188 192
193 // Whether the browser that hosts |web_contents()| is visible.
194 bool browser_visible_;
195
189 std::vector<PermissionRequest*> requests_; 196 std::vector<PermissionRequest*> requests_;
190 std::vector<PermissionRequest*> queued_requests_; 197 std::vector<PermissionRequest*> queued_requests_;
191 std::vector<PermissionRequest*> queued_frame_requests_; 198 std::vector<PermissionRequest*> queued_frame_requests_;
192 // Maps from the first request of a kind to subsequent requests that were 199 // Maps from the first request of a kind to subsequent requests that were
193 // duped against it. 200 // duped against it.
194 std::unordered_multimap<PermissionRequest*, PermissionRequest*> 201 std::unordered_multimap<PermissionRequest*, PermissionRequest*>
195 duplicate_requests_; 202 duplicate_requests_;
196 203
197 // URL of the main frame in the WebContents to which this manager is attached. 204 // URL of the main frame in the WebContents to which this manager is attached.
198 // TODO(gbillock): if there are iframes in the page, we need to deal with it. 205 // TODO(gbillock): if there are iframes in the page, we need to deal with it.
199 GURL request_url_; 206 GURL request_url_;
200 bool main_frame_has_fully_loaded_; 207 bool main_frame_has_fully_loaded_;
201 208
202 // Whether the response to each request should be persisted. 209 // Whether the response to each request should be persisted.
203 bool persist_; 210 bool persist_;
204 211
205 // Whether each of the requests in |requests_| is accepted by the user. 212 // Whether each of the requests in |requests_| is accepted by the user.
206 std::vector<bool> accept_states_; 213 std::vector<bool> accept_states_;
207 214
208 base::ObserverList<Observer> observer_list_; 215 base::ObserverList<Observer> observer_list_;
209 AutoResponseType auto_response_for_test_; 216 AutoResponseType auto_response_for_test_;
210 217
211 base::WeakPtrFactory<PermissionRequestManager> weak_factory_; 218 base::WeakPtrFactory<PermissionRequestManager> weak_factory_;
212 }; 219 };
213 220
214 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_ 221 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_REQUEST_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_request_manager.cc » ('j') | chrome/browser/ui/views/frame/browser_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698