Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: ash/shelf/shelf_model.cc

Issue 133743005: Don't allow windowed but not pinned applications to mix with shortcuts in the shelf launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self nit: Changed comment Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 return 1;
25 case TYPE_WINDOWED_APP: 26 case TYPE_WINDOWED_APP:
26 return 1;
27 case TYPE_PLATFORM_APP: 27 case TYPE_PLATFORM_APP:
28 return 2; 28 return 2;
29 case TYPE_DIALOG: 29 case TYPE_DIALOG:
30 return 3; 30 return 3;
31 case TYPE_APP_PANEL: 31 case TYPE_APP_PANEL:
32 return 4; 32 return 4;
33 case TYPE_UNDEFINED: 33 case TYPE_UNDEFINED:
34 NOTREACHED() << "LauncherItemType must be set"; 34 NOTREACHED() << "LauncherItemType must be set";
35 return -1; 35 return -1;
36 } 36 }
37 } else { 37 } else {
38 switch (type) { 38 switch (type) {
39 case TYPE_BROWSER_SHORTCUT: 39 case TYPE_BROWSER_SHORTCUT:
40 case TYPE_APP_SHORTCUT: 40 case TYPE_APP_SHORTCUT:
41 return 0;
41 case TYPE_WINDOWED_APP: 42 case TYPE_WINDOWED_APP:
42 return 0;
43 case TYPE_PLATFORM_APP: 43 case TYPE_PLATFORM_APP:
44 return 1; 44 return 1;
45 case TYPE_APP_LIST: 45 case TYPE_APP_LIST:
46 return 2; 46 return 2;
47 case TYPE_DIALOG: 47 case TYPE_DIALOG:
48 return 3; 48 return 3;
49 case TYPE_APP_PANEL: 49 case TYPE_APP_PANEL:
50 return 4; 50 return 4;
51 case TYPE_UNDEFINED: 51 case TYPE_UNDEFINED:
52 NOTREACHED() << "LauncherItemType must be set"; 52 NOTREACHED() << "LauncherItemType must be set";
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 CompareByWeight) - items_.begin(), 186 CompareByWeight) - items_.begin(),
187 static_cast<LauncherItems::difference_type>(index)); 187 static_cast<LauncherItems::difference_type>(index));
188 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,
189 CompareByWeight) - items_.begin(), 189 CompareByWeight) - items_.begin(),
190 static_cast<LauncherItems::difference_type>(index)); 190 static_cast<LauncherItems::difference_type>(index));
191 191
192 return index; 192 return index;
193 } 193 }
194 194
195 } // namespace ash 195 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698