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_
11 #include "base/observer_list.h"
12 #include "chrome/browser/extensions/location_bar_controller.h"
13 #include "content/public/browser/web_contents_observer.h"
15 class ExtensionService
;
18 namespace extensions
{
20 // A LocationBarController which populates the location bar with icons based
21 // on the page_action extension API.
22 class PageActionController
: public LocationBarController
,
23 public content::WebContentsObserver
{
25 explicit PageActionController(content::WebContents
* web_contents
);
26 virtual ~PageActionController();
28 // LocationBarController implementation.
29 virtual std::vector
<ExtensionAction
*> GetCurrentActions() const OVERRIDE
;
30 // Page actions can't try to get attention.
31 virtual void GetAttentionFor(const std::string
& extension_id
) OVERRIDE
{}
32 virtual Action
OnClicked(const std::string
& extension_id
,
33 int mouse_button
) OVERRIDE
;
34 virtual void NotifyChange() OVERRIDE
;
36 // content::WebContentsObserver implementation.
37 virtual void DidNavigateMainFrame(
38 const content::LoadCommittedDetails
& details
,
39 const content::FrameNavigateParams
& params
) OVERRIDE
;
42 // Gets the Profile for the web contents.
43 Profile
* profile() const;
45 // Gets the ExtensionService for the web contents.
46 ExtensionService
* GetExtensionService() const;
48 DISALLOW_COPY_AND_ASSIGN(PageActionController
);
51 } // namespace extensions
53 #endif // CHROME_BROWSER_EXTENSIONS_PAGE_ACTION_CONTROLLER_H_