Chromium Code Reviews| 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_++; |