diff options
author | rdevlin.cronin <rdevlin.cronin@chromium.org> | 2015-09-24 12:50:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-24 19:52:04 +0000 |
commit | cce78d017ca073f0719a8967e29c68f3553cbf4a (patch) | |
tree | b043cba86b44197a02f50a6f77fd78407044df2b /chrome/browser/extensions/suspicious_extension_bubble_controller.cc | |
parent | 1748d384c547136d059d413f5acbb1622ba548f0 (diff) | |
download | chromium_src-cce78d017ca073f0719a8967e29c68f3553cbf4a.zip chromium_src-cce78d017ca073f0719a8967e29c68f3553cbf4a.tar.gz chromium_src-cce78d017ca073f0719a8967e29c68f3553cbf4a.tar.bz2 |
[Extensions] Fix race condition crashes in the extension bubbles
There were race conditions due to the asynchronous display of extension bubbles
where the extension(s) could have been uninstalled before the bubble is
displayed (it seems the most common time these happen is when an extension to be
warned about is queued for uninstallation via sync). Handle this situation
gracefully.
BUG=531648
TBR=sky@chromium.org (micro ui changes in files that aren't explicitly owned by finnur@)
Review URL: https://codereview.chromium.org/1352103003
Cr-Commit-Position: refs/heads/master@{#350627}
Diffstat (limited to 'chrome/browser/extensions/suspicious_extension_bubble_controller.cc')
-rw-r--r-- | chrome/browser/extensions/suspicious_extension_bubble_controller.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/extensions/suspicious_extension_bubble_controller.cc b/chrome/browser/extensions/suspicious_extension_bubble_controller.cc index be2d2e7..56b943f 100644 --- a/chrome/browser/extensions/suspicious_extension_bubble_controller.cc +++ b/chrome/browser/extensions/suspicious_extension_bubble_controller.cc @@ -40,7 +40,7 @@ class SuspiciousExtensionBubbleDelegate ~SuspiciousExtensionBubbleDelegate() override; // ExtensionMessageBubbleController::Delegate methods. - bool ShouldIncludeExtension(const std::string& extension_id) override; + bool ShouldIncludeExtension(const extensions::Extension* extension) override; void AcknowledgeExtension( const std::string& extension_id, ExtensionMessageBubbleController::BubbleAction user_action) override; @@ -55,9 +55,11 @@ class SuspiciousExtensionBubbleDelegate base::string16 GetDismissButtonLabel() const override; bool ShouldShowExtensionList() const override; bool ShouldHighlightExtensions() const override; + bool ShouldLimitToEnabledExtensions() const override; void LogExtensionCount(size_t count) override; void LogAction( ExtensionMessageBubbleController::BubbleAction action) override; + std::set<Profile*>* GetProfileSet() override; private: DISALLOW_COPY_AND_ASSIGN(SuspiciousExtensionBubbleDelegate); @@ -73,15 +75,15 @@ SuspiciousExtensionBubbleDelegate::~SuspiciousExtensionBubbleDelegate() { } bool SuspiciousExtensionBubbleDelegate::ShouldIncludeExtension( - const std::string& extension_id) { + const extensions::Extension* extension) { extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get( profile()); - if (!prefs->IsExtensionDisabled(extension_id)) + if (!prefs->IsExtensionDisabled(extension->id())) return false; - int disable_reasons = prefs->GetDisableReasons(extension_id); + int disable_reasons = prefs->GetDisableReasons(extension->id()); if (disable_reasons & extensions::Extension::DISABLE_NOT_VERIFIED) - return !HasBubbleInfoBeenAcknowledged(extension_id); + return !HasBubbleInfoBeenAcknowledged(extension->id()); return false; } @@ -141,6 +143,10 @@ bool SuspiciousExtensionBubbleDelegate::ShouldHighlightExtensions() const { return false; } +bool SuspiciousExtensionBubbleDelegate::ShouldLimitToEnabledExtensions() const { + return false; +} + void SuspiciousExtensionBubbleDelegate::LogExtensionCount( size_t count) { UMA_HISTOGRAM_COUNTS_100( @@ -154,6 +160,10 @@ void SuspiciousExtensionBubbleDelegate::LogAction( action, ExtensionMessageBubbleController::ACTION_BOUNDARY); } +std::set<Profile*>* SuspiciousExtensionBubbleDelegate::GetProfileSet() { + return g_shown_for_profiles.Pointer(); +} + } // namespace namespace extensions { @@ -175,11 +185,6 @@ SuspiciousExtensionBubbleController::SuspiciousExtensionBubbleController( SuspiciousExtensionBubbleController::~SuspiciousExtensionBubbleController() { } -bool SuspiciousExtensionBubbleController::ShouldShow() { - return !g_shown_for_profiles.Get().count(profile()->GetOriginalProfile()) && - !GetExtensionList().empty(); -} - void SuspiciousExtensionBubbleController::Show(ExtensionMessageBubble* bubble) { g_shown_for_profiles.Get().insert(profile()->GetOriginalProfile()); ExtensionMessageBubbleController::Show(bubble); |