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 #include "ui/aura/window.h" | |
11 | 10 |
12 namespace ash { | 11 namespace ash { |
13 | 12 |
14 namespace { | 13 namespace { |
15 | 14 |
16 int LauncherItemTypeToWeight(LauncherItemType type) { | 15 int LauncherItemTypeToWeight(LauncherItemType type) { |
17 switch (type) { | 16 switch (type) { |
18 case TYPE_BROWSER_SHORTCUT: | 17 case TYPE_BROWSER_SHORTCUT: |
19 return 0; | 18 return 0; |
20 case TYPE_APP_SHORTCUT: | 19 case TYPE_APP_SHORTCUT: |
21 return 1; | 20 return 1; |
| 21 case TYPE_APP_PLACEHOLDER: |
| 22 return 2; |
22 case TYPE_TABBED: | 23 case TYPE_TABBED: |
23 case TYPE_APP_PANEL: | 24 case TYPE_APP_PANEL: |
24 case TYPE_PLATFORM_APP: | 25 case TYPE_PLATFORM_APP: |
25 return 2; | 26 return 3; |
26 case TYPE_APP_LIST: | 27 case TYPE_APP_LIST: |
27 return 3; | 28 return 4; |
28 } | 29 } |
29 | 30 |
30 NOTREACHED() << "Invalid type " << type; | 31 NOTREACHED() << "Invalid type " << type; |
31 return 2; | 32 return 3; |
32 } | 33 } |
33 | 34 |
34 bool CompareByWeight(const LauncherItem& a, const LauncherItem& b) { | 35 bool CompareByWeight(const LauncherItem& a, const LauncherItem& b) { |
35 return LauncherItemTypeToWeight(a.type) < LauncherItemTypeToWeight(b.type); | 36 return LauncherItemTypeToWeight(a.type) < LauncherItemTypeToWeight(b.type); |
36 } | 37 } |
37 | 38 |
38 } // namespace | 39 } // namespace |
39 | 40 |
40 LauncherModel::LauncherModel() : next_id_(1) { | 41 LauncherModel::LauncherModel() : next_id_(1) { |
41 LauncherItem app_list; | 42 LauncherItem app_list; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 CompareByWeight) - items_.begin(), | 138 CompareByWeight) - items_.begin(), |
138 static_cast<LauncherItems::difference_type>(index)); | 139 static_cast<LauncherItems::difference_type>(index)); |
139 index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy, | 140 index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy, |
140 CompareByWeight) - items_.begin(), | 141 CompareByWeight) - items_.begin(), |
141 static_cast<LauncherItems::difference_type>(index)); | 142 static_cast<LauncherItems::difference_type>(index)); |
142 | 143 |
143 return index; | 144 return index; |
144 } | 145 } |
145 | 146 |
146 } // namespace ash | 147 } // namespace ash |
OLD | NEW |