| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 virtual ExtensionAction* GetActionForExtension( | 37 virtual ExtensionAction* GetActionForExtension( |
| 38 const Extension* extension) = 0; | 38 const Extension* extension) = 0; |
| 39 | 39 |
| 40 // A notification that the WebContents has navigated in the main frame (and | 40 // A notification that the WebContents has navigated in the main frame (and |
| 41 // not in page), so any state relating to the current page should likely be | 41 // not in page), so any state relating to the current page should likely be |
| 42 // reset. | 42 // reset. |
| 43 virtual void OnNavigated() = 0; | 43 virtual void OnNavigated() = 0; |
| 44 | 44 |
| 45 // A notification that the given |extension| has been unloaded, and any | 45 // A notification that the given |extension| has been unloaded, and any |
| 46 // actions associated with it should be removed. | 46 // actions associated with it should be removed. |
| 47 // The location bar controller will update itself after this if needed, so | 47 // The LocationBarController will handle notifying of page action changes, |
| 48 // Providers should not call NotifyChange(). | 48 // if any. |
| 49 virtual void OnExtensionUnloaded(const Extension* extension) {} | 49 virtual void OnExtensionUnloaded(const Extension* extension) {} |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 explicit LocationBarController(content::WebContents* web_contents); | 52 explicit LocationBarController(content::WebContents* web_contents); |
| 53 virtual ~LocationBarController(); | 53 virtual ~LocationBarController(); |
| 54 | 54 |
| 55 // Returns the actions which should be displayed in the location bar. | 55 // Returns the actions which should be displayed in the location bar. |
| 56 std::vector<ExtensionAction*> GetCurrentActions(); | 56 std::vector<ExtensionAction*> GetCurrentActions(); |
| 57 | 57 |
| 58 // Notifies the window that the actions have changed. | |
| 59 static void NotifyChange(content::WebContents* web_contents); | |
| 60 | |
| 61 ActiveScriptController* active_script_controller() { | 58 ActiveScriptController* active_script_controller() { |
| 62 return active_script_controller_.get(); | 59 return active_script_controller_.get(); |
| 63 } | 60 } |
| 64 | 61 |
| 65 private: | 62 private: |
| 66 // content::WebContentsObserver implementation. | 63 // content::WebContentsObserver implementation. |
| 67 virtual void DidNavigateMainFrame( | 64 virtual void DidNavigateMainFrame( |
| 68 const content::LoadCommittedDetails& details, | 65 const content::LoadCommittedDetails& details, |
| 69 const content::FrameNavigateParams& params) OVERRIDE; | 66 const content::FrameNavigateParams& params) OVERRIDE; |
| 70 | 67 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 87 | 84 |
| 88 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 85 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 89 extension_registry_observer_; | 86 extension_registry_observer_; |
| 90 | 87 |
| 91 DISALLOW_COPY_AND_ASSIGN(LocationBarController); | 88 DISALLOW_COPY_AND_ASSIGN(LocationBarController); |
| 92 }; | 89 }; |
| 93 | 90 |
| 94 } // namespace extensions | 91 } // namespace extensions |
| 95 | 92 |
| 96 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ | 93 #endif // CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
| OLD | NEW |