Chromium Code Reviews| 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 5eaee8fdf60c61d4d1b4ce6f51700dfdd90f9dc0..54fdfab0a86012a4f2ef98c4bfd330b9c8cf6686 100644 |
| --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
| +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc |
| @@ -383,10 +383,16 @@ void ChromeLauncherControllerImpl::Pin(ash::ShelfID id) { |
| } |
| void ChromeLauncherControllerImpl::Unpin(ash::ShelfID id) { |
| + UnpinAndSync(id, false); |
|
stevenjb
2016/08/31 21:10:49
This is a little dangerous, if we missed any Unpin
khmel
2016/09/01 00:03:02
Ops, misprint here and true should be used (it see
|
| +} |
| + |
| +void ChromeLauncherControllerImpl::UnpinAndSync(ash::ShelfID id, |
| + bool sync_change) { |
| LauncherItemController* controller = GetLauncherItemController(id); |
| CHECK(controller); |
| - ash::launcher::RemovePinPosition(profile_, GetAppIDForShelfID(id)); |
| + if (sync_change) |
| + ash::launcher::RemovePinPosition(profile_, GetAppIDForShelfID(id)); |
|
stevenjb
2016/08/31 21:10:49
This looks odd. It is not clear why |sync_change|
khmel
2016/09/01 00:03:03
I renamed this function and argument for better ex
|
| if (controller->type() == LauncherItemController::TYPE_APP || |
| controller->locked()) { |
| @@ -939,7 +945,7 @@ bool ChromeLauncherControllerImpl::IsAppPinned(const std::string& app_id) { |
| void ChromeLauncherControllerImpl::UnpinAppWithID(const std::string& app_id) { |
| if (GetPinnableForAppID(app_id, profile_) == |
| AppListControllerDelegate::PIN_EDITABLE) |
| - DoUnpinAppWithID(app_id); |
| + DoUnpinAppWithID(app_id, true); |
| else |
| NOTREACHED(); |
| } |
| @@ -981,7 +987,7 @@ void ChromeLauncherControllerImpl::OnAppUninstalledPrepared( |
| if (IsAppPinned(app_id)) { |
| if (profile == profile_) |
| - DoUnpinAppWithID(app_id); |
| + DoUnpinAppWithID(app_id, false); |
|
khmel
2016/08/31 20:31:48
It seems we can skip resetting pin position for un
stevenjb
2016/08/31 21:10:49
Can we add a comment to that effect here?
khmel
2016/09/01 00:03:02
Done.
|
| AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id); |
| if (app_icon_loader) |
| app_icon_loader->ClearImage(app_id); |
| @@ -1099,10 +1105,11 @@ void ChromeLauncherControllerImpl::DoPinAppWithID(const std::string& app_id) { |
| } |
| } |
| -void ChromeLauncherControllerImpl::DoUnpinAppWithID(const std::string& app_id) { |
| +void ChromeLauncherControllerImpl::DoUnpinAppWithID(const std::string& app_id, |
| + bool sync_change) { |
| ash::ShelfID shelf_id = GetShelfIDForAppID(app_id); |
| if (shelf_id && IsPinned(shelf_id)) |
| - Unpin(shelf_id); |
| + UnpinAndSync(shelf_id, sync_change); |
| } |
| int ChromeLauncherControllerImpl::PinRunningAppInternal(int index, |