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 "base/observer_list.h" | 10 #include "chrome/browser/extensions/location_bar_controller_provider.h" |
11 #include "chrome/browser/extensions/location_bar_controller.h" | |
12 #include "content/public/browser/web_contents_observer.h" | |
13 | 11 |
14 class Profile; | 12 class Profile; |
15 | 13 |
16 namespace extensions { | 14 namespace extensions { |
17 class ExtensionRegistry; | 15 class ExtensionRegistry; |
18 | 16 |
19 // A LocationBarController which populates the location bar with icons based | 17 // A LocationBarController which populates the location bar with icons based |
20 // on the page_action extension API. | 18 // on the page_action extension API. |
21 class PageActionController : public LocationBarController, | 19 class PageActionController : public LocationBarControllerProvider { |
22 public content::WebContentsObserver { | |
23 public: | 20 public: |
24 explicit PageActionController(content::WebContents* web_contents); | 21 explicit PageActionController(content::WebContents* web_contents); |
25 virtual ~PageActionController(); | 22 virtual ~PageActionController(); |
26 | 23 |
27 // LocationBarController implementation. | 24 // LocationBarController::Provider implementation. |
28 virtual std::vector<ExtensionAction*> GetCurrentActions() const OVERRIDE; | 25 virtual std::vector<ExtensionAction*> GetCurrentActions() OVERRIDE; |
29 virtual Action OnClicked(const std::string& extension_id, | 26 virtual LocationBarController::Action OnClicked( |
30 int mouse_button) OVERRIDE; | 27 const Extension* extension, |
31 virtual void NotifyChange() OVERRIDE; | 28 LocationBarController::MouseButton button) OVERRIDE; |
32 | 29 virtual void NavigatedMainFrame( |
33 // content::WebContentsObserver implementation. | |
34 virtual void DidNavigateMainFrame( | |
35 const content::LoadCommittedDetails& details, | 30 const content::LoadCommittedDetails& details, |
36 const content::FrameNavigateParams& params) OVERRIDE; | 31 const content::FrameNavigateParams& params) OVERRIDE; |
37 | 32 |
38 private: | 33 private: |
39 // Gets the Profile for the web contents. | 34 Profile* GetProfile(); |
40 Profile* GetProfile() const; | |
41 | |
42 // Gets the ExtensionRegistry for the web contents. | |
43 ExtensionRegistry* GetExtensionRegistry() const; | |
44 | 35 |
45 DISALLOW_COPY_AND_ASSIGN(PageActionController); | 36 DISALLOW_COPY_AND_ASSIGN(PageActionController); |
46 }; | 37 }; |
47 | 38 |
48 } // namespace extensions | 39 } // namespace extensions |
49 | 40 |
50 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ | 41 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_ |
OLD | NEW |