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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_
10 #include "base/observer_list.h"
11 #include "chrome/browser/extensions/location_bar_controller.h"
12 #include "content/public/browser/web_contents_observer.h"
16 namespace extensions
{
17 class ExtensionRegistry
;
19 // A LocationBarController which populates the location bar with icons based
20 // on the page_action extension API.
21 class PageActionController
: public LocationBarController
,
22 public content::WebContentsObserver
{
24 explicit PageActionController(content::WebContents
* web_contents
);
25 virtual ~PageActionController();
27 // LocationBarController implementation.
28 virtual std::vector
<ExtensionAction
*> GetCurrentActions() const OVERRIDE
;
29 virtual Action
OnClicked(const std::string
& extension_id
,
30 int mouse_button
) OVERRIDE
;
31 virtual void NotifyChange() OVERRIDE
;
33 // content::WebContentsObserver implementation.
34 virtual void DidNavigateMainFrame(
35 const content::LoadCommittedDetails
& details
,
36 const content::FrameNavigateParams
& params
) OVERRIDE
;
39 // Gets the Profile for the web contents.
40 Profile
* GetProfile() const;
42 // Gets the ExtensionRegistry for the web contents.
43 ExtensionRegistry
* GetExtensionRegistry() const;
45 DISALLOW_COPY_AND_ASSIGN(PageActionController
);
48 } // namespace extensions
50 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_