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,10 +209,18 @@ 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()) {
cache_.ForOneApp(app_id, [this](const apps::AppUpdate& update) {
app_service_->PromptUninstall(update.AppType(), update.AppId());
cache_.ForOneApp(
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 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h"
#if defined(OS_CHROMEOS)
......@@ -77,7 +78,7 @@ class AppServiceProxy : public KeyedService,
int64_t display_id);
void SetPermission(const std::string& app_id,
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,
const std::string& app_id,
bool uninstall,
......
......@@ -71,7 +71,7 @@ void ArcLauncherContextMenu::ExecuteCommand(int command_id, int event_flags) {
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(controller()->profile());
DCHECK(proxy);
proxy->Uninstall(item().id.app_id);
proxy->Uninstall(item().id.app_id, nullptr /* parent_window */);
return;
}
......
......@@ -33,17 +33,11 @@
namespace {
void UninstallApp(Profile* profile, const std::string& app_id) {
if (base::FeatureList::IsEnabled(features::kAppServiceShelf)) {
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile);
DCHECK(proxy);
proxy->Uninstall(app_id);
proxy->Uninstall(app_id, nullptr /* parent_window */);
return;
}
// ExtensionUninstall deletes itself when done or aborted.
ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile, app_id);
uninstaller->Run();
}
} // namespace
......
......@@ -104,7 +104,7 @@ void WebAppUiManagerImpl::UninstallAndReplace(
if (apps::AppServiceProxyFactory::IsEnabled()) {
apps::AppServiceProxy* proxy =
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) {
if (!proxy)
return;
proxy->Uninstall(app_id);
proxy->Uninstall(app_id, nullptr /* parent_window */);
}
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