| 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_PAGE_ACTION_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include "base/macros.h" |
| 9 | |
| 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | |
| 11 #include "chrome/browser/extensions/location_bar_controller.h" | 9 #include "chrome/browser/extensions/location_bar_controller.h" |
| 12 | 10 |
| 13 class Profile; | 11 namespace content { |
| 12 class BrowserContext; |
| 13 class WebContents; |
| 14 } |
| 14 | 15 |
| 15 namespace extensions { | 16 namespace extensions { |
| 16 class ExtensionRegistry; | 17 class Extension; |
| 17 | 18 |
| 18 // A LocationBarControllerProvider which populates the location bar with icons | 19 // A LocationBarControllerProvider which populates the location bar with icons |
| 19 // based on the page_action extension API. | 20 // based on the page_action extension API. |
| 20 // TODO(rdevlin.cronin): This isn't really a controller. | 21 // TODO(rdevlin.cronin): This isn't really a controller. |
| 21 class PageActionController : public LocationBarController::ActionProvider, | 22 class PageActionController : public LocationBarController::ActionProvider { |
| 22 public ExtensionActionAPI::Observer { | |
| 23 public: | 23 public: |
| 24 explicit PageActionController(content::WebContents* web_contents); | 24 explicit PageActionController(content::WebContents* web_contents); |
| 25 virtual ~PageActionController(); | 25 virtual ~PageActionController(); |
| 26 | 26 |
| 27 // LocationBarController::Provider implementation. | 27 // LocationBarController::Provider implementation. |
| 28 virtual ExtensionAction* GetActionForExtension(const Extension* extension) | 28 virtual ExtensionAction* GetActionForExtension(const Extension* extension) |
| 29 OVERRIDE; | 29 OVERRIDE; |
| 30 virtual ExtensionAction::ShowAction OnClicked( | 30 virtual ExtensionAction::ShowAction OnClicked( |
| 31 const Extension* extension) OVERRIDE; | 31 const Extension* extension) OVERRIDE; |
| 32 virtual void OnNavigated() OVERRIDE; | 32 virtual void OnNavigated() OVERRIDE; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 // ExtensionActionAPI::Observer implementation. | |
| 36 virtual void OnExtensionActionUpdated( | |
| 37 ExtensionAction* extension_action, | |
| 38 content::WebContents* web_contents, | |
| 39 content::BrowserContext* browser_context) OVERRIDE; | |
| 40 | |
| 41 // Returns the associated Profile. | |
| 42 Profile* GetProfile(); | |
| 43 | |
| 44 // The associated WebContents. | 35 // The associated WebContents. |
| 45 content::WebContents* web_contents_; | 36 content::WebContents* web_contents_; |
| 46 | 37 |
| 47 ScopedObserver<ExtensionActionAPI, ExtensionActionAPI::Observer> | 38 // The associated browser context. |
| 48 extension_action_observer_; | 39 content::BrowserContext* browser_context_; |
| 49 | 40 |
| 50 DISALLOW_COPY_AND_ASSIGN(PageActionController); | 41 DISALLOW_COPY_AND_ASSIGN(PageActionController); |
| 51 }; | 42 }; |
| 52 | 43 |
| 53 } // namespace extensions | 44 } // namespace extensions |
| 54 | 45 |
| 55 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ | 46 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ |
| OLD | NEW |