Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5091)

Unified Diff: chrome/browser/extensions/extension_toolbar_model.h

Issue 10412052: Pull browser action click logic into ToolbarModelController, so that when I (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_toolbar_model.h
diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h
index 530340a560f8ecb16b3f888091e857261f23e2b9..9bf6f157b07fab2a1831adca30547dff78a42a88 100644
--- a/chrome/browser/extensions/extension_toolbar_model.h
+++ b/chrome/browser/extensions/extension_toolbar_model.h
@@ -22,6 +22,14 @@ class ExtensionToolbarModel : public content::NotificationObserver {
explicit ExtensionToolbarModel(ExtensionService* service);
virtual ~ExtensionToolbarModel();
+ // The action that should be taken as a result of clicking a browser action.
+ enum Action {
+ ACTION_NONE,
+ ACTION_SHOW_POPUP,
+ // Unlike ActionBoxController there is no ACTION_SHOW_CONTEXT_MENU, because
+ // UI implementations tend to handle this themselves at a higher level.
+ };
+
// A class which is informed of changes to the model; represents the view of
// MVC.
class Observer {
@@ -38,11 +46,6 @@ class ExtensionToolbarModel : public content::NotificationObserver {
virtual void BrowserActionMoved(const extensions::Extension* extension,
int index) {}
- // The browser action button for |extension_id| (which was not a popup) was
- // clicked, executing it.
- virtual void BrowserActionExecuted(const std::string& extension_id,
- Browser* browser) {}
-
// Called when the model has finished loading.
virtual void ModelLoaded() {}
@@ -54,12 +57,18 @@ class ExtensionToolbarModel : public content::NotificationObserver {
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
void MoveBrowserAction(const extensions::Extension* extension, int index);
- void ExecuteBrowserAction(const std::string& extension_id, Browser* browser);
+ // Executes the browser action for an extension and returns the action that
+ // the UI should perform in response.
+ // |popup_url_out| will be set if the extension should show a popup, with
+ // the URL that should be shown, if non-NULL.
+ Action ExecuteBrowserAction(const extensions::Extension* extension,
+ Browser* browser,
+ GURL* popup_url_out);
// If count == size(), this will set the visible icon count to -1, meaning
// "show all actions".
void SetVisibleIconCount(int count);
// As above, a return value of -1 represents "show all actions".
- int GetVisibleIconCount() { return visible_icon_count_; }
+ int GetVisibleIconCount() const { return visible_icon_count_; }
bool extensions_initialized() const { return extensions_initialized_; }
@@ -124,6 +133,8 @@ class ExtensionToolbarModel : public content::NotificationObserver {
int visible_icon_count_;
content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel);
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698