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