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

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

Issue 107163005: [ash] Add TYPE_DIALOG and its item's LauncherContextMenu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 | « ash/shelf/shelf_item_delegate.h ('k') | ash/shelf/shelf_view.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 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
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
OLDNEW
« no previous file with comments | « ash/shelf/shelf_item_delegate.h ('k') | ash/shelf/shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698