OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
10 #include "chrome/common/notification_observer.h" | 10 #include "chrome/common/notification_observer.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ExtensionList::iterator end() { | 45 ExtensionList::iterator end() { |
46 return toolitems_.end(); | 46 return toolitems_.end(); |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 // NotificationObserver implementation. | 50 // NotificationObserver implementation. |
51 virtual void Observe(NotificationType type, | 51 virtual void Observe(NotificationType type, |
52 const NotificationSource& source, | 52 const NotificationSource& source, |
53 const NotificationDetails& details); | 53 const NotificationDetails& details); |
54 | 54 |
| 55 // To be called after the extension service is ready; gets loaded extensions |
| 56 // from the extension service and their saved order from the pref service |
| 57 // and constructs |toolitems_| from these data. |
| 58 void InitializeExtensionList(); |
| 59 |
| 60 // Save the model to prefs. |
| 61 void UpdatePrefs(); |
| 62 |
55 // Our observers. | 63 // Our observers. |
56 ObserverList<Observer> observers_; | 64 ObserverList<Observer> observers_; |
57 | 65 |
58 void AddExtension(Extension* extension); | 66 void AddExtension(Extension* extension); |
59 void RemoveExtension(Extension* extension); | 67 void RemoveExtension(Extension* extension); |
60 | 68 |
61 // Our ExtensionsService, guaranteed to outlive us. | 69 // Our ExtensionsService, guaranteed to outlive us. |
62 ExtensionsService* service_; | 70 ExtensionsService* service_; |
63 | 71 |
64 // Ordered list of browser action buttons. | 72 // Ordered list of browser action buttons. |
65 ExtensionList toolitems_; | 73 ExtensionList toolitems_; |
66 | 74 |
67 NotificationRegistrar registrar_; | 75 NotificationRegistrar registrar_; |
68 }; | 76 }; |
69 | 77 |
70 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 78 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
OLD | NEW |