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 { ...@@ -50,6 +50,9 @@ export class ManageProfilesBrowserProxy {
* suggested theme info, once it has been retrieved. * suggested theme info, once it has been retrieved.
*/ */
getNewProfileSuggestedThemeInfo() {} getNewProfileSuggestedThemeInfo() {}
/** Loads Google sign in page.*/
loadSignInProfileCreationFlow() {}
} }
/** @implements {ManageProfilesBrowserProxy} */ /** @implements {ManageProfilesBrowserProxy} */
...@@ -73,6 +76,11 @@ export class ManageProfilesBrowserProxyImpl { ...@@ -73,6 +76,11 @@ export class ManageProfilesBrowserProxyImpl {
getNewProfileSuggestedThemeInfo() { getNewProfileSuggestedThemeInfo() {
return sendWithPromise('getNewProfileSuggestedThemeInfo'); return sendWithPromise('getNewProfileSuggestedThemeInfo');
} }
/** @override */
loadSignInProfileCreationFlow() {
chrome.send('loadSignInProfileCreationFlow');
}
} }
addSingletonGetter(ManageProfilesBrowserProxyImpl); addSingletonGetter(ManageProfilesBrowserProxyImpl);
...@@ -84,14 +84,7 @@ window.addEventListener('popstate', notifyObservers); ...@@ -84,14 +84,7 @@ window.addEventListener('popstate', notifyObservers);
*/ */
export function navigateTo(route) { export function navigateTo(route) {
assert([Routes.MAIN, Routes.NEW_PROFILE].includes(route)); assert([Routes.MAIN, Routes.NEW_PROFILE].includes(route));
history.pushState( navigateToStep(route, computeStep(route));
{
route: route,
step: computeStep(route),
isFirst: false,
},
'', route === Routes.MAIN ? '/' : `/${route}`);
notifyObservers();
} }
/** /**
...@@ -113,7 +106,14 @@ export function navigateToPreviousRoute() { ...@@ -113,7 +106,14 @@ export function navigateToPreviousRoute() {
* @param {string} step * @param {string} step
*/ */
export function navigateToStep(route, 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 */ /** @polymerBehavior */
......
...@@ -11,7 +11,7 @@ import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js'; ...@@ -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 {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {AutogeneratedThemeColorInfo, ManageProfilesBrowserProxy, ManageProfilesBrowserProxyImpl} from './manage_profiles_browser_proxy.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'; import {ensureLazyLoaded} from './profile_creation_flow/ensure_lazy_loaded.js';
Polymer({ Polymer({
...@@ -50,6 +50,11 @@ Polymer({ ...@@ -50,6 +50,11 @@ Polymer({
* @private * @private
*/ */
onRouteChange(route, step) { onRouteChange(route, step) {
if (step == ProfileCreationSteps.LOAD_SIGNIN) {
this.manageProfilesBrowserProxy_.loadSignInProfileCreationFlow();
return;
}
const setStep = () => { const setStep = () => {
this.$.viewManager.switchView(step, 'fade-in', 'no-animation'); this.$.viewManager.switchView(step, 'fade-in', 'no-animation');
}; };
......
...@@ -51,6 +51,11 @@ void ProfilePickerHandler::RegisterMessages() { ...@@ -51,6 +51,11 @@ void ProfilePickerHandler::RegisterMessages() {
base::BindRepeating( base::BindRepeating(
&ProfilePickerHandler::HandleGetNewProfileSuggestedThemeInfo, &ProfilePickerHandler::HandleGetNewProfileSuggestedThemeInfo,
base::Unretained(this))); base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"loadSignInProfileCreationFlow",
base::BindRepeating(
&ProfilePickerHandler::HandleLoadSignInProfileCreationFlow,
base::Unretained(this)));
} }
void ProfilePickerHandler::OnJavascriptAllowed() { void ProfilePickerHandler::OnJavascriptAllowed() {
...@@ -131,6 +136,11 @@ void ProfilePickerHandler::HandleGetNewProfileSuggestedThemeInfo( ...@@ -131,6 +136,11 @@ void ProfilePickerHandler::HandleGetNewProfileSuggestedThemeInfo(
ResolveJavascriptCallback(callback_id, std::move(dict)); ResolveJavascriptCallback(callback_id, std::move(dict));
} }
void ProfilePickerHandler::HandleLoadSignInProfileCreationFlow(
const base::ListValue* args) {
// TODO(crbug.com/1063856): Add implementation.
}
void ProfilePickerHandler::OnSwitchToProfileComplete( void ProfilePickerHandler::OnSwitchToProfileComplete(
Profile* profile, Profile* profile,
Profile::CreateStatus profile_create_status) { Profile::CreateStatus profile_create_status) {
......
...@@ -28,6 +28,7 @@ class ProfilePickerHandler : public content::WebUIMessageHandler, ...@@ -28,6 +28,7 @@ class ProfilePickerHandler : public content::WebUIMessageHandler,
void HandleLaunchSelectedProfile(const base::ListValue* args); void HandleLaunchSelectedProfile(const base::ListValue* args);
void HandleAskOnStartupChanged(const base::ListValue* args); void HandleAskOnStartupChanged(const base::ListValue* args);
void HandleGetNewProfileSuggestedThemeInfo(const base::ListValue* args); void HandleGetNewProfileSuggestedThemeInfo(const base::ListValue* args);
void HandleLoadSignInProfileCreationFlow(const base::ListValue* args);
void OnSwitchToProfileComplete(Profile* profile, void OnSwitchToProfileComplete(Profile* profile,
Profile::CreateStatus profile_create_status); 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