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

Unified Diff: ash/shelf/shelf_model.cc

Issue 198063003: Revert of Shelf Cleanup (- binary files) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/shelf/shelf_model_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_model.cc
diff --git a/ash/shelf/shelf_model.cc b/ash/shelf/shelf_model.cc
index e04af42d1f712a8b4b761f6b6e4749a3fe48d640..2760d8fd16234ed04df481eb2328892fafa39334 100644
--- a/ash/shelf/shelf_model.cc
+++ b/ash/shelf/shelf_model.cc
@@ -14,24 +14,44 @@
namespace {
int ShelfItemTypeToWeight(ShelfItemType type) {
- switch (type) {
- case TYPE_APP_LIST:
- // TODO(skuhne): If the app list item becomes movable again, this need
- // to be a fallthrough.
- return 0;
- case TYPE_BROWSER_SHORTCUT:
- case TYPE_APP_SHORTCUT:
- return 1;
- case TYPE_WINDOWED_APP:
- case TYPE_PLATFORM_APP:
- return 2;
- case TYPE_DIALOG:
- return 3;
- case TYPE_APP_PANEL:
- return 4;
- case TYPE_UNDEFINED:
- NOTREACHED() << "ShelfItemType must be set";
- return -1;
+ if (ash::switches::UseAlternateShelfLayout()) {
+ switch (type) {
+ case TYPE_APP_LIST:
+ // TODO(skuhne): If the app list item becomes movable again, this need
+ // to be a fallthrough.
+ return 0;
+ case TYPE_BROWSER_SHORTCUT:
+ case TYPE_APP_SHORTCUT:
+ return 1;
+ case TYPE_WINDOWED_APP:
+ case TYPE_PLATFORM_APP:
+ return 2;
+ case TYPE_DIALOG:
+ return 3;
+ case TYPE_APP_PANEL:
+ return 4;
+ case TYPE_UNDEFINED:
+ NOTREACHED() << "ShelfItemType must be set";
+ return -1;
+ }
+ } else {
+ switch (type) {
+ case TYPE_BROWSER_SHORTCUT:
+ case TYPE_APP_SHORTCUT:
+ return 0;
+ case TYPE_WINDOWED_APP:
+ case TYPE_PLATFORM_APP:
+ return 1;
+ case TYPE_APP_LIST:
+ return 2;
+ case TYPE_DIALOG:
+ return 3;
+ case TYPE_APP_PANEL:
+ return 4;
+ case TYPE_UNDEFINED:
+ NOTREACHED() << "ShelfItemType must be set";
+ return -1;
+ }
}
NOTREACHED() << "Invalid type " << type;
@@ -167,7 +187,8 @@
}
int ShelfModel::ValidateInsertionIndex(ShelfItemType type, int index) const {
- DCHECK(index >= 0 && index <= item_count() + 1);
+ DCHECK(index >= 0 && index <= item_count() +
+ (ash::switches::UseAlternateShelfLayout() ? 1 : 0));
// Clamp |index| to the allowed range for the type as determined by |weight|.
ShelfItem weight_dummy;
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/shelf/shelf_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698