| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // shared between a profile and its incognito version. | 32 // shared between a profile and its incognito version. |
| 33 static ExtensionActionManager* Get(Profile* profile); | 33 static ExtensionActionManager* Get(Profile* profile); |
| 34 | 34 |
| 35 // Retrieves the page action, browser action, or script badge for |extension|. | 35 // Retrieves the page action, browser action, or script badge for |extension|. |
| 36 // If the result is not NULL, it remains valid until the extension is | 36 // If the result is not NULL, it remains valid until the extension is |
| 37 // unloaded. | 37 // unloaded. |
| 38 ExtensionAction* GetPageAction(const extensions::Extension& extension) const; | 38 ExtensionAction* GetPageAction(const extensions::Extension& extension) const; |
| 39 ExtensionAction* GetBrowserAction( | 39 ExtensionAction* GetBrowserAction( |
| 40 const extensions::Extension& extension) const; | 40 const extensions::Extension& extension) const; |
| 41 ExtensionAction* GetScriptBadge(const extensions::Extension& extension) const; | 41 ExtensionAction* GetScriptBadge(const extensions::Extension& extension) const; |
| 42 ExtensionAction* GetSystemIndicator( |
| 43 const extensions::Extension& extension) const; |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 // Implement content::NotificationObserver. | 46 // Implement content::NotificationObserver. |
| 45 virtual void Observe(int type, | 47 virtual void Observe(int type, |
| 46 const content::NotificationSource& source, | 48 const content::NotificationSource& source, |
| 47 const content::NotificationDetails& details) OVERRIDE; | 49 const content::NotificationDetails& details) OVERRIDE; |
| 48 | 50 |
| 49 content::NotificationRegistrar registrar_; | 51 content::NotificationRegistrar registrar_; |
| 50 | 52 |
| 51 // Keyed by Extension ID. These maps are populated lazily when their | 53 // Keyed by Extension ID. These maps are populated lazily when their |
| 52 // ExtensionAction is first requested, and the entries are removed when the | 54 // ExtensionAction is first requested, and the entries are removed when the |
| 53 // extension is unloaded. Not every extension has a page action or browser | 55 // extension is unloaded. Not every extension has a page action or browser |
| 54 // action, but all have a script badge. | 56 // action, but all have a script badge. |
| 55 typedef std::map<std::string, linked_ptr<ExtensionAction> > ExtIdToActionMap; | 57 typedef std::map<std::string, linked_ptr<ExtensionAction> > ExtIdToActionMap; |
| 56 mutable ExtIdToActionMap page_actions_; | 58 mutable ExtIdToActionMap page_actions_; |
| 57 mutable ExtIdToActionMap browser_actions_; | 59 mutable ExtIdToActionMap browser_actions_; |
| 58 mutable ExtIdToActionMap script_badges_; | 60 mutable ExtIdToActionMap script_badges_; |
| 61 mutable ExtIdToActionMap system_indicators_; |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 } | 64 } // namespace extensions |
| 62 | 65 |
| 63 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ | 66 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_MANAGER_H_ |
| OLD | NEW |