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)); |
Bernhard Bauer
2014/08/13 13:34:32
Nit: I always forget this myself, but there is DCH
Miguel Garcia
2014/08/13 14:25:50
Nice!
|
+ if (shutting_down_) |
Bernhard Bauer
2014/08/13 13:34:32
When is this called during shutdown?
Miguel Garcia
2014/08/13 14:25:50
This can be called by webkit at any time essential
Bernhard Bauer
2014/08/13 21:05:08
Well, not really at *any* time... The reason why I
|
+ 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( |
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; |
+} |