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 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
| 12 #include "base/observer_list.h" |
9 #include "chrome/browser/extensions/action_box_controller.h" | 13 #include "chrome/browser/extensions/action_box_controller.h" |
| 14 #include "chrome/browser/extensions/extension_tab_helper.h" |
10 | 15 |
11 class ExtensionService; | 16 class ExtensionService; |
12 class TabContentsWrapper; | 17 class TabContentsWrapper; |
13 | 18 |
14 namespace extensions { | 19 namespace extensions { |
15 | 20 |
16 // An ActionBoxController which corresponds to the page actions of an extension. | 21 // An ActionBoxController which corresponds to the page actions of an extension. |
17 class PageActionController : public ActionBoxController { | 22 class PageActionController : public ActionBoxController, |
| 23 public ExtensionTabHelper::Observer { |
18 public: | 24 public: |
19 explicit PageActionController(TabContentsWrapper* tab_contents); | 25 PageActionController(TabContentsWrapper* tab_contents, |
| 26 ExtensionTabHelper* tab_helper); |
20 virtual ~PageActionController(); | 27 virtual ~PageActionController(); |
21 | 28 |
22 virtual scoped_ptr<DataList> GetAllBadgeData() OVERRIDE; | 29 // ActionBoxController implementation. |
23 | 30 virtual scoped_ptr<std::vector<ExtensionAction*> > GetCurrentActions() |
| 31 OVERRIDE; |
24 virtual Action OnClicked(const std::string& extension_id, | 32 virtual Action OnClicked(const std::string& extension_id, |
25 int mouse_button) OVERRIDE; | 33 int mouse_button) OVERRIDE; |
26 | 34 |
| 35 // ExtensionTabHelper::Observer implementation. |
| 36 virtual void OnPageActionStateChanged() OVERRIDE; |
| 37 |
27 private: | 38 private: |
28 // Gets the ExtensionService for |tab_contents_|. | 39 // Gets the ExtensionService for |tab_contents_|. |
29 ExtensionService* GetExtensionService(); | 40 ExtensionService* GetExtensionService(); |
30 | 41 |
31 TabContentsWrapper* tab_contents_; | 42 TabContentsWrapper* tab_contents_; |
32 | 43 |
| 44 ExtensionTabHelper* tab_helper_; |
| 45 |
33 DISALLOW_COPY_AND_ASSIGN(PageActionController); | 46 DISALLOW_COPY_AND_ASSIGN(PageActionController); |
34 }; | 47 }; |
35 | 48 |
36 } // namespace extensions | 49 } // namespace extensions |
37 | 50 |
38 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ | 51 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ |
OLD | NEW |