| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "extensions/browser/extension_registry_observer.h" | 13 #include "extensions/browser/extension_registry_observer.h" |
| 14 | 14 |
| 15 class ExtensionAction; | 15 class ExtensionAction; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class WebContents; | 18 class WebContents; |
| 19 class BrowserContext; | 19 class BrowserContext; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 class ActiveScriptController; | 24 class ActiveScriptController; |
| 25 class Extension; | 25 class Extension; |
| 26 class ExtensionActionManager; |
| 26 class ExtensionRegistry; | 27 class ExtensionRegistry; |
| 27 | 28 |
| 28 // Provides the UI with the current page actions for extensions. The execution | 29 // Provides the UI with the current page actions for extensions. The execution |
| 29 // of these actions is handled in the ExtensionActionAPI. | 30 // of these actions is handled in the ExtensionActionAPI. |
| 30 class LocationBarController : public ExtensionRegistryObserver { | 31 class LocationBarController : public ExtensionRegistryObserver { |
| 31 public: | 32 public: |
| 32 explicit LocationBarController(content::WebContents* web_contents); | 33 explicit LocationBarController(content::WebContents* web_contents); |
| 33 virtual ~LocationBarController(); | 34 virtual ~LocationBarController(); |
| 34 | 35 |
| 35 // Returns the actions which should be displayed in the location bar. | 36 // Returns the actions which should be displayed in the location bar. |
| 36 std::vector<ExtensionAction*> GetCurrentActions(); | 37 std::vector<ExtensionAction*> GetCurrentActions(); |
| 37 | 38 |
| 38 ActiveScriptController* active_script_controller() { | 39 ActiveScriptController* active_script_controller() { |
| 39 return active_script_controller_.get(); | 40 return active_script_controller_.get(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 // ExtensionRegistryObserver implementation. | 44 // ExtensionRegistryObserver implementation. |
| 45 virtual void OnExtensionLoaded( |
| 46 content::BrowserContext* browser_context, |
| 47 const Extension* extnesion) OVERRIDE; |
| 44 virtual void OnExtensionUnloaded( | 48 virtual void OnExtensionUnloaded( |
| 45 content::BrowserContext* browser_context, | 49 content::BrowserContext* browser_context, |
| 46 const Extension* extension, | 50 const Extension* extension, |
| 47 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 51 UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 48 | 52 |
| 49 // The associated WebContents. | 53 // The associated WebContents. |
| 50 content::WebContents* web_contents_; | 54 content::WebContents* web_contents_; |
| 51 | 55 |
| 52 // The associated BrowserContext. | 56 // The associated BrowserContext. |
| 53 content::BrowserContext* browser_context_; | 57 content::BrowserContext* browser_context_; |
| 54 | 58 |
| 59 // The ExtensionActionManager to provide page actions. |
| 60 ExtensionActionManager* action_manager_; |
| 61 |
| 55 // The ActiveScriptController, which could also add actions for extensions if | 62 // The ActiveScriptController, which could also add actions for extensions if |
| 56 // they have a pending script. | 63 // they have a pending script. |
| 57 scoped_ptr<ActiveScriptController> active_script_controller_; | 64 scoped_ptr<ActiveScriptController> active_script_controller_; |
| 58 | 65 |
| 59 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 66 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 60 extension_registry_observer_; | 67 extension_registry_observer_; |
| 61 | 68 |
| 62 DISALLOW_COPY_AND_ASSIGN(LocationBarController); | 69 DISALLOW_COPY_AND_ASSIGN(LocationBarController); |
| 63 }; | 70 }; |
| 64 | 71 |
| 65 } // namespace extensions | 72 } // namespace extensions |
| 66 | 73 |
| 67 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ | 74 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| OLD | NEW |