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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.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
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index ed1936de7b4892dd438b246eb54fe695b1092236..6a5685baeec4e5f721031432e0f0bafc97e3ff1a 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -1091,7 +1091,8 @@
// The app list launcher can get added to the shelf after we applied the
// preferences. In that case the item might be at the wrong spot. As such we
// call the function again.
- if (model_->items()[index].type == ash::TYPE_APP_LIST)
+ if (model_->items()[index].type == ash::TYPE_APP_LIST &&
+ ash::switches::UseAlternateShelfLayout())
UpdateAppLaunchersFromPref();
}
@@ -1104,7 +1105,8 @@
// We remember the moved item position if it is either pinnable or
// it is the app list with the alternate shelf layout.
if ((HasItemController(item.id) && IsPinned(item.id)) ||
- item.type == ash::TYPE_APP_LIST)
+ (ash::switches::UseAlternateShelfLayout() &&
+ item.type == ash::TYPE_APP_LIST))
PersistPinnedState();
}
@@ -1867,17 +1869,18 @@
}
int ChromeLauncherController::FindInsertionPoint(bool is_app_list) {
+ bool alternate = ash::switches::UseAlternateShelfLayout();
// Keeping this change small to backport to M33&32 (see crbug.com/329597).
// TODO(skuhne): With the removal of the legacy shelf layout we should remove
// the ability to move the app list item since this was never used. We should
// instead ask the ShelfModel::ValidateInsertionIndex or similir for an index.
- if (is_app_list)
+ if (is_app_list && alternate)
return 0;
for (int i = model_->item_count() - 1; i > 0; --i) {
ash::ShelfItemType type = model_->items()[i].type;
if (type == ash::TYPE_APP_SHORTCUT ||
- type == ash::TYPE_APP_LIST ||
+ ((is_app_list || alternate) && type == ash::TYPE_APP_LIST) ||
type == ash::TYPE_BROWSER_SHORTCUT ||
type == ash::TYPE_WINDOWED_APP)
return i;
@@ -1966,8 +1969,12 @@
// If not added yet, add the app list item either at the end or at the
// beginning - depending on the shelf layout.
- if (!app_list_icon_added)
- pinned_apps.insert(pinned_apps.begin(), kAppShelfIdPlaceholder);
+ if (!app_list_icon_added) {
+ if (ash::switches::UseAlternateShelfLayout())
+ pinned_apps.insert(pinned_apps.begin(), kAppShelfIdPlaceholder);
+ else
+ pinned_apps.push_back(kAppShelfIdPlaceholder);
+ }
return pinned_apps;
}

Powered by Google App Engine
This is Rietveld 408576698