OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf_model.h" | 5 #include "ash/shelf/shelf_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/shelf/shelf_model_observer.h" | 10 #include "ash/shelf/shelf_model_observer.h" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 int LauncherItemTypeToWeight(LauncherItemType type) { | 16 int LauncherItemTypeToWeight(LauncherItemType type) { |
17 if (ash::switches::UseAlternateShelfLayout()) { | 17 if (ash::switches::UseAlternateShelfLayout()) { |
18 switch (type) { | 18 switch (type) { |
19 case TYPE_APP_LIST: | 19 case TYPE_APP_LIST: |
20 // TODO(skuhne): If the app list item becomes movable again, this need | 20 // TODO(skuhne): If the app list item becomes movable again, this need |
21 // to be a fallthrough. | 21 // to be a fallthrough. |
22 return 0; | 22 return 0; |
23 case TYPE_BROWSER_SHORTCUT: | 23 case TYPE_BROWSER_SHORTCUT: |
24 case TYPE_APP_SHORTCUT: | 24 case TYPE_APP_SHORTCUT: |
25 case TYPE_WINDOWED_APP: | 25 case TYPE_WINDOWED_APP: |
26 return 1; | 26 return 1; |
27 case TYPE_PLATFORM_APP: | 27 case TYPE_PLATFORM_APP: |
28 return 2; | 28 return 2; |
| 29 case TYPE_DIALOG: |
| 30 return 3; |
29 case TYPE_APP_PANEL: | 31 case TYPE_APP_PANEL: |
30 return 3; | 32 return 4; |
31 case TYPE_UNDEFINED: | 33 case TYPE_UNDEFINED: |
32 NOTREACHED() << "LauncherItemType must be set"; | 34 NOTREACHED() << "LauncherItemType must be set"; |
33 return -1; | 35 return -1; |
34 } | 36 } |
35 } else { | 37 } else { |
36 switch (type) { | 38 switch (type) { |
37 case TYPE_BROWSER_SHORTCUT: | 39 case TYPE_BROWSER_SHORTCUT: |
38 case TYPE_APP_SHORTCUT: | 40 case TYPE_APP_SHORTCUT: |
39 case TYPE_WINDOWED_APP: | 41 case TYPE_WINDOWED_APP: |
40 return 0; | 42 return 0; |
41 case TYPE_PLATFORM_APP: | 43 case TYPE_PLATFORM_APP: |
42 return 1; | 44 return 1; |
43 case TYPE_APP_LIST: | 45 case TYPE_APP_LIST: |
44 return 2; | 46 return 2; |
| 47 case TYPE_DIALOG: |
| 48 return 3; |
45 case TYPE_APP_PANEL: | 49 case TYPE_APP_PANEL: |
46 return 3; | 50 return 4; |
47 case TYPE_UNDEFINED: | 51 case TYPE_UNDEFINED: |
48 NOTREACHED() << "LauncherItemType must be set"; | 52 NOTREACHED() << "LauncherItemType must be set"; |
49 return -1; | 53 return -1; |
50 } | 54 } |
51 } | 55 } |
52 | 56 |
53 NOTREACHED() << "Invalid type " << type; | 57 NOTREACHED() << "Invalid type " << type; |
54 return 1; | 58 return 1; |
55 } | 59 } |
56 | 60 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 CompareByWeight) - items_.begin(), | 186 CompareByWeight) - items_.begin(), |
183 static_cast<LauncherItems::difference_type>(index)); | 187 static_cast<LauncherItems::difference_type>(index)); |
184 index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy, | 188 index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy, |
185 CompareByWeight) - items_.begin(), | 189 CompareByWeight) - items_.begin(), |
186 static_cast<LauncherItems::difference_type>(index)); | 190 static_cast<LauncherItems::difference_type>(index)); |
187 | 191 |
188 return index; | 192 return index; |
189 } | 193 } |
190 | 194 |
191 } // namespace ash | 195 } // namespace ash |
OLD | NEW |