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

Side by Side Diff: chrome/browser/permissions/permission_manager.cc

Issue 2046293002: Implement DelegationTracker for tracking delegated permissions to RenderFrameHosts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-delegation-2-blink
Patch Set: Implement DelegationTracker for tracking delegated permissions to RenderFrameHosts Created 4 years, 6 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 "chrome/browser/permissions/permission_manager.h" 5 #include "chrome/browser/permissions/permission_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 weak_ptr_factory_.GetWeakPtr(), request_id, i))); 310 weak_ptr_factory_.GetWeakPtr(), request_id, i)));
311 } 311 }
312 312
313 // The request might have been resolved already. 313 // The request might have been resolved already.
314 if (!pending_requests_.Lookup(request_id)) 314 if (!pending_requests_.Lookup(request_id))
315 return kNoPendingOperation; 315 return kNoPendingOperation;
316 316
317 return request_id; 317 return request_id;
318 } 318 }
319 319
320 std::size_t PermissionManager::PermissionTypeHash::operator()(
321 const content::PermissionType& type) const {
322 return static_cast<size_t>(type);
323 }
324
325 PermissionContextBase* PermissionManager::GetPermissionContext( 320 PermissionContextBase* PermissionManager::GetPermissionContext(
326 PermissionType type) { 321 PermissionType type) {
327 const auto& it = permission_contexts_.find(type); 322 const auto& it = permission_contexts_.find(type);
328 return it == permission_contexts_.end() ? nullptr : it->second.get(); 323 return it == permission_contexts_.end() ? nullptr : it->second.get();
329 } 324 }
330 325
331 void PermissionManager::OnPermissionsRequestResponseStatus( 326 void PermissionManager::OnPermissionsRequestResponseStatus(
332 int request_id, 327 int request_id,
333 int permission_id, 328 int permission_id,
334 PermissionStatus status) { 329 PermissionStatus status) {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 // Add the callback to |callbacks| which will be run after the loop to 470 // Add the callback to |callbacks| which will be run after the loop to
476 // prevent re-entrance issues. 471 // prevent re-entrance issues.
477 callbacks.push_back( 472 callbacks.push_back(
478 base::Bind(subscription->callback, 473 base::Bind(subscription->callback,
479 ContentSettingToPermissionStatus(new_value))); 474 ContentSettingToPermissionStatus(new_value)));
480 } 475 }
481 476
482 for (const auto& callback : callbacks) 477 for (const auto& callback : callbacks)
483 callback.Run(); 478 callback.Run();
484 } 479 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_manager.h ('k') | chrome/browser/permissions/permission_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698