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

Unified Diff: ash/launcher/launcher_model.cc

Issue 17673004: Insert panel icons on the left of other panel icons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix test assertions. Created 7 years, 6 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/launcher/launcher_model.h ('k') | ash/launcher/launcher_model_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_model.cc
diff --git a/ash/launcher/launcher_model.cc b/ash/launcher/launcher_model.cc
index 68e57e06f0e58707fadc7babe57395eac5c325ef..6ee788fb6024ef8c5f160fa434613f9981642e91 100644
--- a/ash/launcher/launcher_model.cc
+++ b/ash/launcher/launcher_model.cc
@@ -37,6 +37,8 @@ bool CompareByWeight(const LauncherItem& a, const LauncherItem& b) {
} // namespace
+const int LauncherModel::kAutomaticIndex = -1;
+
LauncherModel::LauncherModel() : next_id_(1), status_(STATUS_NORMAL) {
LauncherItem app_list;
app_list.type = TYPE_APP_LIST;
@@ -48,10 +50,14 @@ LauncherModel::~LauncherModel() {
}
int LauncherModel::Add(const LauncherItem& item) {
- return AddAt(items_.size(), item);
+ return AddAt(kAutomaticIndex, item);
}
int LauncherModel::AddAt(int index, const LauncherItem& item) {
+ // Panel icons are by default inserted to the left of other panel icons since
+ // they are right aligned.
+ if (index == kAutomaticIndex)
sky 2013/06/25 16:19:45 Can we move this magic to where we create panel it
flackr 2013/06/25 17:40:52 Sure, done.
+ index = item.type == TYPE_APP_PANEL ? 0 : items_.size();
index = ValidateInsertionIndex(item.type, index);
items_.insert(items_.begin() + index, item);
items_[index].id = next_id_++;
« no previous file with comments | « ash/launcher/launcher_model.h ('k') | ash/launcher/launcher_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698