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_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 class PrefService; | 21 class PrefService; |
22 class Profile; | 22 class Profile; |
23 class ToolbarActionsBar; | 23 class ToolbarActionsBar; |
24 class ToolbarActionViewController; | 24 class ToolbarActionViewController; |
25 | 25 |
26 namespace extensions { | 26 namespace extensions { |
27 class ExtensionRegistry; | 27 class ExtensionRegistry; |
28 class ExtensionSet; | 28 class ExtensionSet; |
29 } | 29 } |
30 | 30 |
31 // Model for the browser actions toolbar. | 31 // Model for the browser actions toolbar. This is a per-profile instance, and |
32 // manages the user's global preferences. These will typically be reflected in | |
33 // each window, but can be overridden in special circumstances by the window's | |
34 // ToolbarActionsBar (see also that class for details). | |
Peter Kasting
2015/09/17 19:59:53
Nit: Maybe instead of the sentence about "special
Devlin
2015/09/17 21:38:38
Done.
| |
32 class ToolbarActionsModel : public extensions::ExtensionActionAPI::Observer, | 35 class ToolbarActionsModel : public extensions::ExtensionActionAPI::Observer, |
33 public extensions::ExtensionRegistryObserver, | 36 public extensions::ExtensionRegistryObserver, |
34 public KeyedService { | 37 public KeyedService { |
35 public: | 38 public: |
36 // The different options for highlighting. | 39 // The different options for highlighting. |
37 enum HighlightType { | 40 enum HighlightType { |
38 HIGHLIGHT_NONE, | 41 HIGHLIGHT_NONE, |
39 HIGHLIGHT_INFO, | 42 HIGHLIGHT_INFO, |
40 HIGHLIGHT_WARNING, | 43 HIGHLIGHT_WARNING, |
41 }; | 44 }; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 size_t visible_icon_count() const { | 129 size_t visible_icon_count() const { |
127 // We have guards around this because |visible_icon_count_| can be set by | 130 // We have guards around this because |visible_icon_count_| can be set by |
128 // prefs/sync, and we want to ensure that the icon count returned is within | 131 // prefs/sync, and we want to ensure that the icon count returned is within |
129 // bounds. | 132 // bounds. |
130 return visible_icon_count_ == -1 | 133 return visible_icon_count_ == -1 |
131 ? toolbar_items().size() | 134 ? toolbar_items().size() |
132 : std::min(static_cast<size_t>(visible_icon_count_), | 135 : std::min(static_cast<size_t>(visible_icon_count_), |
133 toolbar_items().size()); | 136 toolbar_items().size()); |
134 } | 137 } |
135 | 138 |
136 bool all_icons_visible() const { | 139 bool all_icons_visible() const { |
Peter Kasting
2015/09/17 19:59:53
Nit: Do you think you should put a warning on here
Devlin
2015/09/17 21:38:38
Done.
| |
137 return visible_icon_count() == toolbar_items().size(); | 140 return visible_icon_count() == toolbar_items().size(); |
138 } | 141 } |
139 | 142 |
140 bool actions_initialized() const { return actions_initialized_; } | 143 bool actions_initialized() const { return actions_initialized_; } |
141 | 144 |
142 ScopedVector<ToolbarActionViewController> CreateActions( | 145 ScopedVector<ToolbarActionViewController> CreateActions( |
143 Browser* browser, | 146 Browser* browser, |
144 ToolbarActionsBar* bar); | 147 ToolbarActionsBar* bar); |
145 | 148 |
146 const std::vector<ToolbarItem>& toolbar_items() const { | 149 const std::vector<ToolbarItem>& toolbar_items() const { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 // For observing change of toolbar order preference by external entity (sync). | 282 // For observing change of toolbar order preference by external entity (sync). |
280 PrefChangeRegistrar pref_change_registrar_; | 283 PrefChangeRegistrar pref_change_registrar_; |
281 base::Closure pref_change_callback_; | 284 base::Closure pref_change_callback_; |
282 | 285 |
283 base::WeakPtrFactory<ToolbarActionsModel> weak_ptr_factory_; | 286 base::WeakPtrFactory<ToolbarActionsModel> weak_ptr_factory_; |
284 | 287 |
285 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsModel); | 288 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsModel); |
286 }; | 289 }; |
287 | 290 |
288 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_ | 291 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_ |
OLD | NEW |