| 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" |
| 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 // For shortcut we just remove the shortcut instead of the package. |
| 353 if (app_info->shortcut) |
| 354 arc_prefs->RemoveApp(app_id); |
| 355 else |
| 356 UninstallPackage(app_info->package_name); |
| 357 } |
| 358 |
| 342 void RemoveCachedIcon(const std::string& icon_resource_id) { | 359 void RemoveCachedIcon(const std::string& icon_resource_id) { |
| 343 VLOG(2) << "Removing icon " << icon_resource_id; | 360 VLOG(2) << "Removing icon " << icon_resource_id; |
| 344 | 361 |
| 345 arc::mojom::AppInstance* app_instance = | 362 arc::mojom::AppInstance* app_instance = |
| 346 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr); | 363 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr); |
| 347 if (!app_instance) | 364 if (!app_instance) |
| 348 return; | 365 return; |
| 349 | 366 |
| 350 app_instance->RemoveCachedIcon(icon_resource_id); | 367 app_instance->RemoveCachedIcon(icon_resource_id); |
| 351 } | 368 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 373 if (!app_instance) | 390 if (!app_instance) |
| 374 return false; | 391 return false; |
| 375 | 392 |
| 376 app_instance->ShowPackageInfoOnPage( | 393 app_instance->ShowPackageInfoOnPage( |
| 377 package_name, page, | 394 package_name, page, |
| 378 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); | 395 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); |
| 379 return true; | 396 return true; |
| 380 } | 397 } |
| 381 | 398 |
| 382 } // namespace arc | 399 } // namespace arc |
| OLD | NEW |