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

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

Issue 2697473002: Remove last usage functions from HostContentSettingsMap and clean up prefs (Closed)
Patch Set: fix up unit test Created 3 years, 10 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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 PermissionType permission, 418 PermissionType permission,
419 const GURL& requesting_origin, 419 const GURL& requesting_origin,
420 const GURL& embedding_origin) { 420 const GURL& embedding_origin) {
421 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 421 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
422 if (IsConstantPermission(permission)) 422 if (IsConstantPermission(permission))
423 return GetPermissionStatusForConstantPermission(permission); 423 return GetPermissionStatusForConstantPermission(permission);
424 return GetPermissionStatus(PermissionTypeToContentSetting(permission), 424 return GetPermissionStatus(PermissionTypeToContentSetting(permission),
425 requesting_origin, embedding_origin); 425 requesting_origin, embedding_origin);
426 } 426 }
427 427
428 void PermissionManager::RegisterPermissionUsage(PermissionType permission,
429 const GURL& requesting_origin,
430 const GURL& embedding_origin) {
431 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
432 // This is required because constant permissions don't have a
433 // ContentSettingsType.
434 if (IsConstantPermission(permission))
435 return;
436
437 HostContentSettingsMapFactory::GetForProfile(profile_)->UpdateLastUsage(
438 requesting_origin,
439 embedding_origin,
440 PermissionTypeToContentSetting(permission));
441 }
442
443 int PermissionManager::SubscribePermissionStatusChange( 428 int PermissionManager::SubscribePermissionStatusChange(
444 PermissionType permission, 429 PermissionType permission,
445 const GURL& requesting_origin, 430 const GURL& requesting_origin,
446 const GURL& embedding_origin, 431 const GURL& embedding_origin,
447 const base::Callback<void(PermissionStatus)>& callback) { 432 const base::Callback<void(PermissionStatus)>& callback) {
448 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 433 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
449 if (subscriptions_.IsEmpty()) 434 if (subscriptions_.IsEmpty())
450 HostContentSettingsMapFactory::GetForProfile(profile_)->AddObserver(this); 435 HostContentSettingsMapFactory::GetForProfile(profile_)->AddObserver(this);
451 436
452 auto subscription = base::MakeUnique<Subscription>(); 437 auto subscription = base::MakeUnique<Subscription>();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 subscription->current_value = new_value; 496 subscription->current_value = new_value;
512 497
513 // Add the callback to |callbacks| which will be run after the loop to 498 // Add the callback to |callbacks| which will be run after the loop to
514 // prevent re-entrance issues. 499 // prevent re-entrance issues.
515 callbacks.push_back(base::Bind(subscription->callback, new_value)); 500 callbacks.push_back(base::Bind(subscription->callback, new_value));
516 } 501 }
517 502
518 for (const auto& callback : callbacks) 503 for (const auto& callback : callbacks)
519 callback.Run(); 504 callback.Run();
520 } 505 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_manager.h ('k') | chromecast/browser/cast_permission_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698