Commit 989692f1 authored by Anastasiia Nikolaienko's avatar Anastasiia Nikolaienko Committed by Commit Bot

Add EDU login flow

Add <edu-login-app> component and serve it from
chrome://chrome-signin/edu path.

Bug: 1043108
Change-Id: Ic1f9c056095fb574520309aecd491f065e6bf2f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007631
Commit-Queue: Anastasiia Nikolaienko <anastasiian@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739300}
parent 94281455
......@@ -5548,6 +5548,7 @@ grit("resources") {
deps += [
"//chrome/browser/resources/chromeos/crostini_installer:polymer3_elements",
"//chrome/browser/resources/chromeos/crostini_upgrader:polymer3_elements",
"//chrome/browser/resources/chromeos/edu_login:polymer3_elements",
"//chrome/browser/resources/chromeos/emulator:polymer3_elements",
"//chrome/browser/resources/chromeos/set_time_dialog:polymer3_elements",
"//chrome/browser/resources/chromeos/smb_shares:polymer3_elements",
......
......@@ -215,6 +215,9 @@
<include name="IDR_BLUETOOTH_PAIRING_DIALOG_JS" file="resources\chromeos\bluetooth_pairing_dialog\bluetooth_pairing_dialog.js" type="chrome_html" />
</else>
</if>
<!-- 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_JS" file="${root_gen_dir}\chrome\browser\resources\chromeos\edu_login\app.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<!-- Chrome OS Account Manager welcome screen resources -->
<include name="IDR_ACCOUNT_MANAGER_SHARED_CSS" file="resources\chromeos\account_manager_shared.css" type="BINDATA" compress="gzip" />
<include name="IDR_ACCOUNT_MANAGER_WELCOME_HTML" file="resources\chromeos\account_manager_welcome.html" allowexternalscript="true" type="BINDATA" compress="gzip" preprocess="true"/>
......
......@@ -69,6 +69,7 @@ group("closure_compile") {
"bluetooth_pairing_dialog:closure_compile",
"camera/src/js:closure_compile",
"crostini_installer:closure_compile",
"edu_login:closure_compile",
"emulator:closure_compile",
"internet_config_dialog:closure_compile",
"internet_detail_dialog:closure_compile",
......
# 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("//third_party/closure_compiler/compile_js.gni")
import("//tools/polymer/polymer.gni")
js_type_check("closure_compile") {
is_polymer3 = true
deps = [ ":app" ]
}
js_library("app") {
deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
]
}
polymer_modulizer("app") {
js_file = "app.js"
html_file = "app.html"
html_type = "v3-ready"
}
group("polymer3_elements") {
deps = [ ":app_module" ]
}
// 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 {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
Polymer({
is: 'edu-login-app',
_template: html`{__html_template__}`,
});
<!doctype html>
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<edu-login-app></edu-login-app>
<script type="module" src="app.js"></script>
</body>
</html>
......@@ -15,6 +15,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "chrome/common/webui_url_constants.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
......@@ -50,9 +51,17 @@ void InlineLoginHandlerDialogChromeOS::Show(const std::string& email) {
}
GURL url;
if (ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
chromeos::prefs::kSecondaryGoogleAccountSigninAllowed) ||
IsDeviceAccountEmail(email)) {
if (ProfileManager::GetActiveUserProfile()->IsChild()) {
// chrome://chrome-signin/edu
const std::string kEduAccountLoginURL =
std::string(chrome::kChromeUIChromeSigninURL) + "edu";
url = GURL(features::IsEduCoexistenceEnabled()
? kEduAccountLoginURL
: chrome::kChromeUIAccountManagerErrorURL);
} else if (ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
chromeos::prefs::kSecondaryGoogleAccountSigninAllowed) ||
IsDeviceAccountEmail(email)) {
// Addition of secondary Google Accounts is allowed OR it's a primary
// account re-auth.
url = GURL(chrome::kChromeUIChromeSigninURL);
......
......@@ -54,6 +54,11 @@ content::WebUIDataSource* CreateWebUIDataSource() {
source->AddResourcePath("inline_login.js", IDR_INLINE_LOGIN_JS);
source->AddResourcePath("gaia_auth_host.js", IDR_GAIA_AUTH_AUTHENTICATOR_JS);
#if defined(OS_CHROMEOS)
source->AddResourcePath("edu", IDU_EDU_LOGIN_EDU_LOGIN_HTML);
source->AddResourcePath("app.js", IDU_EDU_LOGIN_EDU_LOGIN_JS);
#endif
source->AddLocalizedString("title", IDS_CHROME_SIGNIN_TITLE);
source->AddLocalizedString(
"accessibleCloseButtonLabel", IDS_SIGNIN_ACCESSIBLE_CLOSE_BUTTON);
......
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