| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Callback when extensions are ready. | 144 // Callback when extensions are ready. |
| 145 void OnReady(); | 145 void OnReady(); |
| 146 | 146 |
| 147 // ExtensionRegistryObserver implementation. | 147 // ExtensionRegistryObserver implementation. |
| 148 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 148 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 149 const Extension* extension) OVERRIDE; | 149 const Extension* extension) OVERRIDE; |
| 150 virtual void OnExtensionUnloaded( | 150 virtual void OnExtensionUnloaded( |
| 151 content::BrowserContext* browser_context, | 151 content::BrowserContext* browser_context, |
| 152 const Extension* extension, | 152 const Extension* extension, |
| 153 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 153 UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 154 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context, |
| 155 const Extension* extension) OVERRIDE; |
| 154 | 156 |
| 155 // To be called after the extension service is ready; gets loaded extensions | 157 // To be called after the extension service is ready; gets loaded extensions |
| 156 // from the extension service and their saved order from the pref service | 158 // from the extension service and their saved order from the pref service |
| 157 // and constructs |toolbar_items_| from these data. | 159 // and constructs |toolbar_items_| from these data. |
| 158 void InitializeExtensionList(const ExtensionSet& extensions); | 160 void InitializeExtensionList(const ExtensionSet& extensions); |
| 159 void Populate(const ExtensionIdList& positions, | 161 void Populate(const ExtensionIdList& positions, |
| 160 const ExtensionSet& extensions); | 162 const ExtensionSet& extensions); |
| 161 | 163 |
| 162 // Save the model to prefs. | 164 // Save the model to prefs. |
| 163 void UpdatePrefs(); | 165 void UpdatePrefs(); |
| 164 | 166 |
| 165 // Finds the last known visible position of the icon for an |extension|. The | 167 // Finds the last known visible position of the icon for an |extension|. The |
| 166 // value returned is a zero-based index into the vector of visible items. | 168 // value returned is a zero-based index into the vector of visible items. |
| 167 size_t FindNewPositionFromLastKnownGood(const Extension* extension); | 169 size_t FindNewPositionFromLastKnownGood(const Extension* extension); |
| 168 | 170 |
| 169 // Our observers. | 171 // Our observers. |
| 170 ObserverList<Observer> observers_; | 172 ObserverList<Observer> observers_; |
| 171 | 173 |
| 172 void AddExtension(const Extension* extension); | 174 void AddExtension(const Extension* extension); |
| 173 void RemoveExtension(const Extension* extension); | 175 void RemoveExtension(const Extension* extension); |
| 174 void UninstalledExtension(const Extension* extension); | |
| 175 | 176 |
| 176 // The Profile this toolbar model is for. | 177 // The Profile this toolbar model is for. |
| 177 Profile* profile_; | 178 Profile* profile_; |
| 178 | 179 |
| 179 ExtensionPrefs* extension_prefs_; | 180 ExtensionPrefs* extension_prefs_; |
| 180 PrefService* prefs_; | 181 PrefService* prefs_; |
| 181 | 182 |
| 182 // True if we've handled the initial EXTENSIONS_READY notification. | 183 // True if we've handled the initial EXTENSIONS_READY notification. |
| 183 bool extensions_initialized_; | 184 bool extensions_initialized_; |
| 184 | 185 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 214 base::Closure pref_change_callback_; | 215 base::Closure pref_change_callback_; |
| 215 | 216 |
| 216 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; | 217 base::WeakPtrFactory<ExtensionToolbarModel> weak_ptr_factory_; |
| 217 | 218 |
| 218 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); | 219 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); |
| 219 }; | 220 }; |
| 220 | 221 |
| 221 } // namespace extensions | 222 } // namespace extensions |
| 222 | 223 |
| 223 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 224 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
| OLD | NEW |