| 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 } | 786 } |
| 787 } | 787 } |
| 788 } | 788 } |
| 789 ++desired_pos; | 789 ++desired_pos; |
| 790 } | 790 } |
| 791 | 791 |
| 792 if (last_known_positions_.size() > pref_position_size) { | 792 if (last_known_positions_.size() > pref_position_size) { |
| 793 // Need to update pref because we have extra icons. But can't call | 793 // Need to update pref because we have extra icons. But can't call |
| 794 // UpdatePrefs() directly within observation closure. | 794 // UpdatePrefs() directly within observation closure. |
| 795 base::ThreadTaskRunnerHandle::Get()->PostTask( | 795 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 796 FROM_HERE, base::Bind(&ToolbarActionsModel::UpdatePrefs, | 796 FROM_HERE, base::BindOnce(&ToolbarActionsModel::UpdatePrefs, |
| 797 weak_ptr_factory_.GetWeakPtr())); | 797 weak_ptr_factory_.GetWeakPtr())); |
| 798 } | 798 } |
| 799 } | 799 } |
| 800 | 800 |
| 801 bool ToolbarActionsModel::HighlightActions(const std::vector<std::string>& ids, | 801 bool ToolbarActionsModel::HighlightActions(const std::vector<std::string>& ids, |
| 802 HighlightType highlight_type) { | 802 HighlightType highlight_type) { |
| 803 highlighted_items_.clear(); | 803 highlighted_items_.clear(); |
| 804 | 804 |
| 805 for (const std::string& action_id : ids) { | 805 for (const std::string& action_id : ids) { |
| 806 for (const ToolbarItem& item : toolbar_items_) { | 806 for (const ToolbarItem& item : toolbar_items_) { |
| 807 if (action_id == item.id) | 807 if (action_id == item.id) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 return extension_registry_->enabled_extensions().GetByID(id); | 861 return extension_registry_->enabled_extensions().GetByID(id); |
| 862 } | 862 } |
| 863 | 863 |
| 864 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const { | 864 bool ToolbarActionsModel::IsActionVisible(const std::string& action_id) const { |
| 865 size_t index = 0u; | 865 size_t index = 0u; |
| 866 while (toolbar_items().size() > index && | 866 while (toolbar_items().size() > index && |
| 867 toolbar_items()[index].id != action_id) | 867 toolbar_items()[index].id != action_id) |
| 868 ++index; | 868 ++index; |
| 869 return index < visible_icon_count(); | 869 return index < visible_icon_count(); |
| 870 } | 870 } |
| OLD | NEW |