Chromium Code Reviews| Index: chrome/browser/ui/ash/chrome_launcher_prefs.cc |
| diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.cc b/chrome/browser/ui/ash/chrome_launcher_prefs.cc |
| index 5d804d908a9b28bf586e494e8cef548af9d6a95a..8959f985c12fc1349fc3cda3c22a97609b88c680 100644 |
| --- a/chrome/browser/ui/ash/chrome_launcher_prefs.cc |
| +++ b/chrome/browser/ui/ash/chrome_launcher_prefs.cc |
| @@ -666,12 +666,10 @@ void RemovePinPosition(Profile* profile, const std::string& app_id) { |
| void SetPinPosition(Profile* profile, |
| const std::string& app_id, |
| const std::string& app_id_before, |
| - const std::string& app_id_after) { |
| + const std::vector<std::string>& app_ids_after) { |
| DCHECK(profile); |
| DCHECK(!app_id.empty()); |
| DCHECK_NE(app_id, app_id_before); |
| - DCHECK_NE(app_id, app_id_after); |
| - DCHECK(app_id_before.empty() || app_id_before != app_id_after); |
| app_list::AppListSyncableService* app_service = |
| app_list::AppListSyncableServiceFactory::GetForProfile(profile); |
| @@ -682,9 +680,20 @@ void SetPinPosition(Profile* profile, |
| syncer::StringOrdinal position_before = |
| app_id_before.empty() ? syncer::StringOrdinal() |
| : app_service->GetPinPosition(app_id_before); |
| - syncer::StringOrdinal position_after = |
| - app_id_after.empty() ? syncer::StringOrdinal() |
| - : app_service->GetPinPosition(app_id_after); |
| + syncer::StringOrdinal position_after; |
| + for (const auto& app_id_after : app_ids_after) { |
| + DCHECK_NE(app_id_after, app_id); |
| + DCHECK_NE(app_id_after, app_id_before); |
| + syncer::StringOrdinal position = app_service->GetPinPosition(app_id_after); |
| + if (!position.IsValid()) { |
| + NOTREACHED(); |
| + continue; |
| + } |
|
stevenjb
2016/09/26 17:34:07
NOTREACHED should only be used to document code th
khmel
2016/09/26 18:11:08
Thanks, LOG(ERROR) looks good.
|
| + if (!position_before.IsValid() || !position.Equals(position_before)) { |
| + position_after = position; |
| + break; |
| + } |
| + } |
| syncer::StringOrdinal pin_position; |
| if (position_before.IsValid() && position_after.IsValid()) |