Commit 52fd4247 authored by dizg's avatar dizg Committed by Commit Bot

[signin] Implement signin button in the profile creation flow

Bug: 1105865
Change-Id: Ic23584084629f6e318083d536130792752dc303a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2332630Reviewed-by: default avatarMonica Basta <msalama@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Diana Zagidullina <dizg@google.com>
Cr-Commit-Position: refs/heads/master@{#794959}
parent a8afae1a
......@@ -50,6 +50,9 @@ export class ManageProfilesBrowserProxy {
* suggested theme info, once it has been retrieved.
*/
getNewProfileSuggestedThemeInfo() {}
/** Loads Google sign in page.*/
loadSignInProfileCreationFlow() {}
}
/** @implements {ManageProfilesBrowserProxy} */
......@@ -73,6 +76,11 @@ export class ManageProfilesBrowserProxyImpl {
getNewProfileSuggestedThemeInfo() {
return sendWithPromise('getNewProfileSuggestedThemeInfo');
}
/** @override */
loadSignInProfileCreationFlow() {
chrome.send('loadSignInProfileCreationFlow');
}
}
addSingletonGetter(ManageProfilesBrowserProxyImpl);
......@@ -84,14 +84,7 @@ window.addEventListener('popstate', notifyObservers);
*/
export function navigateTo(route) {
assert([Routes.MAIN, Routes.NEW_PROFILE].includes(route));
history.pushState(
{
route: route,
step: computeStep(route),
isFirst: false,
},
'', route === Routes.MAIN ? '/' : `/${route}`);
notifyObservers();
navigateToStep(route, computeStep(route));
}
/**
......@@ -113,7 +106,14 @@ export function navigateToPreviousRoute() {
* @param {string} step
*/
export function navigateToStep(route, step) {
// TODO(crbug.com/1063856): Add implementation.
history.pushState(
{
route: route,
step: step,
isFirst: false,
},
'', route === Routes.MAIN ? '/' : `/${route}`);
notifyObservers();
}
/** @polymerBehavior */
......
......@@ -11,7 +11,7 @@ import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {AutogeneratedThemeColorInfo, ManageProfilesBrowserProxy, ManageProfilesBrowserProxyImpl} from './manage_profiles_browser_proxy.js';
import {NavigationBehavior, Routes} from './navigation_behavior.js';
import {NavigationBehavior, ProfileCreationSteps, Routes} from './navigation_behavior.js';
import {ensureLazyLoaded} from './profile_creation_flow/ensure_lazy_loaded.js';
Polymer({
......@@ -50,6 +50,11 @@ Polymer({
* @private
*/
onRouteChange(route, step) {
if (step == ProfileCreationSteps.LOAD_SIGNIN) {
this.manageProfilesBrowserProxy_.loadSignInProfileCreationFlow();
return;
}
const setStep = () => {
this.$.viewManager.switchView(step, 'fade-in', 'no-animation');
};
......
......@@ -51,6 +51,11 @@ void ProfilePickerHandler::RegisterMessages() {
base::BindRepeating(
&ProfilePickerHandler::HandleGetNewProfileSuggestedThemeInfo,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"loadSignInProfileCreationFlow",
base::BindRepeating(
&ProfilePickerHandler::HandleLoadSignInProfileCreationFlow,
base::Unretained(this)));
}
void ProfilePickerHandler::OnJavascriptAllowed() {
......@@ -131,6 +136,11 @@ void ProfilePickerHandler::HandleGetNewProfileSuggestedThemeInfo(
ResolveJavascriptCallback(callback_id, std::move(dict));
}
void ProfilePickerHandler::HandleLoadSignInProfileCreationFlow(
const base::ListValue* args) {
// TODO(crbug.com/1063856): Add implementation.
}
void ProfilePickerHandler::OnSwitchToProfileComplete(
Profile* profile,
Profile::CreateStatus profile_create_status) {
......
......@@ -28,6 +28,7 @@ class ProfilePickerHandler : public content::WebUIMessageHandler,
void HandleLaunchSelectedProfile(const base::ListValue* args);
void HandleAskOnStartupChanged(const base::ListValue* args);
void HandleGetNewProfileSuggestedThemeInfo(const base::ListValue* args);
void HandleLoadSignInProfileCreationFlow(const base::ListValue* args);
void OnSwitchToProfileComplete(Profile* profile,
Profile::CreateStatus profile_create_status);
......
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