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

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: Cut down on CL size Created 5 years, 3 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 -1; 76 return -1;
77 } 77 }
78 78
79 int LayoutTestPermissionManager::RequestPermissions(
80 const std::vector<PermissionType>& permissions,
81 content::RenderFrameHost* render_frame_host,
82 int request_id,
83 const GURL& requesting_origin,
84 bool user_gesture,
85 const base::Callback<void(
86 const std::vector<PermissionStatus>&)>& callback) {
87 DCHECK_CURRENTLY_ON(BrowserThread::UI);
88
89 const GURL& embedding_origin =
90 WebContents::FromRenderFrameHost(render_frame_host)
91 ->GetLastCommittedURL().GetOrigin();
92 std::vector<PermissionStatus> result;
93 for (const auto& permission : permissions) {
94 result.push_back(GetPermissionStatus(
95 permission, requesting_origin, embedding_origin));
96 }
97 callback.Run(result);
98 return -1;
99 }
100
79 void LayoutTestPermissionManager::CancelPermissionRequest( 101 void LayoutTestPermissionManager::CancelPermissionRequest(
80 RenderFrameHost* render_frame_host, 102 RenderFrameHost* render_frame_host,
81 int request_id) { 103 int request_id) {
82 DCHECK_CURRENTLY_ON(BrowserThread::UI); 104 DCHECK_CURRENTLY_ON(BrowserThread::UI);
83 } 105 }
84 106
85 void LayoutTestPermissionManager::ResetPermission( 107 void LayoutTestPermissionManager::ResetPermission(
86 PermissionType permission, 108 PermissionType permission,
87 const GURL& requesting_origin, 109 const GURL& requesting_origin,
88 const GURL& embedding_origin) { 110 const GURL& embedding_origin) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Add the callback to |callbacks| which will be run after the loop to 216 // Add the callback to |callbacks| which will be run after the loop to
195 // prevent re-entrance issues. 217 // prevent re-entrance issues.
196 callbacks.push_back(base::Bind(subscription->callback, status)); 218 callbacks.push_back(base::Bind(subscription->callback, status));
197 } 219 }
198 220
199 for (const auto& callback : callbacks) 221 for (const auto& callback : callbacks)
200 callback.Run(); 222 callback.Run();
201 } 223 }
202 224
203 } // namespace content 225 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698