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