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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // To be called after the extension service is ready; gets loaded extensions | 174 // To be called after the extension service is ready; gets loaded extensions |
175 // from the extension service and their saved order from the pref service | 175 // from the extension service and their saved order from the pref service |
176 // and constructs |toolbar_items_| from these data. | 176 // and constructs |toolbar_items_| from these data. |
177 void InitializeExtensionList(const ExtensionSet& extensions); | 177 void InitializeExtensionList(const ExtensionSet& extensions); |
178 void Populate(const ExtensionIdList& positions, | 178 void Populate(const ExtensionIdList& positions, |
179 const ExtensionSet& extensions); | 179 const ExtensionSet& extensions); |
180 | 180 |
181 // Save the model to prefs. | 181 // Save the model to prefs. |
182 void UpdatePrefs(); | 182 void UpdatePrefs(); |
183 | 183 |
| 184 // Updates |extension|'s browser action visibility pref if the browser action |
| 185 // is in the overflow menu and should be considered hidden. |
| 186 void MaybeUpdateVisibilityPref(const Extension* extension, int index); |
| 187 |
| 188 // Calls MaybeUpdateVisibilityPref() for each extension in |toolbar_items|. |
| 189 void MaybeUpdateVisibilityPrefs(); |
| 190 |
184 // Finds the last known visible position of the icon for an |extension|. The | 191 // Finds the last known visible position of the icon for an |extension|. The |
185 // value returned is a zero-based index into the vector of visible items. | 192 // value returned is a zero-based index into the vector of visible items. |
186 size_t FindNewPositionFromLastKnownGood(const Extension* extension); | 193 size_t FindNewPositionFromLastKnownGood(const Extension* extension); |
187 | 194 |
188 // Returns true if the given |extension| should be added to the toolbar. | 195 // Returns true if the given |extension| should be added to the toolbar. |
189 bool ShouldAddExtension(const Extension* extension); | 196 bool ShouldAddExtension(const Extension* extension); |
190 | 197 |
191 // Adds or removes the given |extension| from the toolbar model. | 198 // Adds or removes the given |extension| from the toolbar model. |
192 void AddExtension(const Extension* extension); | 199 void AddExtension(const Extension* extension); |
193 void RemoveExtension(const Extension* extension); | 200 void RemoveExtension(const Extension* extension); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 base::Closure pref_change_callback_; | 250 base::Closure pref_change_callback_; |
244 | 251 |
245 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; | 252 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; |
246 | 253 |
247 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); | 254 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); |
248 }; | 255 }; |
249 | 256 |
250 } // namespace extensions | 257 } // namespace extensions |
251 | 258 |
252 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 259 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
OLD | NEW |