Chromium Code Reviews| 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 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 InitializeActionList(); | 261 InitializeActionList(); |
| 262 // Wait until the extension system is ready before observing any further | 262 // Wait until the extension system is ready before observing any further |
| 263 // changes so that the toolbar buttons can be shown in their stable ordering | 263 // changes so that the toolbar buttons can be shown in their stable ordering |
| 264 // taken from prefs. | 264 // taken from prefs. |
| 265 extension_registry_observer_.Add(extension_registry_); | 265 extension_registry_observer_.Add(extension_registry_); |
| 266 extension_action_observer_.Add(extension_action_api_); | 266 extension_action_observer_.Add(extension_action_api_); |
| 267 | 267 |
| 268 actions_initialized_ = true; | 268 actions_initialized_ = true; |
| 269 for (Observer& observer : observers_) | 269 for (Observer& observer : observers_) |
| 270 observer.OnToolbarModelInitialized(); | 270 observer.OnToolbarModelInitialized(); |
| 271 | |
| 272 if (use_redesign_) { | |
|
mark a. foltz
2017/02/14 23:16:09
Is it still possible to turn the extension action
Devlin
2017/02/14 23:18:49
I'm slowly working on removing them all; I'll get
| |
| 273 ComponentToolbarActionsFactory::GetInstance()->UnloadMigratedExtensions( | |
| 274 extensions::ExtensionSystem::Get(profile_)->extension_service(), | |
| 275 extension_registry_); | |
| 276 } | |
| 271 } | 277 } |
| 272 | 278 |
| 273 size_t ToolbarActionsModel::FindNewPositionFromLastKnownGood( | 279 size_t ToolbarActionsModel::FindNewPositionFromLastKnownGood( |
| 274 const ToolbarItem& action) { | 280 const ToolbarItem& action) { |
| 275 // See if we have last known good position for this action. | 281 // See if we have last known good position for this action. |
| 276 size_t new_index = 0; | 282 size_t new_index = 0; |
| 277 // Loop through the ID list of known positions, to count the number of | 283 // Loop through the ID list of known positions, to count the number of |
| 278 // visible action icons preceding |action|'s id. | 284 // visible action icons preceding |action|'s id. |
| 279 for (const std::string& last_pos_id : last_known_positions_) { | 285 for (const std::string& last_pos_id : last_known_positions_) { |
| 280 if (last_pos_id == action.id) | 286 if (last_pos_id == action.id) |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 return extension_registry_->enabled_extensions().GetByID(id); | 852 return extension_registry_->enabled_extensions().GetByID(id); |
| 847 } | 853 } |
| 848 | 854 |
| 849 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const { | 855 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const { |
| 850 size_t index = 0u; | 856 size_t index = 0u; |
| 851 while (toolbar_items().size() > index && | 857 while (toolbar_items().size() > index && |
| 852 toolbar_items()[index].id != action_id) | 858 toolbar_items()[index].id != action_id) |
| 853 ++index; | 859 ++index; |
| 854 return index < visible_icon_count(); | 860 return index < visible_icon_count(); |
| 855 } | 861 } |
| OLD | NEW |