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

Side by Side Diff: content/browser/permissions/permission_service_impl.cc

Issue 2009773002: Add user_gesture bit back to Mojo PermissionService methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 #include "content/browser/permissions/permission_service_impl.h" 5 #include "content/browser/permissions/permission_service_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 void PermissionServiceImpl::OnConnectionError() { 109 void PermissionServiceImpl::OnConnectionError() {
110 CancelPendingOperations(); 110 CancelPendingOperations();
111 context_->ServiceHadConnectionError(this); 111 context_->ServiceHadConnectionError(this);
112 // After that call, |this| will be deleted. 112 // After that call, |this| will be deleted.
113 } 113 }
114 114
115 void PermissionServiceImpl::RequestPermission( 115 void PermissionServiceImpl::RequestPermission(
116 PermissionName permission, 116 PermissionName permission,
117 const mojo::String& origin, 117 const mojo::String& origin,
118 bool user_gesture,
118 const PermissionStatusCallback& callback) { 119 const PermissionStatusCallback& callback) {
119 // This condition is valid if the call is coming from a ChildThread instead of 120 // This condition is valid if the call is coming from a ChildThread instead of
120 // a RenderFrame. Some consumers of the service run in Workers and some in 121 // a RenderFrame. Some consumers of the service run in Workers and some in
121 // Frames. In the context of a Worker, it is not possible to show a 122 // Frames. In the context of a Worker, it is not possible to show a
122 // permission prompt because there is no tab. In the context of a Frame, we 123 // permission prompt because there is no tab. In the context of a Frame, we
123 // can. Even if the call comes from a context where it is not possible to show 124 // can. Even if the call comes from a context where it is not possible to show
124 // any UI, we want to still return something relevant so the current 125 // any UI, we want to still return something relevant so the current
125 // permission status is returned. 126 // permission status is returned.
126 BrowserContext* browser_context = context_->GetBrowserContext(); 127 BrowserContext* browser_context = context_->GetBrowserContext();
127 DCHECK(browser_context); 128 DCHECK(browser_context);
(...skipping 25 matching lines...) Expand all
153 void PermissionServiceImpl::OnRequestPermissionResponse( 154 void PermissionServiceImpl::OnRequestPermissionResponse(
154 int pending_request_id, 155 int pending_request_id,
155 PermissionStatus status) { 156 PermissionStatus status) {
156 OnRequestPermissionsResponse(pending_request_id, 157 OnRequestPermissionsResponse(pending_request_id,
157 std::vector<PermissionStatus>(1, status)); 158 std::vector<PermissionStatus>(1, status));
158 } 159 }
159 160
160 void PermissionServiceImpl::RequestPermissions( 161 void PermissionServiceImpl::RequestPermissions(
161 mojo::Array<PermissionName> permissions, 162 mojo::Array<PermissionName> permissions,
162 const mojo::String& origin, 163 const mojo::String& origin,
164 bool user_gesture,
163 const PermissionsStatusCallback& callback) { 165 const PermissionsStatusCallback& callback) {
164 if (permissions.is_null()) { 166 if (permissions.is_null()) {
165 callback.Run(mojo::Array<PermissionStatus>()); 167 callback.Run(mojo::Array<PermissionStatus>());
166 return; 168 return;
167 } 169 }
168 170
169 // This condition is valid if the call is coming from a ChildThread instead of 171 // This condition is valid if the call is coming from a ChildThread instead of
170 // a RenderFrame. Some consumers of the service run in Workers and some in 172 // a RenderFrame. Some consumers of the service run in Workers and some in
171 // Frames. In the context of a Worker, it is not possible to show a 173 // Frames. In the context of a Worker, it is not possible to show a
172 // permission prompt because there is no tab. In the context of a Frame, we 174 // permission prompt because there is no tab. In the context of a Frame, we
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 367
366 PermissionStatusCallback callback = subscription->callback; 368 PermissionStatusCallback callback = subscription->callback;
367 369
368 subscription->callback.reset(); 370 subscription->callback.reset();
369 pending_subscriptions_.Remove(pending_subscription_id); 371 pending_subscriptions_.Remove(pending_subscription_id);
370 372
371 callback.Run(status); 373 callback.Run(status);
372 } 374 }
373 375
374 } // namespace content 376 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/permissions/permission_service_impl.h ('k') | content/child/permissions/permission_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698