Commit 0fceabe7 authored by Renee Wright's avatar Renee Wright Committed by Commit Bot

Change Crostini Settings uninstall flow to use view dialog

and remove the old Polymer dialogue

Bug: 822504
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I30bf627099d257363bb4cd8177c07fbd147974ec
Reviewed-on: https://chromium-review.googlesource.com/1037043
Commit-Queue: Renée Wright <rjwright@chromium.org>
Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556735}
parent 93eb26e6
...@@ -413,21 +413,6 @@ ...@@ -413,21 +413,6 @@
<message name="IDS_SETTINGS_CROSTINI_REMOVE" desc="Label for the row to open a dialog confirming removal of Crostini."> <message name="IDS_SETTINGS_CROSTINI_REMOVE" desc="Label for the row to open a dialog confirming removal of Crostini.">
Remove Linux Apps for Chromebook Remove Linux Apps for Chromebook
</message> </message>
<message name="IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_TITLE" desc="Title of the confirmation dialog for removal of Crostini.">
Remove Linux Apps
</message>
<message name="IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_MESSAGE_DELETE_APPS" desc="Describes what will happen if the user opts out of Crostini.">
Linux apps you've installed will be deleted from this Chromebook.
</message>
<message name="IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_MESSAGE_DELETE_SHARED_FILES" desc="Describes what will happen if the user opts out of Crostini.">
Files shared with Linux apps may also be deleted.
</message>
<message name="IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_MESSAGE_OTHER_DEVICES_UNAFFECTED" desc="Describes what will happen if the user opts out of Crostini.">
This doesn't affect apps or content on other devices.
</message>
<message name="IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_ACCEPT" desc="Label for confirmation button in the remove Crostini dialog.">
Remove Linux Apps
</message>
<!-- Android Apps Page --> <!-- Android Apps Page -->
<message name="IDS_SETTINGS_ANDROID_APPS_TITLE" desc="The title of Google Play Store (Arc++ / Android Apps) section."> <message name="IDS_SETTINGS_ANDROID_APPS_TITLE" desc="The title of Google Play Store (Arc++ / Android Apps) section.">
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner-lite.html">
<link rel="import" href="crostini_browser_proxy.html"> <link rel="import" href="crostini_browser_proxy.html">
<link rel="import" href="../i18n_setup.html"> <link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html"> <link rel="import" href="../prefs/prefs_behavior.html">
...@@ -10,11 +9,7 @@ ...@@ -10,11 +9,7 @@
<dom-module id="settings-crostini-subpage"> <dom-module id="settings-crostini-subpage">
<template> <template>
<style include="settings-shared"> <style include="settings-shared"></style>
paper-spinner-lite {
margin: 0 8px;
}
</style>
<div id="remove" class="settings-box first" <div id="remove" class="settings-box first"
actionable on-click="onRemoveTap_"> actionable on-click="onRemoveTap_">
<div class="start">$i18n{crostiniRemove}</div> <div class="start">$i18n{crostiniRemove}</div>
...@@ -22,35 +17,6 @@ ...@@ -22,35 +17,6 @@
<button aria-label="$i18n{crostiniRemove}"></button> <button aria-label="$i18n{crostiniRemove}"></button>
</paper-icon-button-light> </paper-icon-button-light>
</div> </div>
<!-- Confirm remove Crostini dialog -->
<template is="dom-if" if="[[showRemoveDialog_]]" restamp>
<cr-dialog id="removeDialog" close-text="$i18n{close}"
on-cancel="onRemoveDialogCancel_"
on-close="onRemoveDialogClose_">
<div slot="title">$i18n{crostiniRemoveDialogTitle}</div>
<div slot="body">
<p>$i18n{crostiniRemoveDialogMessageDeleteApps}</p>
<p>$i18n{crostiniRemoveDialogMessageDeleteSharedFiles}</p>
<div>$i18n{crostiniRemoveDialogMessageOtherDevicesUnaffected}</div>
</div>
<div slot="button-container">
<paper-spinner-lite id="removeSpinner"
hidden="[[!removingInProgress_]]"
active="[[removingInProgress_]]">
</paper-spinner-lite>
<paper-button id="cancelButton" class="cancel-button"
on-click="onRemoveDialogCancel_">
[[cancelButtonText_]]
</paper-button>
<paper-button class="action-button" disabled="[[removingInProgress_]]"
on-click="onRemoveDialogAccept_">
$i18n{crostiniRemoveDialogAccept}
</paper-button>
</div>
</cr-dialog>
</template>
</template> </template>
<script src="crostini_subpage.js"></script> <script src="crostini_subpage.js"></script>
</dom-module> </dom-module>
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
Polymer({ Polymer({
is: 'settings-crostini-subpage', is: 'settings-crostini-subpage',
behaviors: [I18nBehavior, PrefsBehavior], behaviors: [PrefsBehavior],
properties: { properties: {
/** Preferences state. */ /** Preferences state. */
...@@ -18,35 +18,12 @@ Polymer({ ...@@ -18,35 +18,12 @@ Polymer({
type: Object, type: Object,
notify: true, notify: true,
}, },
/** @private */
showRemoveDialog_: {
type: Boolean,
value: false,
},
/** @private */
removingInProgress_: Boolean,
/** @private */
cancelButtonText_: {
type: String,
computed: 'computeCancelButtonText_(removingInProgress_)',
},
}, },
observers: ['onCrostiniEnabledChanged_(prefs.crostini.enabled.value)'], observers: ['onCrostiniEnabledChanged_(prefs.crostini.enabled.value)'],
/** @private */
computeCancelButtonText_() {
return this.i18n(this.removingInProgress_ ? 'close' : 'cancel');
},
/** @private */ /** @private */
onCrostiniEnabledChanged_: function(enabled) { onCrostiniEnabledChanged_: function(enabled) {
if (this.$$('#removeDialog'))
this.$$('#removeDialog').close();
this.removingInProgress_ = false;
if (!enabled && if (!enabled &&
settings.getCurrentRoute() == settings.routes.CROSTINI_DETAILS) { settings.getCurrentRoute() == settings.routes.CROSTINI_DETAILS) {
settings.navigateToPreviousRoute(); settings.navigateToPreviousRoute();
...@@ -59,35 +36,6 @@ Polymer({ ...@@ -59,35 +36,6 @@ Polymer({
* @private * @private
*/ */
onRemoveTap_: function(event) { onRemoveTap_: function(event) {
this.showRemoveDialog_ = true;
this.async(() => this.$$('#removeDialog').showModal());
},
/**
* Handles the remove confirmation dialog 'Confirm' button.
* @private
*/
onRemoveDialogAccept_: function() {
settings.CrostiniBrowserProxyImpl.getInstance().requestRemoveCrostini(); settings.CrostiniBrowserProxyImpl.getInstance().requestRemoveCrostini();
this.removingInProgress_ = true;
// Sub-page will be closed in onCrostiniEnabledChanged_ call.
},
// TODO(rjwright): Make this actually cancel the uninstall.
/**
* Handles the remove confirmation dialog 'Cancel' button or a cancel
* event.
* @private
*/
onRemoveDialogCancel_: function() {
this.$$('#removeDialog').close();
},
/**
* Handles the remove confirmation dialog close event.
* @private
*/
onRemoveDialogClose_: function() {
this.showRemoveDialog_ = false;
}, },
}); });
...@@ -38,10 +38,7 @@ void CrostiniHandler::HandleRequestCrostiniInstallerView( ...@@ -38,10 +38,7 @@ void CrostiniHandler::HandleRequestCrostiniInstallerView(
void CrostiniHandler::HandleRequestRemoveCrostini(const base::ListValue* args) { void CrostiniHandler::HandleRequestRemoveCrostini(const base::ListValue* args) {
AllowJavascript(); AllowJavascript();
// TODO(nverne): change this to use CrostiniUninstallerView::Show CrostiniUninstallerView::Show(Profile::FromWebUI(web_ui()));
crostini::CrostiniManager::GetInstance()->RemoveCrostini(
Profile::FromWebUI(web_ui()), kCrostiniDefaultVmName,
kCrostiniDefaultContainerName, base::DoNothing());
} }
} // namespace settings } // namespace settings
......
...@@ -380,15 +380,6 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source) { ...@@ -380,15 +380,6 @@ void AddCrostiniStrings(content::WebUIDataSource* html_source) {
{"crostiniPageLabel", IDS_SETTINGS_CROSTINI_LABEL}, {"crostiniPageLabel", IDS_SETTINGS_CROSTINI_LABEL},
{"crostiniEnable", IDS_SETTINGS_TURN_ON}, {"crostiniEnable", IDS_SETTINGS_TURN_ON},
{"crostiniRemove", IDS_SETTINGS_CROSTINI_REMOVE}, {"crostiniRemove", IDS_SETTINGS_CROSTINI_REMOVE},
{"crostiniRemoveDialogTitle", IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_TITLE},
{"crostiniRemoveDialogMessageDeleteApps",
IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_MESSAGE_DELETE_APPS},
{"crostiniRemoveDialogMessageDeleteSharedFiles",
IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_MESSAGE_DELETE_SHARED_FILES},
{"crostiniRemoveDialogMessageOtherDevicesUnaffected",
IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_MESSAGE_OTHER_DEVICES_UNAFFECTED},
{"crostiniRemoveDialogAccept",
IDS_SETTINGS_CROSTINI_REMOVE_DIALOG_ACCEPT},
}; };
AddLocalizedStringsBulk(html_source, localized_strings, AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings)); arraysize(localized_strings));
......
...@@ -85,7 +85,8 @@ suite('CrostiniPageTests', function() { ...@@ -85,7 +85,8 @@ suite('CrostiniPageTests', function() {
}); });
test('Remove', function() { test('Remove', function() {
subpage.onRemoveDialogAccept_(); assertTrue(!!subpage.$$('.subpage-arrow'));
MockInteractions.tap(subpage.$$('.subpage-arrow'));
setCrostiniEnabledValue( setCrostiniEnabledValue(
crostiniBrowserProxy.prefs.crostini.enabled.value); crostiniBrowserProxy.prefs.crostini.enabled.value);
assertFalse(crostiniPage.prefs.crostini.enabled.value); assertFalse(crostiniPage.prefs.crostini.enabled.value);
......
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