Commit 32656fc0 authored by nancy's avatar nancy Committed by Commit Bot

Enable the new unified uninstall dialog.

BUG=1009248
TBR=xiyuan@chromium.org

Change-Id: Id3e58d5672a33eea47df518c97a56d35527c1683
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872074
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708495}
parent 4b3eb932
...@@ -209,11 +209,19 @@ void AppServiceProxy::SetPermission(const std::string& app_id, ...@@ -209,11 +209,19 @@ void AppServiceProxy::SetPermission(const std::string& app_id,
} }
} }
void AppServiceProxy::Uninstall(const std::string& app_id) { void AppServiceProxy::Uninstall(const std::string& app_id,
gfx::NativeWindow parent_window) {
if (app_service_.is_connected()) { if (app_service_.is_connected()) {
cache_.ForOneApp(app_id, [this](const apps::AppUpdate& update) { cache_.ForOneApp(
app_service_->PromptUninstall(update.AppType(), update.AppId()); app_id, [this, parent_window](const apps::AppUpdate& update) {
}); apps::mojom::IconKeyPtr icon_key = update.IconKey();
uninstall_dialogs_.emplace(std::make_unique<UninstallDialog>(
profile_, update.AppType(), update.AppId(), update.Name(),
std::move(icon_key), this, parent_window,
base::BindOnce(&AppServiceProxy::OnUninstallDialogClosed,
weak_ptr_factory_.GetWeakPtr(), update.AppType(),
update.AppId())));
});
} }
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -77,7 +78,7 @@ class AppServiceProxy : public KeyedService, ...@@ -77,7 +78,7 @@ class AppServiceProxy : public KeyedService,
int64_t display_id); int64_t display_id);
void SetPermission(const std::string& app_id, void SetPermission(const std::string& app_id,
apps::mojom::PermissionPtr permission); apps::mojom::PermissionPtr permission);
void Uninstall(const std::string& app_id); void Uninstall(const std::string& app_id, gfx::NativeWindow parent_window);
void OnUninstallDialogClosed(apps::mojom::AppType app_type, void OnUninstallDialogClosed(apps::mojom::AppType app_type,
const std::string& app_id, const std::string& app_id,
bool uninstall, bool uninstall,
......
...@@ -71,7 +71,7 @@ void ArcLauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { ...@@ -71,7 +71,7 @@ void ArcLauncherContextMenu::ExecuteCommand(int command_id, int event_flags) {
apps::AppServiceProxy* proxy = apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(controller()->profile()); apps::AppServiceProxyFactory::GetForProfile(controller()->profile());
DCHECK(proxy); DCHECK(proxy);
proxy->Uninstall(item().id.app_id); proxy->Uninstall(item().id.app_id, nullptr /* parent_window */);
return; return;
} }
......
...@@ -33,17 +33,11 @@ ...@@ -33,17 +33,11 @@
namespace { namespace {
void UninstallApp(Profile* profile, const std::string& app_id) { void UninstallApp(Profile* profile, const std::string& app_id) {
if (base::FeatureList::IsEnabled(features::kAppServiceShelf)) { apps::AppServiceProxy* proxy =
apps::AppServiceProxy* proxy = apps::AppServiceProxyFactory::GetForProfile(profile);
apps::AppServiceProxyFactory::GetForProfile(profile); DCHECK(proxy);
DCHECK(proxy); proxy->Uninstall(app_id, nullptr /* parent_window */);
proxy->Uninstall(app_id); return;
return;
}
// ExtensionUninstall deletes itself when done or aborted.
ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile, app_id);
uninstaller->Run();
} }
} // namespace } // namespace
......
...@@ -104,7 +104,7 @@ void WebAppUiManagerImpl::UninstallAndReplace( ...@@ -104,7 +104,7 @@ void WebAppUiManagerImpl::UninstallAndReplace(
if (apps::AppServiceProxyFactory::IsEnabled()) { if (apps::AppServiceProxyFactory::IsEnabled()) {
apps::AppServiceProxy* proxy = apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile_); apps::AppServiceProxyFactory::GetForProfile(profile_);
proxy->Uninstall(from_app); proxy->Uninstall(from_app, nullptr /* parent_window */);
} }
} }
} }
......
...@@ -210,7 +210,7 @@ void AppManagementPageHandler::Uninstall(const std::string& app_id) { ...@@ -210,7 +210,7 @@ void AppManagementPageHandler::Uninstall(const std::string& app_id) {
if (!proxy) if (!proxy)
return; return;
proxy->Uninstall(app_id); proxy->Uninstall(app_id, nullptr /* parent_window */);
} }
void AppManagementPageHandler::OpenNativeSettings(const std::string& app_id) { void AppManagementPageHandler::OpenNativeSettings(const std::string& app_id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment