| 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_LOCATION_BAR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 class Extension; | 24 class Extension; |
| 25 class ExtensionActionManager; | 25 class ExtensionActionManager; |
| 26 class ExtensionRegistry; | 26 class ExtensionRegistry; |
| 27 | 27 |
| 28 // Provides the UI with the current page actions for extensions. The execution | 28 // Provides the UI with the current page actions for extensions. The execution |
| 29 // of these actions is handled in the ExtensionActionAPI. | 29 // of these actions is handled in the ExtensionActionAPI. |
| 30 class LocationBarController : public ExtensionRegistryObserver { | 30 class LocationBarController : public ExtensionRegistryObserver { |
| 31 public: | 31 public: |
| 32 explicit LocationBarController(content::WebContents* web_contents); | 32 explicit LocationBarController(content::WebContents* web_contents); |
| 33 virtual ~LocationBarController(); | 33 ~LocationBarController() override; |
| 34 | 34 |
| 35 // Returns the actions which should be displayed in the location bar. | 35 // Returns the actions which should be displayed in the location bar. |
| 36 std::vector<ExtensionAction*> GetCurrentActions(); | 36 std::vector<ExtensionAction*> GetCurrentActions(); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // ExtensionRegistryObserver implementation. | 39 // ExtensionRegistryObserver implementation. |
| 40 virtual void OnExtensionLoaded( | 40 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 41 content::BrowserContext* browser_context, | 41 const Extension* extension) override; |
| 42 const Extension* extension) override; | 42 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 43 virtual void OnExtensionUnloaded( | 43 const Extension* extension, |
| 44 content::BrowserContext* browser_context, | 44 UnloadedExtensionInfo::Reason reason) override; |
| 45 const Extension* extension, | |
| 46 UnloadedExtensionInfo::Reason reason) override; | |
| 47 | 45 |
| 48 // The associated WebContents. | 46 // The associated WebContents. |
| 49 content::WebContents* web_contents_; | 47 content::WebContents* web_contents_; |
| 50 | 48 |
| 51 // The associated BrowserContext. | 49 // The associated BrowserContext. |
| 52 content::BrowserContext* browser_context_; | 50 content::BrowserContext* browser_context_; |
| 53 | 51 |
| 54 // The ExtensionActionManager to provide page actions. | 52 // The ExtensionActionManager to provide page actions. |
| 55 ExtensionActionManager* action_manager_; | 53 ExtensionActionManager* action_manager_; |
| 56 | 54 |
| 57 // Whether or not to show page actions in the location bar at all. (This is | 55 // Whether or not to show page actions in the location bar at all. (This is |
| 58 // false with the toolbar redesign enabled.) | 56 // false with the toolbar redesign enabled.) |
| 59 bool should_show_page_actions_; | 57 bool should_show_page_actions_; |
| 60 | 58 |
| 61 // Manufactured page actions that have been generated for extensions that want | 59 // Manufactured page actions that have been generated for extensions that want |
| 62 // to run a script, but were blocked. | 60 // to run a script, but were blocked. |
| 63 typedef std::map<std::string, linked_ptr<ExtensionAction> > | 61 typedef std::map<std::string, linked_ptr<ExtensionAction> > |
| 64 ExtensionActionMap; | 62 ExtensionActionMap; |
| 65 ExtensionActionMap active_script_actions_; | 63 ExtensionActionMap active_script_actions_; |
| 66 | 64 |
| 67 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 65 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 68 extension_registry_observer_; | 66 extension_registry_observer_; |
| 69 | 67 |
| 70 DISALLOW_COPY_AND_ASSIGN(LocationBarController); | 68 DISALLOW_COPY_AND_ASSIGN(LocationBarController); |
| 71 }; | 69 }; |
| 72 | 70 |
| 73 } // namespace extensions | 71 } // namespace extensions |
| 74 | 72 |
| 75 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| OLD | NEW |