| 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 "ash/launcher/launcher_model.h" | 5 #include "ash/launcher/launcher_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/launcher/launcher_model_observer.h" | 9 #include "ash/launcher/launcher_model_observer.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 int LauncherItemTypeToWeight(LauncherItemType type) { | 15 int LauncherItemTypeToWeight(LauncherItemType type) { |
| 16 switch (type) { | 16 switch (type) { |
| 17 case TYPE_BROWSER_SHORTCUT: | 17 case TYPE_BROWSER_SHORTCUT: |
| 18 return 0; | 18 return 0; |
| 19 case TYPE_APP_SHORTCUT: | 19 case TYPE_APP_SHORTCUT: |
| 20 case TYPE_WINDOWED_APP: |
| 20 return 1; | 21 return 1; |
| 21 case TYPE_TABBED: | 22 case TYPE_TABBED: |
| 22 case TYPE_PLATFORM_APP: | 23 case TYPE_PLATFORM_APP: |
| 23 return 2; | 24 return 2; |
| 24 case TYPE_APP_LIST: | 25 case TYPE_APP_LIST: |
| 25 return 3; | 26 return 3; |
| 26 case TYPE_APP_PANEL: | 27 case TYPE_APP_PANEL: |
| 27 return 4; | 28 return 4; |
| 28 } | 29 } |
| 29 | 30 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 CompareByWeight) - items_.begin(), | 154 CompareByWeight) - items_.begin(), |
| 154 static_cast<LauncherItems::difference_type>(index)); | 155 static_cast<LauncherItems::difference_type>(index)); |
| 155 index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy, | 156 index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy, |
| 156 CompareByWeight) - items_.begin(), | 157 CompareByWeight) - items_.begin(), |
| 157 static_cast<LauncherItems::difference_type>(index)); | 158 static_cast<LauncherItems::difference_type>(index)); |
| 158 | 159 |
| 159 return index; | 160 return index; |
| 160 } | 161 } |
| 161 | 162 |
| 162 } // namespace ash | 163 } // namespace ash |
| OLD | NEW |