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/app_list/arc/arc_app_utils.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 
| 6 | 6 | 
| 7 #include <memory> | 7 #include <memory> | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" | 
| 11 #include "base/bind.h" | 11 #include "base/bind.h" | 
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" | 
| 13 #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.
 
 | |
| 13 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 
| 14 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 15 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 
| 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 
| 16 #include "chromeos/dbus/dbus_thread_manager.h" | 17 #include "chromeos/dbus/dbus_thread_manager.h" | 
| 17 #include "chromeos/dbus/session_manager_client.h" | 18 #include "chromeos/dbus/session_manager_client.h" | 
| 18 #include "components/arc/arc_bridge_service.h" | 19 #include "components/arc/arc_bridge_service.h" | 
| 19 #include "components/arc/common/intent_helper.mojom.h" | 20 #include "components/arc/common/intent_helper.mojom.h" | 
| 20 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" | 
| 21 #include "ui/display/display.h" | 22 #include "ui/display/display.h" | 
| 22 #include "ui/display/screen.h" | 23 #include "ui/display/screen.h" | 
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 VLOG(2) << "Uninstalling " << package_name; | 333 VLOG(2) << "Uninstalling " << package_name; | 
| 333 | 334 | 
| 334 arc::mojom::AppInstance* app_instance = | 335 arc::mojom::AppInstance* app_instance = | 
| 335 GetAppInstance(kUninstallPackageMinVersion, kUninstallPackageStr); | 336 GetAppInstance(kUninstallPackageMinVersion, kUninstallPackageStr); | 
| 336 if (!app_instance) | 337 if (!app_instance) | 
| 337 return; | 338 return; | 
| 338 | 339 | 
| 339 app_instance->UninstallPackage(package_name); | 340 app_instance->UninstallPackage(package_name); | 
| 340 } | 341 } | 
| 341 | 342 | 
| 343 void UninstallArcApp(const std::string& app_id, Profile* profile) { | |
| 344 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile); | |
| 345 DCHECK(arc_prefs); | |
| 346 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | |
| 347 arc_prefs->GetApp(app_id); | |
| 348 if (!app_info) { | |
| 349 VLOG(2) << "Package being uninstalled does not exist: " << app_id << "."; | |
| 350 return; | |
| 351 } | |
| 352 if (app_info->shortcut) { | |
| 353 // 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.
 
 | |
| 354 arc_prefs->RemoveApp(app_id); | |
| 355 } else { | |
| 356 UninstallPackage(app_info->package_name); | |
| 357 } | |
| 358 } | |
| 359 | |
| 342 void RemoveCachedIcon(const std::string& icon_resource_id) { | 360 void RemoveCachedIcon(const std::string& icon_resource_id) { | 
| 343 VLOG(2) << "Removing icon " << icon_resource_id; | 361 VLOG(2) << "Removing icon " << icon_resource_id; | 
| 344 | 362 | 
| 345 arc::mojom::AppInstance* app_instance = | 363 arc::mojom::AppInstance* app_instance = | 
| 346 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr); | 364 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr); | 
| 347 if (!app_instance) | 365 if (!app_instance) | 
| 348 return; | 366 return; | 
| 349 | 367 | 
| 350 app_instance->RemoveCachedIcon(icon_resource_id); | 368 app_instance->RemoveCachedIcon(icon_resource_id); | 
| 351 } | 369 } | 
| (...skipping 21 matching lines...) Expand all Loading... | |
| 373 if (!app_instance) | 391 if (!app_instance) | 
| 374 return false; | 392 return false; | 
| 375 | 393 | 
| 376 app_instance->ShowPackageInfoOnPage( | 394 app_instance->ShowPackageInfoOnPage( | 
| 377 package_name, page, | 395 package_name, page, | 
| 378 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); | 396 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); | 
| 379 return true; | 397 return true; | 
| 380 } | 398 } | 
| 381 | 399 | 
| 382 } // namespace arc | 400 } // namespace arc | 
| OLD | NEW |