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

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

Issue 516633002: Stop showing page actions in the location bar with redesign enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest CQ for Master Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/active_script_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/active_script_controller.h
diff --git a/chrome/browser/extensions/active_script_controller.h b/chrome/browser/extensions/active_script_controller.h
index c3fee9dd67a809b5065bf31e8554a0eb6412ef64..d741c1efec92a53319f41aaa6a2d3c7a3aacc9a7 100644
--- a/chrome/browser/extensions/active_script_controller.h
+++ b/chrome/browser/extensions/active_script_controller.h
@@ -15,6 +15,7 @@
#include "base/memory/linked_ptr.h"
#include "chrome/browser/extensions/location_bar_controller.h"
#include "content/public/browser/web_contents_observer.h"
+#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/user_script.h"
@@ -30,12 +31,14 @@ class ExtensionAction;
namespace extensions {
class Extension;
+class ExtensionRegistry;
// The provider for ExtensionActions corresponding to scripts which are actively
// running or need permission.
// TODO(rdevlin.cronin): This isn't really a controller, but it has good parity
// with LocationBar"Controller".
-class ActiveScriptController : public content::WebContentsObserver {
+class ActiveScriptController : public content::WebContentsObserver,
+ public ExtensionRegistryObserver {
public:
explicit ActiveScriptController(content::WebContents* web_contents);
virtual ~ActiveScriptController();
@@ -68,10 +71,6 @@ class ActiveScriptController : public content::WebContentsObserver {
// action should be displayed.
ExtensionAction* GetActionForExtension(const Extension* extension);
- // Notifies that the given |extension| has been unloaded; forwarded from the
- // ExtensionRegistryObserver method.
- void OnExtensionUnloaded(const Extension* extension);
-
#if defined(UNIT_TEST)
// Only used in tests.
PermissionsData::AccessType RequiresUserConsentForScriptInjectionForTesting(
@@ -113,14 +112,20 @@ class ActiveScriptController : public content::WebContentsObserver {
// Grants permission for the given request to run.
void PermitScriptInjection(int64 request_id);
+ // Log metrics.
+ void LogUMA() const;
+
// content::WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) OVERRIDE;
- // Log metrics.
- void LogUMA() const;
+ // ExtensionRegistryObserver:
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
// Whether or not the ActiveScriptController is enabled (corresponding to the
// kActiveScriptEnforcement switch). If it is not, it acts as an empty shell,
@@ -142,6 +147,9 @@ class ActiveScriptController : public content::WebContentsObserver {
typedef std::map<std::string, linked_ptr<ExtensionAction> > ActiveScriptMap;
ActiveScriptMap active_script_actions_;
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
DISALLOW_COPY_AND_ASSIGN(ActiveScriptController);
};
« no previous file with comments | « no previous file | chrome/browser/extensions/active_script_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698