Commit 0bcc7e1c authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Fix folder position change persistency

Background:
Folder item's metadata (including position) is retrieved via syncable
service and is set to the folder item. But the item's index in item list
is not updated based on the metadata.

Change:
Update the index in item list if position in the metadata changes.

BUG=842420

Change-Id: I27f67bf37a451f90c4d7654dac9152ea500bfd8d
Reviewed-on: https://chromium-review.googlesource.com/1056064Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558791}
parent 13d4c576
......@@ -187,6 +187,21 @@ void AppListControllerImpl::SetItemMetadata(const std::string& id,
// data may not contain valid position or icon. Preserve it in this case.
if (!data->position.IsValid())
data->position = item->position();
// Update the item's position and name based on the metadata.
if (!data->position.Equals(item->position()))
model_.SetItemPosition(item, data->position);
if (data->short_name.empty()) {
if (data->name != item->name()) {
model_.SetItemName(item, data->name);
}
} else {
if (data->name != item->name() || data->short_name != item->short_name()) {
model_.SetItemNameAndShortName(item, data->name, data->short_name);
}
}
// Folder icon is generated on ash side and chrome side passes a null
// icon here. Skip it.
if (data->icon.isNull())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment