Index: chrome/browser/extensions/location_bar_controller.h |
diff --git a/chrome/browser/extensions/location_bar_controller.h b/chrome/browser/extensions/location_bar_controller.h |
index ee99c443c071fe93131465fa3dc01d3445b55ed6..f175850b493c6762d2a1ea8e4e69739340d832b1 100644 |
--- a/chrome/browser/extensions/location_bar_controller.h |
+++ b/chrome/browser/extensions/location_bar_controller.h |
@@ -5,40 +5,72 @@ |
#ifndef CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
#define CHROME_BROWSER_EXTENSIONS_LOCATION_BAR_CONTROLLER_H_ |
-#include <set> |
-#include <string> |
#include <vector> |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+ |
+namespace content { |
+class WebContents; |
+} |
+ |
class ExtensionAction; |
namespace extensions { |
+class ActiveScriptController; |
+class PageActionController; |
// Interface for a class that controls the the extension icons that show up in |
// the location bar. Depending on switches, these icons can have differing |
// behavior. |
class LocationBarController { |
public: |
- // The reaction that the UI should take after executing |OnClicked|. |
+ // The mouse button that was pressed. |
+ enum MouseButton { |
+ MOUSE_BUTTON_LEFT, |
+ MOUSE_BUTTON_MIDDLE, |
+ MOUSE_BUTTON_RIGHT, |
+ }; |
+ |
+ // The action that the UI should take after executing |OnClicked|. |
enum Action { |
ACTION_NONE, |
ACTION_SHOW_POPUP, |
ACTION_SHOW_CONTEXT_MENU, |
}; |
- virtual ~LocationBarController() {} |
+ explicit LocationBarController(content::WebContents* web_contents); |
+ virtual ~LocationBarController(); |
not at google - send to devlin
2014/05/07 23:30:38
no longer virtual
Devlin
2014/05/08 18:15:46
And... virtual again. :)
|
+ |
+ // Returns the actions which should be displayed in the location bar. |
+ std::vector<ExtensionAction*> GetCurrentActions(); |
+ |
+ // Notifies this that an ExtensionAction has been clicked, and returns the |
+ // action which should be taken in response (if any). |
+ Action OnClicked(const ExtensionAction* action, MouseButton button); |
+ |
+ // Notifies the window that the actions have changed. |
+ void NotifyChange(); |
+ |
+ ActiveScriptController* active_script_controller() { |
+ return active_script_controller_.get(); |
+ } |
+ |
+ PageActionController* page_action_controller() { |
+ return page_action_controller_.get(); |
+ } |
+ |
+ private: |
+ // The associated WebContents. |
+ content::WebContents* web_contents_; |
- // Gets the action data for all extensions. |
- virtual std::vector<ExtensionAction*> GetCurrentActions() const = 0; |
+ // The controller for extensions running scripts on a page. |
+ scoped_ptr<ActiveScriptController> active_script_controller_; |
- // Notifies this that the badge for an extension has been clicked with some |
- // mouse button (1 for left, 2 for middle, and 3 for right click), and |
- // returns the action that should be taken in response (if any). |
- // TODO(kalman): make mouse_button an enum. |
- virtual Action OnClicked(const std::string& extension_id, |
- int mouse_button) = 0; |
+ // The controller for extensions with page actions. |
+ scoped_ptr<PageActionController> page_action_controller_; |
- // Notifies clients that the icons have changed. |
- virtual void NotifyChange() = 0; |
+ DISALLOW_COPY_AND_ASSIGN(LocationBarController); |
}; |
} // namespace extensions |