Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_utils.cc

Issue 2529783002: arc: Implement uninstall confirmation dialog for Arc app. (Closed)
Patch Set: Address minor comments. Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 16 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
16 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" 17 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h"
17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
18 #include "chromeos/dbus/dbus_thread_manager.h" 19 #include "chromeos/dbus/dbus_thread_manager.h"
19 #include "chromeos/dbus/session_manager_client.h" 20 #include "chromeos/dbus/session_manager_client.h"
20 #include "components/arc/arc_bridge_service.h" 21 #include "components/arc/arc_bridge_service.h"
21 #include "components/arc/common/intent_helper.mojom.h" 22 #include "components/arc/common/intent_helper.mojom.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
23 #include "ui/display/display.h" 24 #include "ui/display/display.h"
24 #include "ui/display/screen.h" 25 #include "ui/display/screen.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 VLOG(2) << "Uninstalling " << package_name; 386 VLOG(2) << "Uninstalling " << package_name;
386 387
387 arc::mojom::AppInstance* app_instance = 388 arc::mojom::AppInstance* app_instance =
388 GetAppInstance(kUninstallPackageMinVersion, kUninstallPackageStr); 389 GetAppInstance(kUninstallPackageMinVersion, kUninstallPackageStr);
389 if (!app_instance) 390 if (!app_instance)
390 return; 391 return;
391 392
392 app_instance->UninstallPackage(package_name); 393 app_instance->UninstallPackage(package_name);
393 } 394 }
394 395
396 void UninstallArcApp(const std::string& app_id, Profile* profile) {
397 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile);
398 DCHECK(arc_prefs);
399 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
400 arc_prefs->GetApp(app_id);
401 if (!app_info) {
402 VLOG(2) << "Package being uninstalled does not exist: " << app_id << ".";
403 return;
404 }
405 // For shortcut we just remove the shortcut instead of the package.
406 if (app_info->shortcut)
407 arc_prefs->RemoveApp(app_id);
408 else
409 UninstallPackage(app_info->package_name);
410 }
411
395 void RemoveCachedIcon(const std::string& icon_resource_id) { 412 void RemoveCachedIcon(const std::string& icon_resource_id) {
396 VLOG(2) << "Removing icon " << icon_resource_id; 413 VLOG(2) << "Removing icon " << icon_resource_id;
397 414
398 arc::mojom::AppInstance* app_instance = 415 arc::mojom::AppInstance* app_instance =
399 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr); 416 GetAppInstance(kRemoveIconMinVersion, kRemoveIconStr);
400 if (!app_instance) 417 if (!app_instance)
401 return; 418 return;
402 419
403 app_instance->RemoveCachedIcon(icon_resource_id); 420 app_instance->RemoveCachedIcon(icon_resource_id);
404 } 421 }
(...skipping 21 matching lines...) Expand all
426 if (!app_instance) 443 if (!app_instance)
427 return false; 444 return false;
428 445
429 app_instance->ShowPackageInfoOnPage( 446 app_instance->ShowPackageInfoOnPage(
430 package_name, page, 447 package_name, page,
431 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); 448 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height)));
432 return true; 449 return true;
433 } 450 }
434 451
435 } // namespace arc 452 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_utils.h ('k') | chrome/browser/ui/views/arc_app_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698