Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h" |
| 6 | 6 |
| 7 LauncherArcAppUpdater::LauncherArcAppUpdater( | 7 LauncherArcAppUpdater::LauncherArcAppUpdater( |
| 8 Delegate* delegate, | 8 Delegate* delegate, |
| 9 content::BrowserContext* browser_context) | 9 content::BrowserContext* browser_context) |
| 10 : LauncherAppUpdater(delegate, browser_context) { | 10 : LauncherAppUpdater(delegate, browser_context) { |
| 11 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context); | 11 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context); |
| 12 DCHECK(prefs); | 12 DCHECK(prefs); |
| 13 prefs->AddObserver(this); | 13 prefs->AddObserver(this); |
| 14 } | 14 } |
| 15 | 15 |
| 16 LauncherArcAppUpdater::~LauncherArcAppUpdater() { | 16 LauncherArcAppUpdater::~LauncherArcAppUpdater() { |
| 17 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context()); | 17 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context()); |
| 18 DCHECK(prefs); | 18 DCHECK(prefs); |
| 19 prefs->RemoveObserver(this); | 19 prefs->RemoveObserver(this); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void LauncherArcAppUpdater::OnAppRegistered( | 22 void LauncherArcAppUpdater::OnAppRegistered( |
| 23 const std::string& app_id, | 23 const std::string& app_id, |
| 24 const ArcAppListPrefs::AppInfo& app_info) { | 24 const ArcAppListPrefs::AppInfo& app_info) { |
| 25 delegate()->OnAppInstalled(browser_context(), app_id); | 25 delegate()->OnAppInstalled(browser_context(), app_id); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void LauncherArcAppUpdater::OnAppRemoved(const std::string& app_id) { | 28 void LauncherArcAppUpdater::OnAppRemoved(const std::string& app_id) { |
| 29 // When disabling ARC, apps are removed, but sync items should not be deleted. | |
|
James Cook
2017/03/29 14:28:02
I suggest explaining why the items should not be d
msw
2017/03/29 21:34:17
Done.
| |
| 30 // Notify the delegate that the app is being disabled, and shelf item removal | |
| 31 // should not trigger pin position removal from the sync model. When app | |
| 32 // removal should be synced, AppListModelBuilder::RemoveApp will call | |
| 33 // AppListSyncableService::RemoveUninstalledItem and trigger RemoveSyncItem. | |
| 34 delegate()->OnAppDisabling(app_id); | |
| 29 delegate()->OnAppUninstalledPrepared(browser_context(), app_id); | 35 delegate()->OnAppUninstalledPrepared(browser_context(), app_id); |
| 30 delegate()->OnAppUninstalled(browser_context(), app_id); | 36 delegate()->OnAppUninstalled(browser_context(), app_id); |
| 37 delegate()->OnAppDisabled(app_id); | |
|
James Cook
2017/03/29 14:28:03
It seems like these OnAppDisabling() etc. function
msw
2017/03/29 21:34:17
Good call! Changed this to directly call into Chro
| |
| 31 } | 38 } |
| OLD | NEW |