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

Side by Side Diff: content/shell/browser/layout_test/layout_test_permission_manager.cc

Issue 1316863010: browser: implement multiple permission requesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@request-multiple-content
Patch Set: Rebase on master 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 "content/shell/browser/layout_test/layout_test_permission_manager.h" 5 #include "content/shell/browser/layout_test/layout_test_permission_manager.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const base::Callback<void(PermissionStatus)>& callback) { 69 const base::Callback<void(PermissionStatus)>& callback) {
70 DCHECK_CURRENTLY_ON(BrowserThread::UI); 70 DCHECK_CURRENTLY_ON(BrowserThread::UI);
71 71
72 callback.Run(GetPermissionStatus( 72 callback.Run(GetPermissionStatus(
73 permission, requesting_origin, 73 permission, requesting_origin,
74 WebContents::FromRenderFrameHost(render_frame_host) 74 WebContents::FromRenderFrameHost(render_frame_host)
75 ->GetLastCommittedURL().GetOrigin())); 75 ->GetLastCommittedURL().GetOrigin()));
76 return kNoPendingOperation; 76 return kNoPendingOperation;
77 } 77 }
78 78
79 void LayoutTestPermissionManager::CancelPermissionRequest( 79 int LayoutTestPermissionManager::RequestPermissions(
80 PermissionType permission, 80 const std::vector<PermissionType>& permissions,
81 RenderFrameHost* render_frame_host, 81 content::RenderFrameHost* render_frame_host,
82 int request_id, 82 const GURL& requesting_origin,
83 const GURL& requesting_origin) { 83 bool user_gesture,
84 const base::Callback<void(
85 const std::vector<PermissionStatus>&)>& callback) {
86 DCHECK_CURRENTLY_ON(BrowserThread::UI);
87
88 const GURL& embedding_origin =
89 WebContents::FromRenderFrameHost(render_frame_host)
90 ->GetLastCommittedURL().GetOrigin();
91 std::vector<PermissionStatus> result;
92 for (const auto& permission : permissions) {
93 result.push_back(GetPermissionStatus(
94 permission, requesting_origin, embedding_origin));
95 }
96 callback.Run(result);
97 return kNoPendingOperation;
98 }
99
100 void LayoutTestPermissionManager::CancelPermissionRequest(int request_id) {
84 DCHECK_CURRENTLY_ON(BrowserThread::UI); 101 DCHECK_CURRENTLY_ON(BrowserThread::UI);
85 } 102 }
86 103
87 void LayoutTestPermissionManager::ResetPermission( 104 void LayoutTestPermissionManager::ResetPermission(
88 PermissionType permission, 105 PermissionType permission,
89 const GURL& requesting_origin, 106 const GURL& requesting_origin,
90 const GURL& embedding_origin) { 107 const GURL& embedding_origin) {
91 DCHECK_CURRENTLY_ON(BrowserThread::UI); 108 DCHECK_CURRENTLY_ON(BrowserThread::UI);
92 109
93 base::AutoLock lock(permissions_lock_); 110 base::AutoLock lock(permissions_lock_);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // Add the callback to |callbacks| which will be run after the loop to 213 // Add the callback to |callbacks| which will be run after the loop to
197 // prevent re-entrance issues. 214 // prevent re-entrance issues.
198 callbacks.push_back(base::Bind(subscription->callback, status)); 215 callbacks.push_back(base::Bind(subscription->callback, status));
199 } 216 }
200 217
201 for (const auto& callback : callbacks) 218 for (const auto& callback : callbacks)
202 callback.Run(); 219 callback.Run();
203 } 220 }
204 221
205 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/layout_test/layout_test_permission_manager.h ('k') | content/shell/browser/shell_permission_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698