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

Unified Diff: chrome/browser/extensions/location_bar_controller.cc

Issue 313453002: Resubmit: Block content scripts from executing until user grants permission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/location_bar_controller.cc
diff --git a/chrome/browser/extensions/location_bar_controller.cc b/chrome/browser/extensions/location_bar_controller.cc
index ee87a6bc4a75e2afd29cf9d0e6bc9a8b9cbf417e..27eab5ae4692b1bdbc34905f2768c365d777e627 100644
--- a/chrome/browser/extensions/location_bar_controller.cc
+++ b/chrome/browser/extensions/location_bar_controller.cc
@@ -21,7 +21,10 @@ LocationBarController::LocationBarController(
: WebContentsObserver(web_contents),
web_contents_(web_contents),
active_script_controller_(new ActiveScriptController(web_contents_)),
- page_action_controller_(new PageActionController(web_contents_)) {
+ page_action_controller_(new PageActionController(web_contents_)),
+ extension_registry_observer_(this) {
+ extension_registry_observer_.Add(
+ ExtensionRegistry::Get(web_contents_->GetBrowserContext()));
}
LocationBarController::~LocationBarController() {
@@ -85,4 +88,22 @@ void LocationBarController::DidNavigateMainFrame(
active_script_controller_->OnNavigated();
}
+void LocationBarController::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) {
+ bool should_update = false;
+ if (page_action_controller_->GetActionForExtension(extension)) {
+ page_action_controller_->OnExtensionUnloaded(extension);
+ should_update = true;
+ }
+ if (active_script_controller_->GetActionForExtension(extension)) {
+ active_script_controller_->OnExtensionUnloaded(extension);
+ should_update = true;
+ }
+
+ if (should_update)
+ NotifyChange(web_contents());
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/location_bar_controller.h ('k') | chrome/browser/extensions/page_action_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698