Chromium Code Reviews| Index: chrome/browser/ui/app_list/arc/arc_app_utils.cc |
| diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
| index a120f6474a876159f94a80c28195ebb249bf404c..378b60a9abf3bfd0b4313382250168ff48e3acfa 100644 |
| --- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
| +++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
| @@ -10,6 +10,7 @@ |
| #include "ash/shell.h" |
| #include "base/bind.h" |
| #include "base/synchronization/waitable_event.h" |
| +#include "chrome/browser/profiles/profile.h" |
|
msw
2016/11/29 20:47:36
optional nit: this probably isn't needed (forward
lgcheng
2016/11/30 19:28:46
It seems I need this header file.
static ArcAppLi
msw
2016/11/30 23:26:57
Acknowledged.
|
| #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| @@ -339,6 +340,23 @@ void UninstallPackage(const std::string& package_name) { |
| app_instance->UninstallPackage(package_name); |
| } |
| +void UninstallArcApp(const std::string& app_id, Profile* profile) { |
| + ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile); |
| + DCHECK(arc_prefs); |
| + std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| + arc_prefs->GetApp(app_id); |
| + if (!app_info) { |
| + VLOG(2) << "Package being uninstalled does not exist: " << app_id << "."; |
| + return; |
| + } |
| + if (app_info->shortcut) { |
| + // for shortcut we just remove the shortcut instead of the package |
|
msw
2016/11/29 20:47:36
nit: trailing period; optionally move above condit
lgcheng
2016/11/30 19:28:46
Done.
|
| + arc_prefs->RemoveApp(app_id); |
| + } else { |
| + UninstallPackage(app_info->package_name); |
| + } |
| +} |
| + |
| void RemoveCachedIcon(const std::string& icon_resource_id) { |
| VLOG(2) << "Removing icon " << icon_resource_id; |