 Chromium Code Reviews
 Chromium Code Reviews Issue 459953002:
  Migrate geolocation permissions to the new common permission class.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 459953002:
  Migrate geolocation permissions to the new common permission class.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/browser/content_settings/permission_context_base.cc | 
| diff --git a/chrome/browser/content_settings/permission_context_base.cc b/chrome/browser/content_settings/permission_context_base.cc | 
| index b85f0a77c20f3dd2a6f8968da73dfd920c8c0f0d..40ff1553a21652db6e1f93025ac15a8e0317b89c 100644 | 
| --- a/chrome/browser/content_settings/permission_context_base.cc | 
| +++ b/chrome/browser/content_settings/permission_context_base.cc | 
| @@ -23,7 +23,8 @@ PermissionContextBase::PermissionContextBase( | 
| const ContentSettingsType permission_type) | 
| : profile_(profile), | 
| permission_type_(permission_type), | 
| - weak_factory_(this) { | 
| + weak_factory_(this), | 
| + shutting_down_(false) { | 
| permission_queue_controller_.reset( | 
| new PermissionQueueController(profile_, permission_type_)); | 
| } | 
| @@ -40,6 +41,8 @@ void PermissionContextBase::RequestPermission( | 
| const BrowserPermissionCallback& callback) { | 
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 
| + if (shutting_down_) | 
| + return; | 
| DecidePermission(web_contents, | 
| id, | 
| requesting_frame.GetOrigin(), | 
| @@ -48,6 +51,27 @@ void PermissionContextBase::RequestPermission( | 
| callback); | 
| } | 
| +void PermissionContextBase::CancelPermissionRequest( | 
| + content::WebContents* web_contents, | 
| + const PermissionRequestID& id) { | 
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 
| + if (shutting_down_) | 
| + return; | 
| + | 
| + if (PermissionBubbleManager::Enabled()) { | 
| + PermissionBubbleRequest* cancelling = | 
| + pending_bubbles_.get(id.ToString()); | 
| + if (cancelling != NULL && web_contents != NULL && | 
| + PermissionBubbleManager::FromWebContents(web_contents) != NULL) { | 
| + PermissionBubbleManager::FromWebContents(web_contents)-> | 
| + CancelRequest(cancelling); | 
| + } | 
| + return; | 
| + } | 
| + | 
| + GetQueueController()->CancelInfoBarRequest(id); | 
| +} | 
| + | 
| void PermissionContextBase::DecidePermission( | 
| content::WebContents* web_contents, | 
| const PermissionRequestID& id, | 
| @@ -58,7 +82,8 @@ void PermissionContextBase::DecidePermission( | 
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 
| ContentSetting content_setting = | 
| - profile_->GetHostContentSettingsMap()->GetContentSetting( | 
| + profile_->GetHostContentSettingsMap() | 
| + ->GetContentSettingAndMaybeUpdateLastUsage( | 
| 
Michael van Ouwerkerk
2014/08/13 10:01:10
Should probably let dhnish@ know that he gets more
 
Miguel Garcia
2014/08/13 13:18:12
Acknowledged.
 | 
| requesting_origin, embedder_origin, permission_type_, std::string()); | 
| switch (content_setting) { | 
| case CONTENT_SETTING_BLOCK: | 
| @@ -183,3 +208,8 @@ void PermissionContextBase::UpdateContentSetting( | 
| std::string(), | 
| content_setting); | 
| } | 
| + | 
| +void PermissionContextBase::Shutdown() { | 
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 
| + shutting_down_ = true; | 
| +} |