Commit 7d3bdb1c authored by nancy's avatar nancy Committed by Commit Bot

Remove ARC uninstall dialog.

AppUninstallDialogView replaced the ARC uninstall dialog.
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/apps/app_uninstall_dialog_view.h?l=44

Remove ARC uninstall dialog to prepare for "Uninstall" dialog language
consistency. Because some variables are used by ARC uninstall dialog,
e.g. IDS_APP_UNINSTALL_PROMPT_TITLE, and those variable can be re-used
for the AppUninstallDialogView.

BUG=1010303

Change-Id: I8af8feb2dfaed62ce5a9ee3c87a490d0af1ff469
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2073179Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744884}
parent e8704be0
......@@ -9,20 +9,12 @@
#include "base/callback.h"
class AppListControllerDelegate;
class Profile;
namespace arc {
using ArcUsbConfirmCallback = base::OnceCallback<void(bool)>;
// Shows a dialog for user to confirm uninstallation of ARC app.
// Currently, ARC app can only be manually uninstalled from AppList. But it
// would be simple to enable the dialog to shown from other source.
void ShowArcAppUninstallDialog(Profile* profile,
AppListControllerDelegate* controller,
const std::string& app_id);
// Shows permission request dialog for scan USB device list.
void ShowUsbScanDeviceListPermissionDialog(Profile* profile,
const std::string& app_id,
......
......@@ -214,11 +214,6 @@ void ArcAppDialogView::OnAppImageUpdated(const std::string& app_id,
icon_view_->SetImage(image);
}
void HandleArcAppUninstall(base::OnceClosure closure, bool accept) {
if (accept)
std::move(closure).Run();
}
std::unique_ptr<ArcAppListPrefs::AppInfo> GetArcAppInfo(
Profile* profile,
const std::string& app_id) {
......@@ -229,42 +224,6 @@ std::unique_ptr<ArcAppListPrefs::AppInfo> GetArcAppInfo(
} // namespace
void ShowArcAppUninstallDialog(Profile* profile,
AppListControllerDelegate* controller,
const std::string& app_id) {
std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
GetArcAppInfo(profile, app_id);
if (!app_info)
return;
bool is_shortcut = app_info->shortcut;
base::string16 window_title = l10n_util::GetStringUTF16(
is_shortcut ? IDS_EXTENSION_UNINSTALL_PROMPT_TITLE
: IDS_APP_UNINSTALL_PROMPT_TITLE);
base::string16 heading_text = base::UTF8ToUTF16(l10n_util::GetStringFUTF8(
is_shortcut ? IDS_EXTENSION_UNINSTALL_PROMPT_HEADING
: IDS_NON_PLATFORM_APP_UNINSTALL_PROMPT_HEADING,
base::UTF8ToUTF16(app_info->name)));
base::string16 subheading_text;
if (!is_shortcut) {
subheading_text = l10n_util::GetStringUTF16(
IDS_ARC_APP_UNINSTALL_PROMPT_DATA_REMOVAL_WARNING);
}
base::string16 confirm_button_text = l10n_util::GetStringUTF16(
is_shortcut ? IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON
: IDS_EXTENSION_PROMPT_UNINSTALL_APP_BUTTON);
base::string16 cancel_button_text = l10n_util::GetStringUTF16(IDS_CANCEL);
new ArcAppDialogView(
profile, controller, app_id, window_title, heading_text, subheading_text,
confirm_button_text, cancel_button_text,
base::BindOnce(HandleArcAppUninstall,
base::BindOnce(UninstallArcApp, app_id, profile)));
}
void ShowUsbScanDeviceListPermissionDialog(Profile* profile,
const std::string& app_id,
ArcUsbConfirmCallback callback) {
......
......@@ -396,73 +396,4 @@ IN_PROC_BROWSER_TEST_F(ArcAppPermissionDialogViewBrowserTest,
package1, guid(), serial_number(), vendor_id(), product_id()));
}
// User confirms/cancels ARC app uninstall. Note that the shortcut is removed
// when the app and the package are uninstalled since the shortcut and the app
// share same package.
IN_PROC_BROWSER_TEST_F(ArcAppUninstallDialogViewBrowserTest,
UserConfirmsUninstall) {
EXPECT_EQ(2u, arc_app_list_pref()->GetAppIds().size());
std::string package_name = "fake.package.0";
std::string app_activity = "fake.app.0.activity";
std::string app_id =
arc_app_list_pref()->GetAppId(package_name, app_activity);
AppListClientImpl* controller = AppListClientImpl::GetInstance();
EXPECT_FALSE(controller->app_list_visible());
controller->ShowAppList();
EXPECT_TRUE(controller->app_list_visible());
ShowArcAppUninstallDialog(browser()->profile(), controller, app_id);
EXPECT_TRUE(controller->app_list_visible());
EXPECT_TRUE(IsArcAppDialogViewAliveForTest());
// Cancelling the dialog won't uninstall any app.
EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(false));
content::RunAllPendingInMessageLoop();
EXPECT_EQ(2u, arc_app_list_pref()->GetAppIds().size());
EXPECT_TRUE(controller->app_list_visible());
ShowArcAppUninstallDialog(browser()->profile(), controller, app_id);
content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsArcAppDialogViewAliveForTest());
EXPECT_TRUE(controller->app_list_visible());
// Accepting the dialog should work now.
EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true));
content::RunAllPendingInMessageLoop();
EXPECT_EQ(0u, arc_app_list_pref()->GetAppIds().size());
EXPECT_TRUE(controller->app_list_visible());
}
// User confirms/cancels ARC app shortcut removal. Note that the app is not
// uninstalled when the shortcut is removed.
IN_PROC_BROWSER_TEST_F(ArcAppUninstallDialogViewBrowserTest,
UserConfirmsUninstallShortcut) {
EXPECT_EQ(2u, arc_app_list_pref()->GetAppIds().size());
std::string package_name = "fake.package.0";
std::string intent_uri = "Fake Shortcut uri 0";
std::string app_id = arc_app_list_pref()->GetAppId(package_name, intent_uri);
AppListClientImpl* controller = AppListClientImpl::GetInstance();
controller->ShowAppList();
ShowArcAppUninstallDialog(browser()->profile(), controller, app_id);
EXPECT_TRUE(IsArcAppDialogViewAliveForTest());
// Cancelling the dialog won't uninstall any app.
EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(false));
content::RunAllPendingInMessageLoop();
EXPECT_EQ(2u, arc_app_list_pref()->GetAppIds().size());
ShowArcAppUninstallDialog(browser()->profile(), controller, app_id);
content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsArcAppDialogViewAliveForTest());
// Accepting the dialog should uninstall the shortcut only.
EXPECT_TRUE(CloseAppDialogViewAndConfirmForTest(true));
content::RunAllPendingInMessageLoop();
EXPECT_EQ(1u, arc_app_list_pref()->GetAppIds().size());
EXPECT_TRUE(controller->app_list_visible());
}
} // namespace arc
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