index = ValidateInsertionIndex(item.type, index);
items_.insert(items_.begin() + index, item);
items_[index].id = next_id_++;
index = ValidateInsertionIndex(item.type, index);
items_.insert(items_.begin() + index, item);
items_[index].id = next_id_++;
// The app list and browser shortcut can't be removed.
DCHECK(items_[index].type != TYPE_APP_LIST &&
items_[index].type != TYPE_BROWSER_SHORTCUT);
// The app list and browser shortcut can't be removed.
DCHECK(items_[index].type != TYPE_APP_LIST &&
items_[index].type != TYPE_BROWSER_SHORTCUT);
items_.erase(items_.begin() + index);
FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
ShelfItemRemoved(index, id));
items_.erase(items_.begin() + index);
FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
ShelfItemRemoved(index, id));
items_.erase(items_.begin() + index);
items_.insert(items_.begin() + target_index, item);
FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
ShelfItemMoved(index, target_index));
}
items_.erase(items_.begin() + index);
items_.insert(items_.begin() + target_index, item);
FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
ShelfItemMoved(index, target_index));
}
DCHECK(index >= 0 && index < item_count());
int new_index = item.type == items_[index].type ?
index : ValidateInsertionIndex(item.type, index);
DCHECK(index >= 0 && index < item_count());
int new_index = item.type == items_[index].type ?
index : ValidateInsertionIndex(item.type, index);
items_[index] = item;
items_[index].id = old_item.id;
FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
items_[index] = item;
items_[index].id = old_item.id;
FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
-LauncherItems::const_iterator ShelfModel::ItemByID(int id) const {
- for (LauncherItems::const_iterator i = items_.begin();
+ShelfItems::const_iterator ShelfModel::ItemByID(int id) const {
+ for (ShelfItems::const_iterator i = items_.begin();
// to explicitly change different running application types.
DCHECK_EQ(ShelfItemTypeToWeight(TYPE_WINDOWED_APP),
ShelfItemTypeToWeight(TYPE_PLATFORM_APP));
// to explicitly change different running application types.
DCHECK_EQ(ShelfItemTypeToWeight(TYPE_WINDOWED_APP),
ShelfItemTypeToWeight(TYPE_PLATFORM_APP));
weight_dummy.type = TYPE_WINDOWED_APP;
return std::lower_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin();
}
int ShelfModel::FirstPanelIndex() const {
weight_dummy.type = TYPE_WINDOWED_APP;
return std::lower_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin();
}
int ShelfModel::FirstPanelIndex() const {
weight_dummy.type = TYPE_APP_PANEL;
return std::lower_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin();
weight_dummy.type = TYPE_APP_PANEL;
return std::lower_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin();
(ash::switches::UseAlternateShelfLayout() ? 1 : 0));
// Clamp |index| to the allowed range for the type as determined by |weight|.
(ash::switches::UseAlternateShelfLayout() ? 1 : 0));
// Clamp |index| to the allowed range for the type as determined by |weight|.
weight_dummy.type = type;
index = std::max(std::lower_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin(),
weight_dummy.type = type;
index = std::max(std::lower_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin(),
index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin(),
index = std::min(std::upper_bound(items_.begin(), items_.end(), weight_dummy,
CompareByWeight) - items_.begin(),