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

Side by Side Diff: chrome/browser/ui/website_settings/permission_bubble_manager.h

Issue 839063003: By default, remove user gesture restriction from permission bubbles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove debugging statement Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/ui/website_settings/permission_bubble_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // In some circumstances, we can remove the request from the bubble, and may 50 // In some circumstances, we can remove the request from the bubble, and may
51 // do so. The request will have RequestFinished executed on it if it is found, 51 // do so. The request will have RequestFinished executed on it if it is found,
52 // at which time the caller is free to delete the request. 52 // at which time the caller is free to delete the request.
53 virtual void CancelRequest(PermissionBubbleRequest* request); 53 virtual void CancelRequest(PermissionBubbleRequest* request);
54 54
55 // Sets the active view for the permission bubble. If this is NULL, it 55 // Sets the active view for the permission bubble. If this is NULL, it
56 // means any existing permission bubble can no longer be shown. Does not 56 // means any existing permission bubble can no longer be shown. Does not
57 // take ownership of the view. 57 // take ownership of the view.
58 void SetView(PermissionBubbleView* view) override; 58 void SetView(PermissionBubbleView* view) override;
59 59
60 // Controls whether incoming permission requests require user gestures.
61 // If |required| is false, requests will be displayed as soon as they come in.
62 // If |required| is true, requests will be silently queued until a request
63 // comes in with a user gesture.
64 void RequireUserGesture(bool required);
65
60 private: 66 private:
61 friend class DownloadRequestLimiterTest; 67 friend class DownloadRequestLimiterTest;
62 friend class PermissionBubbleManagerTest; 68 friend class PermissionBubbleManagerTest;
63 friend class PermissionContextBaseTests; 69 friend class PermissionContextBaseTests;
64 friend class content::WebContentsUserData<PermissionBubbleManager>; 70 friend class content::WebContentsUserData<PermissionBubbleManager>;
65 71
66 explicit PermissionBubbleManager(content::WebContents* web_contents); 72 explicit PermissionBubbleManager(content::WebContents* web_contents);
67 73
68 // WebContentsObserver: 74 // WebContentsObserver:
69 void DocumentOnLoadCompletedInMainFrame() override; 75 void DocumentOnLoadCompletedInMainFrame() override;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // is the same object as an existing request in |queue|, false otherwise. 109 // is the same object as an existing request in |queue|, false otherwise.
104 bool ExistingRequest(PermissionBubbleRequest* request, 110 bool ExistingRequest(PermissionBubbleRequest* request,
105 const std::vector<PermissionBubbleRequest*>& queue, 111 const std::vector<PermissionBubbleRequest*>& queue,
106 bool* same_object); 112 bool* same_object);
107 113
108 // Returns true if |queue| contains a request which was generated by a user 114 // Returns true if |queue| contains a request which was generated by a user
109 // gesture. Returns false otherwise. 115 // gesture. Returns false otherwise.
110 bool HasUserGestureRequest( 116 bool HasUserGestureRequest(
111 const std::vector<PermissionBubbleRequest*>& queue); 117 const std::vector<PermissionBubbleRequest*>& queue);
112 118
119 // Whether to delay displaying the bubble until a request with a user gesture.
120 // False by default, unless RequireUserGesture(bool) changes the value.
121 bool require_user_gesture_;
122
113 // Whether or not we are showing the bubble in this tab. 123 // Whether or not we are showing the bubble in this tab.
114 bool bubble_showing_; 124 bool bubble_showing_;
115 125
116 // Set to the UI surface to be used to display the permissions requests. 126 // Set to the UI surface to be used to display the permissions requests.
117 PermissionBubbleView* view_; 127 PermissionBubbleView* view_;
118 128
119 std::vector<PermissionBubbleRequest*> requests_; 129 std::vector<PermissionBubbleRequest*> requests_;
120 std::vector<PermissionBubbleRequest*> queued_requests_; 130 std::vector<PermissionBubbleRequest*> queued_requests_;
121 std::vector<PermissionBubbleRequest*> queued_frame_requests_; 131 std::vector<PermissionBubbleRequest*> queued_frame_requests_;
122 132
123 // URL of the main frame in the WebContents to which this manager is attached. 133 // URL of the main frame in the WebContents to which this manager is attached.
124 // TODO(gbillock): if there are iframes in the page, we need to deal with it. 134 // TODO(gbillock): if there are iframes in the page, we need to deal with it.
125 GURL request_url_; 135 GURL request_url_;
126 bool request_url_has_loaded_; 136 bool request_url_has_loaded_;
127 137
128 std::vector<bool> accept_states_; 138 std::vector<bool> accept_states_;
129 bool customization_mode_; 139 bool customization_mode_;
130 140
131 base::WeakPtrFactory<PermissionBubbleManager> weak_factory_; 141 base::WeakPtrFactory<PermissionBubbleManager> weak_factory_;
132 }; 142 };
133 143
134 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ 144 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/website_settings/permission_bubble_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698