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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Convenience function to get the ExtensionToolbarModel for a Profile. | 82 // Convenience function to get the ExtensionToolbarModel for a Profile. |
83 static ExtensionToolbarModel* Get(Profile* profile); | 83 static ExtensionToolbarModel* Get(Profile* profile); |
84 | 84 |
85 // Add or remove an observer. | 85 // Add or remove an observer. |
86 void AddObserver(Observer* observer); | 86 void AddObserver(Observer* observer); |
87 void RemoveObserver(Observer* observer); | 87 void RemoveObserver(Observer* observer); |
88 | 88 |
89 // Moves the given |extension|'s icon to the given |index|. | 89 // Moves the given |extension|'s icon to the given |index|. |
90 void MoveExtensionIcon(const Extension* extension, int index); | 90 void MoveExtensionIcon(const Extension* extension, int index); |
91 | 91 |
92 // Executes the browser action for an extension and returns the action that | |
93 // the UI should perform in response. | |
94 // |popup_url_out| will be set if the extension should show a popup, with | |
95 // the URL that should be shown, if non-NULL. |should_grant| controls whether | |
96 // the extension should be granted page tab permissions, which is what happens | |
97 // when the user clicks the browser action, but not, for example, when the | |
98 // showPopup API is called. | |
99 ExtensionAction::ShowAction ExecuteBrowserAction(const Extension* extension, | |
100 Browser* browser, | |
101 GURL* popup_url_out, | |
102 bool should_grant); | |
103 | |
104 // Sets the number of extension icons that should be visible. | 92 // Sets the number of extension icons that should be visible. |
105 // If count == size(), this will set the visible icon count to -1, meaning | 93 // If count == size(), this will set the visible icon count to -1, meaning |
106 // "show all actions". | 94 // "show all actions". |
107 void SetVisibleIconCount(int count); | 95 void SetVisibleIconCount(int count); |
108 | 96 |
109 // As above, a return value of -1 represents "show all actions". | 97 // As above, a return value of -1 represents "show all actions". |
110 int GetVisibleIconCount() const { return visible_icon_count_; } | 98 int GetVisibleIconCount() const { return visible_icon_count_; } |
111 | 99 |
112 bool extensions_initialized() const { return extensions_initialized_; } | 100 bool extensions_initialized() const { return extensions_initialized_; } |
113 | 101 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 base::Closure pref_change_callback_; | 241 base::Closure pref_change_callback_; |
254 | 242 |
255 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; | 243 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; |
256 | 244 |
257 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); | 245 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); |
258 }; | 246 }; |
259 | 247 |
260 } // namespace extensions | 248 } // namespace extensions |
261 | 249 |
262 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 250 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
OLD | NEW |