OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
11 #include "chrome/common/notification_observer.h" | 11 #include "chrome/common/notification_observer.h" |
12 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
13 | 13 |
14 class ExtensionsService; | 14 class ExtensionService; |
15 class PrefService; | 15 class PrefService; |
16 | 16 |
17 // Model for the browser actions toolbar. | 17 // Model for the browser actions toolbar. |
18 class ExtensionToolbarModel : public NotificationObserver { | 18 class ExtensionToolbarModel : public NotificationObserver { |
19 public: | 19 public: |
20 explicit ExtensionToolbarModel(ExtensionsService* service); | 20 explicit ExtensionToolbarModel(ExtensionService* service); |
21 ~ExtensionToolbarModel(); | 21 ~ExtensionToolbarModel(); |
22 | 22 |
23 // Notifies the toolbar model that the Profile that suplied its | 23 // Notifies the toolbar model that the Profile that suplied its |
24 // prefs is being destroyed. | 24 // prefs is being destroyed. |
25 void DestroyingProfile(); | 25 void DestroyingProfile(); |
26 | 26 |
27 // A class which is informed of changes to the model; represents the view of | 27 // A class which is informed of changes to the model; represents the view of |
28 // MVC. | 28 // MVC. |
29 class Observer { | 29 class Observer { |
30 public: | 30 public: |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // Save the model to prefs. | 90 // Save the model to prefs. |
91 void UpdatePrefs(); | 91 void UpdatePrefs(); |
92 | 92 |
93 // Our observers. | 93 // Our observers. |
94 ObserverList<Observer> observers_; | 94 ObserverList<Observer> observers_; |
95 | 95 |
96 void AddExtension(const Extension* extension); | 96 void AddExtension(const Extension* extension); |
97 void RemoveExtension(const Extension* extension); | 97 void RemoveExtension(const Extension* extension); |
98 | 98 |
99 // Our ExtensionsService, guaranteed to outlive us. | 99 // Our ExtensionService, guaranteed to outlive us. |
100 ExtensionsService* service_; | 100 ExtensionService* service_; |
101 | 101 |
102 PrefService* prefs_; | 102 PrefService* prefs_; |
103 | 103 |
104 // True if we've handled the initial EXTENSIONS_READY notification. | 104 // True if we've handled the initial EXTENSIONS_READY notification. |
105 bool extensions_initialized_; | 105 bool extensions_initialized_; |
106 | 106 |
107 // Ordered list of browser action buttons. | 107 // Ordered list of browser action buttons. |
108 ExtensionList toolitems_; | 108 ExtensionList toolitems_; |
109 | 109 |
110 // Keeps track of what the last extension to get disabled was. | 110 // Keeps track of what the last extension to get disabled was. |
111 std::string last_extension_removed_; | 111 std::string last_extension_removed_; |
112 | 112 |
113 // Keeps track of where the last extension to get disabled was in the list. | 113 // Keeps track of where the last extension to get disabled was in the list. |
114 size_t last_extension_removed_index_; | 114 size_t last_extension_removed_index_; |
115 | 115 |
116 // The number of icons visible (the rest should be hidden in the overflow | 116 // The number of icons visible (the rest should be hidden in the overflow |
117 // chevron). | 117 // chevron). |
118 int visible_icon_count_; | 118 int visible_icon_count_; |
119 | 119 |
120 NotificationRegistrar registrar_; | 120 NotificationRegistrar registrar_; |
121 }; | 121 }; |
122 | 122 |
123 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 123 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
OLD | NEW |