Commit 65e7664b authored by dizg's avatar dizg Committed by Commit Bot

[signin] Add back button that calls the function "NavigateToPreviousRoute"

Bug: 1105865
Change-Id: I6a2b6ef0ec3e73511be20be190f74de64a5a8b49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2302619Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarMonica Basta <msalama@chromium.org>
Commit-Queue: Diana Zagidullina <dizg@google.com>
Cr-Commit-Position: refs/heads/master@{#790763}
parent 3ba901ba
...@@ -661,4 +661,11 @@ ...@@ -661,4 +661,11 @@
Don't see your name? Don't see your name?
</message> </message>
</if> </if>
<!-- Profile Picker -->
<if expr="not chromeos and not is_android">
<message name="IDS_PROFILE_PICKER_BACK_BUTTON_LABEL" desc="Label for a button that navigates user to the previous page">
Back
</message>
</if>
</grit-part> </grit-part>
d7bdadefb05b21f0fc4ed80ce2a7c18a7fd5416e
\ No newline at end of file
...@@ -88,6 +88,13 @@ export function navigateTo(route) { ...@@ -88,6 +88,13 @@ export function navigateTo(route) {
notifyObservers(); notifyObservers();
} }
/**
* Navigates to the previous route.
*/
export function navigateToPreviousRoute() {
// TODO(crbug.com/1063856): Add implementation.
}
/** @polymerBehavior */ /** @polymerBehavior */
export const NavigationBehavior = { export const NavigationBehavior = {
/** @override */ /** @override */
...@@ -111,4 +118,4 @@ export const NavigationBehavior = { ...@@ -111,4 +118,4 @@ export const NavigationBehavior = {
* @param {string} step * @param {string} step
*/ */
onRouteChange: function(route, step) {}, onRouteChange: function(route, step) {},
}; };
\ No newline at end of file
...@@ -13,6 +13,7 @@ js_type_check("closure_compile") { ...@@ -13,6 +13,7 @@ js_type_check("closure_compile") {
js_library("profile_type_choice") { js_library("profile_type_choice") {
deps = [ deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button.m",
] ]
} }
......
<div> Profile type choice </div> <style include="cr-icons"></style>
<cr-icon-button class="icon-arrow-back" id="backButton"
on-click="onTapBack_" aria-label="$i18n{backButtonLabel}">
</cr-icon-button>
...@@ -2,10 +2,20 @@ ...@@ -2,10 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js';
import 'chrome://resources/cr_elements/cr_icons_css.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {navigateToPreviousRoute} from '../navigation_behavior.js';
Polymer({ Polymer({
is: 'profile-type-choice', is: 'profile-type-choice',
_template: html`{__html_template__}`, _template: html`{__html_template__}`,
/** @private */
onTapBack_() {
navigateToPreviousRoute();
},
}); });
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/webui_url_constants.h" #include "chrome/common/webui_url_constants.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/profile_picker_resources.h" #include "chrome/grit/profile_picker_resources.h"
#include "chrome/grit/profile_picker_resources_map.h" #include "chrome/grit/profile_picker_resources_map.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
...@@ -20,6 +21,7 @@ void AddStrings(content::WebUIDataSource* html_source) { ...@@ -20,6 +21,7 @@ void AddStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = { static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"mainViewTitle", IDS_PROFILE_PICKER_MAIN_VIEW_TITLE}, {"mainViewTitle", IDS_PROFILE_PICKER_MAIN_VIEW_TITLE},
{"mainViewSubtitle", IDS_PROFILE_PICKER_MAIN_VIEW_SUBTITLE}, {"mainViewSubtitle", IDS_PROFILE_PICKER_MAIN_VIEW_SUBTITLE},
{"backButtonLabel", IDS_PROFILE_PICKER_BACK_BUTTON_LABEL},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings); AddLocalizedStringsBulk(html_source, kLocalizedStrings);
} }
......
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