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

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

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.h
diff --git a/chrome/browser/extensions/location_bar_controller.h b/chrome/browser/extensions/location_bar_controller.h
index a8bf3b4699f93fd3455cbaeab518b610010478a3..e1e16451ca50faed94fc1ede3d2b1d0cfdded98d 100644
--- a/chrome/browser/extensions/location_bar_controller.h
+++ b/chrome/browser/extensions/location_bar_controller.h
@@ -9,7 +9,9 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+#include "base/scoped_observer.h"
#include "content/public/browser/web_contents_observer.h"
+#include "extensions/browser/extension_registry_observer.h"
namespace content {
class WebContents;
@@ -21,12 +23,14 @@ namespace extensions {
class ActiveScriptController;
class Extension;
+class ExtensionRegistry;
class PageActionController;
// Interface for a class that controls the the extension icons that show up in
// the location bar. Depending on switches, these icons can have differing
// behavior.
-class LocationBarController : public content::WebContentsObserver {
+class LocationBarController : public content::WebContentsObserver,
+ public ExtensionRegistryObserver {
public:
// The action that the UI should take after executing |OnClicked|.
enum Action {
@@ -49,6 +53,12 @@ class LocationBarController : public content::WebContentsObserver {
// not in page), so any state relating to the current page should likely be
// reset.
virtual void OnNavigated() = 0;
+
+ // A notification that the given |extension| has been unloaded, and any
+ // actions associated with it should be removed.
+ // The location bar controller will update itself after this if needed, so
+ // Providers should not call NotifyChange().
+ virtual void OnExtensionUnloaded(const Extension* extension) {}
};
explicit LocationBarController(content::WebContents* web_contents);
@@ -74,6 +84,12 @@ class LocationBarController : public content::WebContentsObserver {
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) OVERRIDE;
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
+
// The associated WebContents.
content::WebContents* web_contents_;
@@ -85,6 +101,9 @@ class LocationBarController : public content::WebContentsObserver {
scoped_ptr<ActiveScriptController> active_script_controller_;
scoped_ptr<PageActionController> page_action_controller_;
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
DISALLOW_COPY_AND_ASSIGN(LocationBarController);
};

Powered by Google App Engine
This is Rietveld 408576698