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

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

Issue 2838543003: Fix in LayoutTestPermissionManager::RequestPermissions (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 int LayoutTestPermissionManager::RequestPermissions( 82 int LayoutTestPermissionManager::RequestPermissions(
83 const std::vector<PermissionType>& permissions, 83 const std::vector<PermissionType>& permissions,
84 content::RenderFrameHost* render_frame_host, 84 content::RenderFrameHost* render_frame_host,
85 const GURL& requesting_origin, 85 const GURL& requesting_origin,
86 bool user_gesture, 86 bool user_gesture,
87 const base::Callback< 87 const base::Callback<
88 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback) { 88 void(const std::vector<blink::mojom::PermissionStatus>&)>& callback) {
89 DCHECK_CURRENTLY_ON(BrowserThread::UI); 89 DCHECK_CURRENTLY_ON(BrowserThread::UI);
90 90
91 std::vector<blink::mojom::PermissionStatus> result(permissions.size()); 91 std::vector<blink::mojom::PermissionStatus> result;
92 result.reserve(permissions.size());
92 const GURL& embedding_origin = 93 const GURL& embedding_origin =
93 WebContents::FromRenderFrameHost(render_frame_host) 94 WebContents::FromRenderFrameHost(render_frame_host)
94 ->GetLastCommittedURL().GetOrigin(); 95 ->GetLastCommittedURL().GetOrigin();
95 for (const auto& permission : permissions) { 96 for (const auto& permission : permissions) {
96 result.push_back(GetPermissionStatus( 97 result.push_back(GetPermissionStatus(
97 permission, requesting_origin, embedding_origin)); 98 permission, requesting_origin, embedding_origin));
98 } 99 }
99 100
100 callback.Run(result); 101 callback.Run(result);
101 return kNoPendingOperation; 102 return kNoPendingOperation;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // 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
213 // prevent re-entrance issues. 214 // prevent re-entrance issues.
214 callbacks.push_back(base::Bind(subscription->callback, status)); 215 callbacks.push_back(base::Bind(subscription->callback, status));
215 } 216 }
216 217
217 for (const auto& callback : callbacks) 218 for (const auto& callback : callbacks)
218 callback.Run(); 219 callback.Run();
219 } 220 }
220 221
221 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698