| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // To be called after the extension service is ready; gets loaded extensions | 160 // To be called after the extension service is ready; gets loaded extensions |
| 161 // from the extension service and their saved order from the pref service | 161 // from the extension service and their saved order from the pref service |
| 162 // and constructs |toolbar_items_| from these data. | 162 // and constructs |toolbar_items_| from these data. |
| 163 void InitializeExtensionList(const ExtensionSet& extensions); | 163 void InitializeExtensionList(const ExtensionSet& extensions); |
| 164 void Populate(const ExtensionIdList& positions, | 164 void Populate(const ExtensionIdList& positions, |
| 165 const ExtensionSet& extensions); | 165 const ExtensionSet& extensions); |
| 166 | 166 |
| 167 // Save the model to prefs. | 167 // Save the model to prefs. |
| 168 void UpdatePrefs(); | 168 void UpdatePrefs(); |
| 169 | 169 |
| 170 // Updates |extension|'s browser action visibility pref if the browser action |
| 171 // is in the overflow menu and should be considered hidden. |
| 172 void MaybeUpdateVisibilityPref(const Extension* extension, int index); |
| 173 |
| 174 // Calls MaybeUpdateVisibilityPref() for each extension in |toolbar_items|. |
| 175 void MaybeUpdateVisibilityPrefs(); |
| 176 |
| 170 // Finds the last known visible position of the icon for an |extension|. The | 177 // Finds the last known visible position of the icon for an |extension|. The |
| 171 // value returned is a zero-based index into the vector of visible items. | 178 // value returned is a zero-based index into the vector of visible items. |
| 172 size_t FindNewPositionFromLastKnownGood(const Extension* extension); | 179 size_t FindNewPositionFromLastKnownGood(const Extension* extension); |
| 173 | 180 |
| 174 // Returns true if the given |extension| should be added to the toolbar. | 181 // Returns true if the given |extension| should be added to the toolbar. |
| 175 bool ShouldAddExtension(const Extension* extension); | 182 bool ShouldAddExtension(const Extension* extension); |
| 176 | 183 |
| 177 // Adds or removes the given |extension| from the toolbar model. | 184 // Adds or removes the given |extension| from the toolbar model. |
| 178 void AddExtension(const Extension* extension); | 185 void AddExtension(const Extension* extension); |
| 179 void RemoveExtension(const Extension* extension); | 186 void RemoveExtension(const Extension* extension); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 base::Closure pref_change_callback_; | 233 base::Closure pref_change_callback_; |
| 227 | 234 |
| 228 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; | 235 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; |
| 229 | 236 |
| 230 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); | 237 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); |
| 231 }; | 238 }; |
| 232 | 239 |
| 233 } // namespace extensions | 240 } // namespace extensions |
| 234 | 241 |
| 235 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 242 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
| OLD | NEW |