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