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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 return toolitems_.end(); | 85 return toolitems_.end(); |
86 } | 86 } |
87 | 87 |
88 const extensions::Extension* GetExtensionByIndex(int index) const; | 88 const extensions::Extension* GetExtensionByIndex(int index) const; |
89 | 89 |
90 // Utility functions for converting between an index into the list of | 90 // Utility functions for converting between an index into the list of |
91 // incognito-enabled browser actions, and the list of all browser actions. | 91 // incognito-enabled browser actions, and the list of all browser actions. |
92 int IncognitoIndexToOriginal(int incognito_index); | 92 int IncognitoIndexToOriginal(int incognito_index); |
93 int OriginalIndexToIncognito(int original_index); | 93 int OriginalIndexToIncognito(int original_index); |
94 | 94 |
95 size_t action_box_extensions_size() { | |
96 return action_box_menu_items_.size(); | |
97 } | |
98 | |
99 const extensions::Extension* GetActionBoxExtensionByIndex(int index) const; | |
Aaron Boodman
2012/06/12 05:53:44
Why not just expose the ExtensionList directly? Co
yefimt
2012/06/13 01:24:21
I'm a bit uncomfortable to do it.
I don't want to
| |
100 | |
95 private: | 101 private: |
96 // content::NotificationObserver implementation. | 102 // content::NotificationObserver implementation. |
97 virtual void Observe(int type, | 103 virtual void Observe(int type, |
98 const content::NotificationSource& source, | 104 const content::NotificationSource& source, |
99 const content::NotificationDetails& details) OVERRIDE; | 105 const content::NotificationDetails& details) OVERRIDE; |
100 | 106 |
101 // To be called after the extension service is ready; gets loaded extensions | 107 // To be called after the extension service is ready; gets loaded extensions |
102 // from the extension service and their saved order from the pref service | 108 // from the extension service and their saved order from the pref service |
103 // and constructs |toolitems_| from these data. | 109 // and constructs |toolitems_| from these data. |
104 void InitializeExtensionList(); | 110 void InitializeExtensionLists(); |
111 void InitializeExtensionList(const std::vector<std::string>& pref_order, | |
112 extensions::ExtensionList* extension_list, bool bar); | |
105 | 113 |
106 // Save the model to prefs. | 114 // Save the model to prefs. |
107 void UpdatePrefs(); | 115 void UpdatePrefs(); |
108 | 116 |
109 // Our observers. | 117 // Our observers. |
110 ObserverList<Observer> observers_; | 118 ObserverList<Observer> observers_; |
111 | 119 |
112 void AddExtension(const extensions::Extension* extension); | 120 void AddExtension(const extensions::Extension* extension); |
113 void RemoveExtension(const extensions::Extension* extension); | 121 void RemoveExtension(const extensions::Extension* extension); |
114 | 122 |
115 // Our ExtensionService, guaranteed to outlive us. | 123 // Our ExtensionService, guaranteed to outlive us. |
116 ExtensionService* service_; | 124 ExtensionService* service_; |
117 | 125 |
118 PrefService* prefs_; | 126 PrefService* prefs_; |
119 | 127 |
120 // True if we've handled the initial EXTENSIONS_READY notification. | 128 // True if we've handled the initial EXTENSIONS_READY notification. |
121 bool extensions_initialized_; | 129 bool extensions_initialized_; |
122 | 130 |
123 // Ordered list of browser action buttons. | 131 // Ordered list of browser action buttons. |
124 extensions::ExtensionList toolitems_; | 132 extensions::ExtensionList toolitems_; |
125 | 133 |
134 // List of browser action buttons visible in an action box menu. | |
135 extensions::ExtensionList action_box_menu_items_; | |
136 | |
126 // Keeps track of what the last extension to get disabled was. | 137 // Keeps track of what the last extension to get disabled was. |
127 std::string last_extension_removed_; | 138 std::string last_extension_removed_; |
128 | 139 |
129 // Keeps track of where the last extension to get disabled was in the list. | 140 // Keeps track of where the last extension to get disabled was in the list. |
130 size_t last_extension_removed_index_; | 141 size_t last_extension_removed_index_; |
131 | 142 |
132 // The number of icons visible (the rest should be hidden in the overflow | 143 // The number of icons visible (the rest should be hidden in the overflow |
133 // chevron). | 144 // chevron). |
134 int visible_icon_count_; | 145 int visible_icon_count_; |
135 | 146 |
136 content::NotificationRegistrar registrar_; | 147 content::NotificationRegistrar registrar_; |
137 | 148 |
138 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); | 149 DISALLOW_COPY_AND_ASSIGN(ExtensionToolbarModel); |
139 }; | 150 }; |
140 | 151 |
141 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ | 152 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_ |
OLD | NEW |