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

Side by Side Diff: android_webview/browser/aw_permission_manager.cc

Issue 1419083002: Permissions: browser/ side implementation of multiple permissions request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "android_webview/browser/aw_permission_manager.h" 5 #include "android_webview/browser/aw_permission_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "android_webview/browser/aw_browser_permission_request_delegate.h" 9 #include "android_webview/browser/aw_browser_permission_request_delegate.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 callback.Run(content::PERMISSION_STATUS_GRANTED); 251 callback.Run(content::PERMISSION_STATUS_GRANTED);
252 break; 252 break;
253 case PermissionType::NUM: 253 case PermissionType::NUM:
254 NOTREACHED() << "PermissionType::NUM was not expected here."; 254 NOTREACHED() << "PermissionType::NUM was not expected here.";
255 callback.Run(content::PERMISSION_STATUS_DENIED); 255 callback.Run(content::PERMISSION_STATUS_DENIED);
256 break; 256 break;
257 } 257 }
258 return request_id; 258 return request_id;
259 } 259 }
260 260
261 int AwPermissionManager::RequestPermissions(
262 const std::vector<PermissionType>& permissions,
263 content::RenderFrameHost* render_frame_host,
264 const GURL& requesting_origin,
265 bool user_gesture,
266 const base::Callback<void(
267 const std::vector<PermissionStatus>&)>& callback) {
268 NOTIMPLEMENTED() << "RequestPermissions has not been implemented in WebView";
269
270 std::vector<PermissionStatus> result(permissions.size());
271 const GURL& embedding_origin =
272 content::WebContents::FromRenderFrameHost(render_frame_host)
273 ->GetLastCommittedURL().GetOrigin();
274
275 for (PermissionType type : permissions) {
276 result.push_back(GetPermissionStatus(
277 type, requesting_origin, embedding_origin));
278 }
279
280 callback.Run(result);
281 return kNoPendingOperation;
282 }
283
261 // static 284 // static
262 void AwPermissionManager::OnRequestResponse( 285 void AwPermissionManager::OnRequestResponse(
263 const base::WeakPtr<AwPermissionManager>& manager, 286 const base::WeakPtr<AwPermissionManager>& manager,
264 int request_id, 287 int request_id,
265 const base::Callback<void(PermissionStatus)>& callback, 288 const base::Callback<void(PermissionStatus)>& callback,
266 bool allowed) { 289 bool allowed) {
267 PermissionStatus status = allowed ? content::PERMISSION_STATUS_GRANTED 290 PermissionStatus status = allowed ? content::PERMISSION_STATUS_GRANTED
268 : content::PERMISSION_STATUS_DENIED; 291 : content::PERMISSION_STATUS_DENIED;
269 if (manager.get()) { 292 if (manager.get()) {
270 PendingRequest* pending_request = 293 PendingRequest* pending_request =
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 const GURL& embedding_origin, 409 const GURL& embedding_origin,
387 const base::Callback<void(PermissionStatus)>& callback) { 410 const base::Callback<void(PermissionStatus)>& callback) {
388 return kNoPendingOperation; 411 return kNoPendingOperation;
389 } 412 }
390 413
391 void AwPermissionManager::UnsubscribePermissionStatusChange( 414 void AwPermissionManager::UnsubscribePermissionStatusChange(
392 int subscription_id) { 415 int subscription_id) {
393 } 416 }
394 417
395 } // namespace android_webview 418 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_permission_manager.h ('k') | chrome/browser/permissions/permission_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698