Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_model.h

Issue 2450633004: Make ToolbarActionsModel ignore calls to AddComponentAction() before initialization (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // bounds. 145 // bounds.
146 return visible_icon_count_ == -1 146 return visible_icon_count_ == -1
147 ? toolbar_items().size() 147 ? toolbar_items().size()
148 : std::min(static_cast<size_t>(visible_icon_count_), 148 : std::min(static_cast<size_t>(visible_icon_count_),
149 toolbar_items().size()); 149 toolbar_items().size());
150 } 150 }
151 bool all_icons_visible() const { 151 bool all_icons_visible() const {
152 return visible_icon_count() == toolbar_items().size(); 152 return visible_icon_count() == toolbar_items().size();
153 } 153 }
154 154
155 bool actions_initialized() const { return actions_initialized_; }
156
157 ScopedVector<ToolbarActionViewController> CreateActions( 155 ScopedVector<ToolbarActionViewController> CreateActions(
158 Browser* browser, 156 Browser* browser,
159 ToolbarActionsBar* bar); 157 ToolbarActionsBar* bar);
160 std::unique_ptr<ToolbarActionViewController> CreateActionForItem( 158 std::unique_ptr<ToolbarActionViewController> CreateActionForItem(
161 Browser* browser, 159 Browser* browser,
162 ToolbarActionsBar* bar, 160 ToolbarActionsBar* bar,
163 const ToolbarItem& item); 161 const ToolbarItem& item);
164 162
165 const std::vector<ToolbarItem>& toolbar_items() const { 163 const std::vector<ToolbarItem>& toolbar_items() const {
166 return is_highlighting() ? highlighted_items_ : toolbar_items_; 164 return is_highlighting() ? highlighted_items_ : toolbar_items_;
(...skipping 10 matching lines...) Expand all
177 void set_has_active_bubble(bool has_active_bubble) { 175 void set_has_active_bubble(bool has_active_bubble) {
178 has_active_bubble_ = has_active_bubble; 176 has_active_bubble_ = has_active_bubble;
179 } 177 }
180 178
181 void SetActionVisibility(const std::string& action_id, bool visible); 179 void SetActionVisibility(const std::string& action_id, bool visible);
182 180
183 // ComponentMigrationHelper::ComponentActionDelegate: 181 // ComponentMigrationHelper::ComponentActionDelegate:
184 void AddComponentAction(const std::string& action_id) override; 182 void AddComponentAction(const std::string& action_id) override;
185 void RemoveComponentAction(const std::string& action_id) override; 183 void RemoveComponentAction(const std::string& action_id) override;
186 bool HasComponentAction(const std::string& action_id) const override; 184 bool HasComponentAction(const std::string& action_id) const override;
185 bool ActionsInitialized() const override;
187 186
188 void OnActionToolbarPrefChange(); 187 void OnActionToolbarPrefChange();
189 188
190 // Highlights the actions specified by |action_ids|. This will cause 189 // Highlights the actions specified by |action_ids|. This will cause
191 // the ToolbarModel to only display those actions. 190 // the ToolbarModel to only display those actions.
192 // Highlighting mode is only entered if there is at least one action to be 191 // Highlighting mode is only entered if there is at least one action to be
193 // shown. 192 // shown.
194 // Returns true if highlighting mode is entered, false otherwise. 193 // Returns true if highlighting mode is entered, false otherwise.
195 bool HighlightActions(const std::vector<std::string>& action_ids, 194 bool HighlightActions(const std::vector<std::string>& action_ids,
196 HighlightType type); 195 HighlightType type);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // For observing change of toolbar order preference by external entity (sync). 336 // For observing change of toolbar order preference by external entity (sync).
338 PrefChangeRegistrar pref_change_registrar_; 337 PrefChangeRegistrar pref_change_registrar_;
339 base::Closure pref_change_callback_; 338 base::Closure pref_change_callback_;
340 339
341 base::WeakPtrFactory<ToolbarActionsModel> weak_ptr_factory_; 340 base::WeakPtrFactory<ToolbarActionsModel> weak_ptr_factory_;
342 341
343 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsModel); 342 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsModel);
344 }; 343 };
345 344
346 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_ 345 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698