Chromium Code Reviews| 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_EXTENSION_TOOLBAR_MODEL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 virtual void BrowserActionAdded(const extensions::Extension* extension, | 41 virtual void BrowserActionAdded(const extensions::Extension* extension, |
| 42 int index) {} | 42 int index) {} |
| 43 | 43 |
| 44 // The browser action button for |extension| should no longer show. | 44 // The browser action button for |extension| should no longer show. |
| 45 virtual void BrowserActionRemoved(const extensions::Extension* extension) {} | 45 virtual void BrowserActionRemoved(const extensions::Extension* extension) {} |
| 46 | 46 |
| 47 // The browser action button for |extension| has been moved to |index|. | 47 // The browser action button for |extension| has been moved to |index|. |
| 48 virtual void BrowserActionMoved(const extensions::Extension* extension, | 48 virtual void BrowserActionMoved(const extensions::Extension* extension, |
| 49 int index) {} | 49 int index) {} |
| 50 | 50 |
| 51 // The browser action should show the popup now. | |
|
Finnur
2013/10/15 10:44:21
nit: The browser action for |extension| should...
justinlin
2013/10/16 07:06:48
Done.
| |
| 52 virtual void BrowserActionShowPopup( | |
| 53 const extensions::Extension* extension) {} | |
| 54 | |
| 51 // Called when the model has finished loading. | 55 // Called when the model has finished loading. |
| 52 virtual void ModelLoaded() {} | 56 virtual void ModelLoaded() {} |
| 53 | 57 |
| 54 protected: | 58 protected: |
| 55 virtual ~Observer() {} | 59 virtual ~Observer() {} |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 // Functions called by the view. | 62 // Functions called by the view. |
| 59 void AddObserver(Observer* observer); | 63 void AddObserver(Observer* observer); |
| 60 void RemoveObserver(Observer* observer); | 64 void RemoveObserver(Observer* observer); |
| 61 void MoveBrowserAction(const extensions::Extension* extension, int index); | 65 void MoveBrowserAction(const extensions::Extension* extension, int index); |
| 66 void ShowBrowserActionPopup(const extensions::Extension* extension); | |
| 62 // Executes the browser action for an extension and returns the action that | 67 // Executes the browser action for an extension and returns the action that |
| 63 // the UI should perform in response. | 68 // the UI should perform in response. |
| 64 // |popup_url_out| will be set if the extension should show a popup, with | 69 // |popup_url_out| will be set if the extension should show a popup, with |
| 65 // the URL that should be shown, if non-NULL. | 70 // the URL that should be shown, if non-NULL. |
| 66 Action ExecuteBrowserAction(const extensions::Extension* extension, | 71 Action ExecuteBrowserAction(const extensions::Extension* extension, |
| 67 Browser* browser, | 72 Browser* browser, |
| 68 GURL* popup_url_out); | 73 GURL* popup_url_out); |
| 74 // Retrieves the URL that should be loaded in the popup for an extension | |
| 75 // without granting host permissions for the tab. Used for the showPopup API. | |
| 76 GURL GetPopupUrl(const extensions::Extension* extension, Browser* browser); | |
| 69 // If count == size(), this will set the visible icon count to -1, meaning | 77 // If count == size(), this will set the visible icon count to -1, meaning |
| 70 // "show all actions". | 78 // "show all actions". |
| 71 void SetVisibleIconCount(int count); | 79 void SetVisibleIconCount(int count); |
| 72 // As above, a return value of -1 represents "show all actions". | 80 // As above, a return value of -1 represents "show all actions". |
| 73 int GetVisibleIconCount() const { return visible_icon_count_; } | 81 int GetVisibleIconCount() const { return visible_icon_count_; } |
| 74 | 82 |
| 75 bool extensions_initialized() const { return extensions_initialized_; } | 83 bool extensions_initialized() const { return extensions_initialized_; } |
| 76 | 84 |
| 77 const extensions::ExtensionList& toolbar_items() const { | 85 const extensions::ExtensionList& toolbar_items() const { |
| 78 return toolbar_items_; | 86 return toolbar_items_; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // For observing change of toolbar order preference by external entity (sync). | 145 // For observing change of toolbar order preference by external entity (sync). |
| 138 PrefChangeRegistrar pref_change_registrar_; | 146 PrefChangeRegistrar pref_change_registrar_; |
| 139 base::Closure pref_change_callback_; | 147 base::Closure pref_change_callback_; |
| 140 | 148 |
| 141 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; | 149 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; |
| 142 | 150 |
| 143 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); | 151 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); |
| 144 }; | 152 }; |
| 145 | 153 |
| 146 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 154 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
| OLD | NEW |