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 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_) | |
|
imcheng
2016/10/26 01:32:03
Wait, so if we simply returned here, then wouldn't
Devlin
2016/10/26 16:41:56
We would have the same problem in Patch Set 1, if
takumif
2016/10/26 18:42:05
Right, the information does get lost. I think we d
takumif
2016/10/27 00:15:21
As I've discussed with Derek offline, there's an i
Devlin
2016/10/28 15:17:15
It seems to me part of the problem is that there a
takumif
2016/10/29 00:37:22
Yes, it does make sense. I think it'd still be nec
| |
| 639 return; | |
| 640 | |
| 638 DCHECK(use_redesign_); | 641 DCHECK(use_redesign_); |
| 639 ToolbarItem component_item(action_id, COMPONENT_ACTION); | 642 ToolbarItem component_item(action_id, COMPONENT_ACTION); |
| 640 DCHECK(!HasItem(component_item)); | 643 DCHECK(!HasItem(component_item)); |
| 641 AddItem(component_item); | 644 AddItem(component_item); |
| 642 } | 645 } |
| 643 | 646 |
| 644 void ToolbarActionsModel::RemoveComponentAction(const std::string& action_id) { | 647 void ToolbarActionsModel::RemoveComponentAction(const std::string& action_id) { |
| 645 DCHECK(use_redesign_); | 648 DCHECK(use_redesign_); |
| 646 ToolbarItem component_item(action_id, COMPONENT_ACTION); | 649 ToolbarItem component_item(action_id, COMPONENT_ACTION); |
| 647 DCHECK(HasItem(component_item)); | 650 DCHECK(HasItem(component_item)); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 prefs_->GetInteger(extensions::pref_names::kToolbarSize); | 848 prefs_->GetInteger(extensions::pref_names::kToolbarSize); |
| 846 if (saved_icon_count != visible_icon_count_) | 849 if (saved_icon_count != visible_icon_count_) |
| 847 SetVisibleIconCount(saved_icon_count); | 850 SetVisibleIconCount(saved_icon_count); |
| 848 } | 851 } |
| 849 } | 852 } |
| 850 | 853 |
| 851 const extensions::Extension* ToolbarActionsModel::GetExtensionById( | 854 const extensions::Extension* ToolbarActionsModel::GetExtensionById( |
| 852 const std::string& id) const { | 855 const std::string& id) const { |
| 853 return extension_registry_->enabled_extensions().GetByID(id); | 856 return extension_registry_->enabled_extensions().GetByID(id); |
| 854 } | 857 } |
| OLD | NEW |