Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
index f3cbb73bf535b54cfa1bd26aae34d77c9e61a73b..8c33742dcc0b17b89d0374e8815d745f93696a2e 100644 |
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
@@ -392,8 +392,10 @@ void ChromeLauncherControllerImpl::UnpinAndUpdatePrefs(ash::ShelfID id, |
LauncherItemController* controller = GetLauncherItemController(id); |
CHECK(controller); |
- if (update_prefs) |
- ash::launcher::RemovePinPosition(profile_, GetAppIDForShelfID(id)); |
+ if (update_prefs) { |
+ ash::launcher::RemovePinPosition( |
+ profile_, ash::launcher::AppLauncherId(GetAppIDForShelfID(id))); |
+ } |
if (controller->type() == LauncherItemController::TYPE_APP || |
controller->locked()) { |
@@ -1177,7 +1179,7 @@ void ChromeLauncherControllerImpl::SyncPinPosition(ash::ShelfID shelf_id) { |
DCHECK(!app_id.empty()); |
std::string app_id_before; |
- std::vector<std::string> app_ids_after; |
+ std::vector<ash::launcher::AppLauncherId> app_launcher_ids_after; |
for (int i = index - 1; i > 0; --i) { |
const ash::ShelfID shelf_id_before = model_->items()[i].id; |
@@ -1193,11 +1195,14 @@ void ChromeLauncherControllerImpl::SyncPinPosition(ash::ShelfID shelf_id) { |
if (IsPinned(shelf_id_after)) { |
const std::string app_id_after = GetAppIDForShelfID(shelf_id_after); |
DCHECK(!app_id_after.empty()); |
- app_ids_after.push_back(app_id_after); |
+ app_launcher_ids_after.push_back( |
+ ash::launcher::AppLauncherId(app_id_after)); |
} |
} |
- ash::launcher::SetPinPosition(profile_, app_id, app_id_before, app_ids_after); |
+ ash::launcher::SetPinPosition(profile_, ash::launcher::AppLauncherId(app_id), |
+ ash::launcher::AppLauncherId(app_id_before), |
+ app_launcher_ids_after); |
} |
void ChromeLauncherControllerImpl::OnSyncModelUpdated() { |
@@ -1220,7 +1225,7 @@ void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() { |
// into the pref state. Therefore we tell |persistPinnedState| to ignore any |
// invocations while we are running. |
base::AutoReset<bool> auto_reset(&ignore_persist_pinned_state_change_, true); |
- const std::vector<std::string> pinned_apps = |
+ const std::vector<ash::launcher::AppLauncherId> pinned_apps = |
ash::launcher::GetPinnedAppsFromPrefs(profile_->GetPrefs(), |
launcher_controller_helper_.get()); |
@@ -1232,16 +1237,17 @@ void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() { |
// Apply pins in two steps. At the first step, go through the list of apps to |
// pin, move existing pin to current position specified by |index| or create |
// the new pin at that position. |
- for (const auto& pref_app_id : pinned_apps) { |
+ for (const auto& pref_app_launcher_id : pinned_apps) { |
// Filter out apps that may be mapped wrongly. |
// TODO(khmel): b/31703859 is to refactore shelf mapping. |
+ const std::string launcher_id = pref_app_launcher_id.GetAsString(); |
const std::string shelf_app_id = |
- ArcAppWindowLauncherController::GetShelfAppIdFromArcAppId(pref_app_id); |
- if (shelf_app_id != pref_app_id) |
+ ArcAppWindowLauncherController::GetShelfAppIdFromArcAppId(launcher_id); |
+ if (shelf_app_id != launcher_id) |
continue; |
// Update apps icon if applicable. |
- OnAppUpdated(profile_, pref_app_id); |
+ OnAppUpdated(profile_, launcher_id); |
// Find existing pin or app from the right of current |index|. |
int app_index = index; |
@@ -1250,7 +1256,7 @@ void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() { |
const IDToItemControllerMap::iterator it = |
id_to_item_controller_map_.find(item.id); |
if (it != id_to_item_controller_map_.end() && |
- it->second->app_id() == pref_app_id) { |
+ it->second->app_id() == launcher_id) { |
break; |
} |
} |
@@ -1267,8 +1273,8 @@ void ChromeLauncherControllerImpl::UpdateAppLaunchersFromPref() { |
DCHECK_EQ(model_->ItemIndexByID(item.id), index); |
} else { |
// This is fresh pin. Create new one. |
- DCHECK_NE(pref_app_id, extension_misc::kChromeAppId); |
- CreateAppShortcutLauncherItem(pref_app_id, index); |
+ DCHECK_NE(launcher_id, extension_misc::kChromeAppId); |
+ CreateAppShortcutLauncherItem(launcher_id, index); |
} |
++index; |
} |