| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 return base::ContainsValue(toolbar_items_, item); | 628 return base::ContainsValue(toolbar_items_, item); |
| 629 } | 629 } |
| 630 | 630 |
| 631 bool ToolbarActionsModel::HasComponentAction( | 631 bool ToolbarActionsModel::HasComponentAction( |
| 632 const std::string& action_id) const { | 632 const std::string& action_id) const { |
| 633 DCHECK(use_redesign_); | 633 DCHECK(use_redesign_); |
| 634 return HasItem(ToolbarItem(action_id, COMPONENT_ACTION)); | 634 return HasItem(ToolbarItem(action_id, COMPONENT_ACTION)); |
| 635 } | 635 } |
| 636 | 636 |
| 637 void ToolbarActionsModel::AddComponentAction(const std::string& action_id) { | 637 void ToolbarActionsModel::AddComponentAction(const std::string& action_id) { |
| 638 if (!actions_initialized_) { |
| 639 // TODO(crbug.com/660972): Add these component actions at initialization. |
| 640 return; |
| 641 } |
| 642 |
| 638 DCHECK(use_redesign_); | 643 DCHECK(use_redesign_); |
| 639 ToolbarItem component_item(action_id, COMPONENT_ACTION); | 644 ToolbarItem component_item(action_id, COMPONENT_ACTION); |
| 640 DCHECK(!HasItem(component_item)); | 645 DCHECK(!HasItem(component_item)); |
| 641 AddItem(component_item); | 646 AddItem(component_item); |
| 642 } | 647 } |
| 643 | 648 |
| 644 void ToolbarActionsModel::RemoveComponentAction(const std::string& action_id) { | 649 void ToolbarActionsModel::RemoveComponentAction(const std::string& action_id) { |
| 645 DCHECK(use_redesign_); | 650 DCHECK(use_redesign_); |
| 646 ToolbarItem component_item(action_id, COMPONENT_ACTION); | 651 ToolbarItem component_item(action_id, COMPONENT_ACTION); |
| 647 DCHECK(HasItem(component_item)); | 652 DCHECK(HasItem(component_item)); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 prefs_->GetInteger(extensions::pref_names::kToolbarSize); | 850 prefs_->GetInteger(extensions::pref_names::kToolbarSize); |
| 846 if (saved_icon_count != visible_icon_count_) | 851 if (saved_icon_count != visible_icon_count_) |
| 847 SetVisibleIconCount(saved_icon_count); | 852 SetVisibleIconCount(saved_icon_count); |
| 848 } | 853 } |
| 849 } | 854 } |
| 850 | 855 |
| 851 const extensions::Extension* ToolbarActionsModel::GetExtensionById( | 856 const extensions::Extension* ToolbarActionsModel::GetExtensionById( |
| 852 const std::string& id) const { | 857 const std::string& id) const { |
| 853 return extension_registry_->enabled_extensions().GetByID(id); | 858 return extension_registry_->enabled_extensions().GetByID(id); |
| 854 } | 859 } |
| OLD | NEW |