diff --git a/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html b/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html index edde59f054f9..bcbf08d172af 100644 --- a/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html +++ b/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.html @@ -86,9 +86,9 @@ on-setup-exited="onExitRequested_" forward-button-text="{{forwardButtonText_}}" forward-button-disabled="{{forwardButtonDisabled_}}" - backward-button-text="{{backwardButtonText_}}"> - -
[[backwardButtonText_]]
+ cancel-button-text="{{cancelButtonText_}}"> + +
[[cancelButtonText_]]
diff --git a/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.js b/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.js index ddce54e2eae5..796e5f049003 100644 --- a/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.js +++ b/chrome/browser/resources/chromeos/login/multidevice_setup_first_run.js @@ -75,10 +75,10 @@ cr.define('multidevice_setup', function() { }, /** - * Text to be shown on the backward navigation button. + * Text to be shown on the cancel button. * @private {string|undefined} */ - backwardButtonText_: { + cancelButtonText_: { type: String, value: '', }, diff --git a/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_post_oobe.html b/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_post_oobe.html index f015be100893..54c05e36d39f 100644 --- a/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_post_oobe.html +++ b/chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_post_oobe.html @@ -9,6 +9,7 @@ diff --git a/ui/webui/resources/cr_components/chromeos/multidevice_setup/multidevice_setup.js b/ui/webui/resources/cr_components/chromeos/multidevice_setup/multidevice_setup.js index 18539d64e51a..3dc0dd457d89 100644 --- a/ui/webui/resources/cr_components/chromeos/multidevice_setup/multidevice_setup.js +++ b/ui/webui/resources/cr_components/chromeos/multidevice_setup/multidevice_setup.js @@ -45,6 +45,16 @@ cr.define('multidevice_setup', function() { notify: true }, + /** + * Text to be shown on the cancel button. + * @type {string|undefined} + */ + cancelButtonText: { + type: String, + computed: 'getCancelButtonText_(visiblePage_)', + notify: true, + }, + /** * Text to be shown on the backward navigation button. * @type {string|undefined} @@ -63,7 +73,7 @@ cr.define('multidevice_setup', function() { visiblePageName_: { type: String, value: PageName.START, - notify: true, // For testing purporses only. + notify: true, // For testing purposes only. }, /** @@ -116,6 +126,7 @@ cr.define('multidevice_setup', function() { listeners: { 'backward-navigation-requested': 'onBackwardNavigationRequested_', + 'cancel-requested': 'onCancelRequested_', 'forward-navigation-requested': 'onForwardNavigationRequested_', }, @@ -149,12 +160,24 @@ cr.define('multidevice_setup', function() { }, /** @private */ - onBackwardNavigationRequested_: function() { + onCancelRequested_: function() { this.exitSetupFlow_(); }, + /** @private */ + onBackwardNavigationRequested_: function() { + // The back button is only visible on the password page. + assert(this.visiblePageName_ == PageName.PASSWORD); + + this.$$('password-page').clearPasswordTextInput(); + this.visiblePageName_ = PageName.START; + }, + /** @private */ onForwardNavigationRequested_: function() { + if (this.forwardButtonDisabled) + return; + this.visiblePage_.getCanNavigateToNextPage().then((canNavigate) => { if (!canNavigate) return; @@ -235,6 +258,17 @@ cr.define('multidevice_setup', function() { this.passwordPageForwardButtonDisabled_; }, + /** + * @return {string|undefined} The cancel button text, which is undefined + * if no button should be displayed. + * @private + */ + getCancelButtonText_: function() { + if (!this.visiblePage_) + return undefined; + return this.visiblePage_.cancelButtonText; + }, + /** * @return {string|undefined} The backward button text, which is undefined * if no button should be displayed. @@ -244,7 +278,6 @@ cr.define('multidevice_setup', function() { if (!this.visiblePage_) return undefined; return this.visiblePage_.backwardButtonText; - }, /** diff --git a/ui/webui/resources/cr_components/chromeos/multidevice_setup/password_page.js b/ui/webui/resources/cr_components/chromeos/multidevice_setup/password_page.js index d117ff6ac8bc..ba2abe0bf6f4 100644 --- a/ui/webui/resources/cr_components/chromeos/multidevice_setup/password_page.js +++ b/ui/webui/resources/cr_components/chromeos/multidevice_setup/password_page.js @@ -30,11 +30,17 @@ Polymer({ }, /** Overridden from UiPageContainerBehavior. */ - backwardButtonTextId: { + cancelButtonTextId: { type: String, value: 'cancel', }, + /** Overridden from UiPageContainerBehavior. */ + backwardButtonTextId: { + type: String, + value: 'back', + }, + /** Overridden from UiPageContainerBehavior. */ headerId: { type: String, diff --git a/ui/webui/resources/cr_components/chromeos/multidevice_setup/setup_failed_page.js b/ui/webui/resources/cr_components/chromeos/multidevice_setup/setup_failed_page.js index 34dd4ee9486f..36f2d4ae1174 100644 --- a/ui/webui/resources/cr_components/chromeos/multidevice_setup/setup_failed_page.js +++ b/ui/webui/resources/cr_components/chromeos/multidevice_setup/setup_failed_page.js @@ -13,11 +13,17 @@ Polymer({ }, /** Overridden from UiPageContainerBehavior. */ - backwardButtonTextId: { + cancelButtonTextId: { type: String, value: 'cancel', }, + /** Overridden from UiPageContainerBehavior. */ + backwardButtonTextId: { + type: String, + value: 'back', + }, + /** Overridden from UiPageContainerBehavior. */ headerId: { type: String, diff --git a/ui/webui/resources/cr_components/chromeos/multidevice_setup/start_setup_page.js b/ui/webui/resources/cr_components/chromeos/multidevice_setup/start_setup_page.js index 85437ce3e14d..80cb12eac333 100644 --- a/ui/webui/resources/cr_components/chromeos/multidevice_setup/start_setup_page.js +++ b/ui/webui/resources/cr_components/chromeos/multidevice_setup/start_setup_page.js @@ -13,7 +13,7 @@ Polymer({ }, /** Overridden from UiPageContainerBehavior. */ - backwardButtonTextId: { + cancelButtonTextId: { type: String, value: 'cancel', }, diff --git a/ui/webui/resources/cr_components/chromeos/multidevice_setup/ui_page_container_behavior.js b/ui/webui/resources/cr_components/chromeos/multidevice_setup/ui_page_container_behavior.js index 1030cc90c7f9..e9f16b9ee895 100644 --- a/ui/webui/resources/cr_components/chromeos/multidevice_setup/ui_page_container_behavior.js +++ b/ui/webui/resources/cr_components/chromeos/multidevice_setup/ui_page_container_behavior.js @@ -14,6 +14,15 @@ const UiPageContainerBehaviorImpl = { */ forwardButtonTextId: String, + /** + * ID for cancel button label, which must be translated for display. + * + * Undefined if the visible page has no cancel button. + * + * @type {string|undefined} + */ + cancelButtonTextId: String, + /** * ID for backward button label, which must be translated for display. * @@ -49,6 +58,18 @@ const UiPageContainerBehaviorImpl = { computed: 'computeLocalizedText_(forwardButtonTextId)', }, + /** + * Translated text to display on the cancel button. + * + * Undefined if the visible page has no cancel button. + * + * @type {string|undefined} + */ + cancelButtonText: { + type: String, + computed: 'computeLocalizedText_(cancelButtonTextId)', + }, + /** * Translated text to display on the backward-naviation button. *