Index: chrome/browser/extensions/script_bubble_controller.cc |
diff --git a/chrome/browser/extensions/script_bubble_controller.cc b/chrome/browser/extensions/script_bubble_controller.cc |
index 67c6593e3ae904d3770b245e9372d843b71ad9ee..a4f76cee55ebef7df9e04559a30560f57fbb171b 100644 |
--- a/chrome/browser/extensions/script_bubble_controller.cc |
+++ b/chrome/browser/extensions/script_bubble_controller.cc |
@@ -13,6 +13,7 @@ |
#include "chrome/browser/extensions/location_bar_controller.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/common/extensions/extension.h" |
+#include "content/public/browser/navigation_details.h" |
namespace extensions { |
@@ -40,7 +41,7 @@ void ScriptBubbleController::OnScriptsExecuted( |
// those are effectively not installed from the user's point of view. |
const Extension* extension = |
extension_service->extensions()->GetByID(i->first); |
- if (extension->ShouldDisplayInExtensionSettings()) |
+ if (extension && extension->ShouldDisplayInExtensionSettings()) |
changed |= extensions_running_scripts_.insert(i->first).second; |
} |
@@ -51,10 +52,18 @@ void ScriptBubbleController::OnScriptsExecuted( |
void ScriptBubbleController::DidNavigateMainFrame( |
const content::LoadCommittedDetails& details, |
const content::FrameNavigateParams& params) { |
+ if (!details.is_navigation_to_different_page()) |
+ return; |
extensions_running_scripts_.clear(); |
UpdateScriptBubble(); |
} |
+void ScriptBubbleController::OnExtensionUnloaded( |
+ const std::string& extension_id) { |
+ if (extensions_running_scripts_.erase(extension_id) == 1) |
+ UpdateScriptBubble(); |
+} |
+ |
Profile* ScriptBubbleController::profile() const { |
return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
} |