Commit ad607ec1 authored by Anastasiia Nikolaienko's avatar Anastasiia Nikolaienko Committed by Commit Bot

Add EDU login flow: Add browser proxy

Add browser proxy to call the EDU account login handler.

Bug: 1043108
Change-Id: Ia772b15b73568232ea13e714919adcbe6e98548b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2043470
Commit-Queue: Anastasiia Nikolaienko <anastasiian@chromium.org>
Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747244}
parent 60370d94
...@@ -215,6 +215,8 @@ ...@@ -215,6 +215,8 @@
<!-- Edu account login resources --> <!-- Edu account login resources -->
<include name="IDU_EDU_LOGIN_EDU_LOGIN_HTML" file="resources\chromeos\edu_login\edu_login.html" allowexternalscript="true" type="BINDATA" compress="gzip" /> <include name="IDU_EDU_LOGIN_EDU_LOGIN_HTML" file="resources\chromeos\edu_login\edu_login.html" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDU_EDU_LOGIN_EDU_LOGIN_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\app.js" use_base_dir="false" type="BINDATA" compress="gzip" /> <include name="IDU_EDU_LOGIN_EDU_LOGIN_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\app.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_EDU_LOGIN_EDU_LOGIN_UTIL_JS" file="resources\chromeos\edu_login\edu_login_util.js" type="BINDATA" compress="gzip" />
<include name="IDR_EDU_LOGIN_BROWSER_PROXY_JS" file="resources\chromeos\edu_login\browser_proxy.js" type="BINDATA" compress="gzip" />
<include name="IDR_EDU_LOGIN_EDU_LOGIN_BUTTON_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\edu_login_button.js" use_base_dir="false" type="BINDATA" compress="gzip" /> <include name="IDR_EDU_LOGIN_EDU_LOGIN_BUTTON_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\edu_login_button.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_EDU_LOGIN_EDU_LOGIN_TEMPLATE_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\edu_login_template.js" use_base_dir="false" type="BINDATA" compress="gzip" /> <include name="IDR_EDU_LOGIN_EDU_LOGIN_TEMPLATE_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\edu_login_template.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_EDU_LOGIN_EDU_LOGIN_CSS_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\edu_login_css.js" use_base_dir="false" type ="BINDATA" /> <include name="IDR_EDU_LOGIN_EDU_LOGIN_CSS_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\edu_login_css.js" use_base_dir="false" type ="BINDATA" />
......
...@@ -9,8 +9,10 @@ js_type_check("closure_compile") { ...@@ -9,8 +9,10 @@ js_type_check("closure_compile") {
is_polymer3 = true is_polymer3 = true
deps = [ deps = [
":app", ":app",
":browser_proxy",
":edu_login_button", ":edu_login_button",
":edu_login_template", ":edu_login_template",
":edu_login_util",
] ]
} }
...@@ -34,6 +36,17 @@ js_library("edu_login_template") { ...@@ -34,6 +36,17 @@ js_library("edu_login_template") {
] ]
} }
js_library("browser_proxy") {
deps = [
":edu_login_util",
"//ui/webui/resources/js:cr.m",
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
js_library("edu_login_util") {
}
polymer_modulizer("app") { polymer_modulizer("app") {
js_file = "app.js" js_file = "app.js"
html_file = "app.html" html_file = "app.html"
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
import {ParentAccount} from './edu_login_util.js';
/** @interface */
export class EduAccountLoginBrowserProxy {
/**
* Send 'getParents' request to the handler. The promise will be resolved
* with the list of parents (Array<ParentAccount>).
* @return {Promise<Array<ParentAccount>>}
*/
getParents() {}
/**
* Send parent credentials to get the reauth proof token. The promise will be
* resolved with the RAPT.
*
* @param {ParentAccount} parent
* @param {String} password parent password
* @return {Promise<string>}
*/
parentSignin(parent, password) {}
}
/**
* @implements {EduAccountLoginBrowserProxy}
*/
export class EduAccountLoginBrowserProxyImpl {
/** @override */
getParents() {
return sendWithPromise('getParents');
}
/** @override */
parentSignin(parent, password) {
return sendWithPromise('parentSignin', parent, password);
}
}
addSingletonGetter(EduAccountLoginBrowserProxyImpl);
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* Information for a parent account.
* @typedef {{
* email: string,
* displayName: string,
* profileImageUrl: string,
* obfuscatedGaiaId: string
* }}
*/
export let ParentAccount;
...@@ -72,6 +72,9 @@ content::WebUIDataSource* CreateWebUIDataSource() { ...@@ -72,6 +72,9 @@ content::WebUIDataSource* CreateWebUIDataSource() {
source->AddResourcePath("edu_login_template.js", source->AddResourcePath("edu_login_template.js",
IDR_EDU_LOGIN_EDU_LOGIN_TEMPLATE_JS); IDR_EDU_LOGIN_EDU_LOGIN_TEMPLATE_JS);
source->AddResourcePath("edu_login_css.js", IDR_EDU_LOGIN_EDU_LOGIN_CSS_JS); source->AddResourcePath("edu_login_css.js", IDR_EDU_LOGIN_EDU_LOGIN_CSS_JS);
source->AddResourcePath("browser_proxy.js", IDR_EDU_LOGIN_BROWSER_PROXY_JS);
source->AddResourcePath("edu_login_util.js", IDR_EDU_LOGIN_EDU_LOGIN_UTIL_JS);
AddEduStrings(source); AddEduStrings(source);
#endif #endif
......
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