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 void OnNavigated() OVERRIDE; | 30 virtual void OnNavigated() OVERRIDE; |
31 | 31 |
32 private: | 32 private: |
33 // ExtensionActionAPI::Observer implementation. | |
34 virtual void OnExtensionActionUpdated( | |
35 ExtensionAction* extension_action, | |
36 content::WebContents* web_contents, | |
37 content::BrowserContext* browser_context) OVERRIDE; | |
38 | |
39 // Returns the associated Profile. | |
40 Profile* GetProfile(); | |
41 | |
42 // The associated WebContents. | 33 // The associated WebContents. |
43 content::WebContents* web_contents_; | 34 content::WebContents* web_contents_; |
44 | 35 |
45 ScopedObserver<ExtensionActionAPI, ExtensionActionAPI::Observer> | 36 // The associated browser context. |
46 extension_action_observer_; | 37 content::BrowserContext* browser_context_; |
47 | 38 |
48 DISALLOW_COPY_AND_ASSIGN(PageActionController); | 39 DISALLOW_COPY_AND_ASSIGN(PageActionController); |
49 }; | 40 }; |
50 | 41 |
51 } // namespace extensions | 42 } // namespace extensions |
52 | 43 |
53 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ | 44 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ |
OLD | NEW |