diff options
author | jyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-14 22:06:50 +0000 |
---|---|---|
committer | jyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-14 22:06:50 +0000 |
commit | 61e3cbe073def942a17469d2547f7b75767f2ed8 (patch) | |
tree | f6c8b9adc211d93356e93e6eea0cddb4291f7a68 /chrome/browser/extensions/extension_action_manager.h | |
parent | 0d47aab0125cf1e30d60eb0def9cffaf7af3428c (diff) | |
download | chromium_src-61e3cbe073def942a17469d2547f7b75767f2ed8.zip chromium_src-61e3cbe073def942a17469d2547f7b75767f2ed8.tar.gz chromium_src-61e3cbe073def942a17469d2547f7b75767f2ed8.tar.bz2 |
Make ExtensionActionManager an independent ProfileKeyedService
instead of hanging it off of ExtensionSystem::Shared.
Also create ExtensionActions lazily to avoid ordering issues in the EXTENSION_LOADED notification.
BUG=153463
Review URL: https://chromiumcodereview.appspot.com/11099023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161815 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_action_manager.h')
-rw-r--r-- | chrome/browser/extensions/extension_action_manager.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/extensions/extension_action_manager.h b/chrome/browser/extensions/extension_action_manager.h index e2ff5dd..adae7fc 100644 --- a/chrome/browser/extensions/extension_action_manager.h +++ b/chrome/browser/extensions/extension_action_manager.h @@ -9,6 +9,7 @@ #include <string> #include "base/memory/linked_ptr.h" +#include "chrome/browser/profiles/profile_keyed_service.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -21,7 +22,8 @@ class Extension; // Owns the ExtensionActions associated with each extension. These actions live // while an extension is loaded and are destroyed on unload. -class ExtensionActionManager : public content::NotificationObserver { +class ExtensionActionManager : public ProfileKeyedService, + public content::NotificationObserver { public: explicit ExtensionActionManager(Profile* profile); virtual ~ExtensionActionManager(); @@ -46,14 +48,14 @@ class ExtensionActionManager : public content::NotificationObserver { content::NotificationRegistrar registrar_; - // Keyed by Extension ID. These maps are populated when the extension is - // loaded, and the entries are removed when the extension is unloaded. Not - // every extension has a page action or browser action, but all have a script - // badge. + // Keyed by Extension ID. These maps are populated lazily when their + // ExtensionAction is first requested, and the entries are removed when the + // extension is unloaded. Not every extension has a page action or browser + // action, but all have a script badge. typedef std::map<std::string, linked_ptr<ExtensionAction> > ExtIdToActionMap; - ExtIdToActionMap page_actions_; - ExtIdToActionMap browser_actions_; - ExtIdToActionMap script_badges_; + mutable ExtIdToActionMap page_actions_; + mutable ExtIdToActionMap browser_actions_; + mutable ExtIdToActionMap script_badges_; }; } |