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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 toolbar_items_.begin(), toolbar_items_.end(), | 743 toolbar_items_.begin(), toolbar_items_.end(), |
744 [&id](const ToolbarItem& item) { return item.id == id; }); | 744 [&id](const ToolbarItem& item) { return item.id == id; }); |
745 if (current_pos == toolbar_items_.end()) | 745 if (current_pos == toolbar_items_.end()) |
746 continue; | 746 continue; |
747 | 747 |
748 if (current_pos != desired_pos) { | 748 if (current_pos != desired_pos) { |
749 if (current_pos < desired_pos) | 749 if (current_pos < desired_pos) |
750 std::rotate(current_pos, current_pos + 1, desired_pos + 1); | 750 std::rotate(current_pos, current_pos + 1, desired_pos + 1); |
751 else | 751 else |
752 std::rotate(desired_pos, current_pos, current_pos + 1); | 752 std::rotate(desired_pos, current_pos, current_pos + 1); |
753 // Notify the observers to keep them up-to-date, unless we're highlighting | 753 // Notify the observers to keep them up to date, unless we're highlighting |
754 // (in which case we're deliberately only showing a subset of actions). | 754 // (in which case we're deliberately only showing a subset of actions). |
755 if (!is_highlighting()) | 755 if (!is_highlighting()) |
756 FOR_EACH_OBSERVER( | 756 FOR_EACH_OBSERVER( |
757 Observer, observers_, | 757 Observer, observers_, |
758 OnToolbarActionMoved(id, desired_pos - toolbar_items_.begin())); | 758 OnToolbarActionMoved(id, desired_pos - toolbar_items_.begin())); |
759 } | 759 } |
760 ++desired_pos; | 760 ++desired_pos; |
761 } | 761 } |
762 | 762 |
763 if (last_known_positions_.size() > pref_position_size) { | 763 if (last_known_positions_.size() > pref_position_size) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 prefs_->GetInteger(extensions::pref_names::kToolbarSize); | 824 prefs_->GetInteger(extensions::pref_names::kToolbarSize); |
825 if (saved_icon_count != visible_icon_count_) | 825 if (saved_icon_count != visible_icon_count_) |
826 SetVisibleIconCount(saved_icon_count); | 826 SetVisibleIconCount(saved_icon_count); |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
830 const extensions::Extension* ToolbarActionsModel::GetExtensionById( | 830 const extensions::Extension* ToolbarActionsModel::GetExtensionById( |
831 const std::string& id) const { | 831 const std::string& id) const { |
832 return extension_registry_->enabled_extensions().GetByID(id); | 832 return extension_registry_->enabled_extensions().GetByID(id); |
833 } | 833 } |
OLD | NEW |