Add EDU login flow: reauth welcome screen

Change welcome screen content for reauthentication flow.

Bug: 1043108
Change-Id: I31a9f3ed0fbe49353c8a983c3d366d2fd40fe7fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089779
Commit-Queue: Anastasiia Nikolaienko <anastasiian@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749624}
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index a719ac6..eb4c9108 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -4504,6 +4504,12 @@
   <message name="IDS_EDU_LOGIN_WELCOME_BODY" desc="Text on the welcome screen in EDU account addition flow informing user to ask their parent for permission to add the account.">
     To add an account for access to educational resources, ask a parent to give you permission
   </message>
+  <message name="IDS_EDU_LOGIN_WELCOME_REAUTH_TITLE" desc="Title for the reauthentication screen in EDU account addition flow.">
+    Sign in again with a school account
+  </message>
+  <message name="IDS_EDU_LOGIN_WELCOME_REAUTH_BODY" desc="Text on the reauthentication screen in EDU account addition flow informing user to ask their parent for permission to reauthenticate the account.">
+    To sign in again for access to educational resources, ask a parent to give you permission
+  </message>
 
   <!-- TPM firmware auto-update notifications -->
   <message name="IDS_TPM_AUTO_UPDATE_PLANNED_NOTIFICATION_TITLE" desc="Title for the notification informing the user that local data will be deleted.">
diff --git a/chrome/app/chromeos_strings_grdp/IDS_EDU_LOGIN_WELCOME_REAUTH_BODY.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_EDU_LOGIN_WELCOME_REAUTH_BODY.png.sha1
new file mode 100644
index 0000000..e26d22e
--- /dev/null
+++ b/chrome/app/chromeos_strings_grdp/IDS_EDU_LOGIN_WELCOME_REAUTH_BODY.png.sha1
@@ -0,0 +1 @@
+a8233335f12ec04863f6a3933d10adefe98da96d
\ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_EDU_LOGIN_WELCOME_REAUTH_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_EDU_LOGIN_WELCOME_REAUTH_TITLE.png.sha1
new file mode 100644
index 0000000..e26d22e
--- /dev/null
+++ b/chrome/app/chromeos_strings_grdp/IDS_EDU_LOGIN_WELCOME_REAUTH_TITLE.png.sha1
@@ -0,0 +1 @@
+a8233335f12ec04863f6a3933d10adefe98da96d
\ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/edu_login/BUILD.gn b/chrome/browser/resources/chromeos/edu_login/BUILD.gn
index 5f0e417..0bcbd22 100644
--- a/chrome/browser/resources/chromeos/edu_login/BUILD.gn
+++ b/chrome/browser/resources/chromeos/edu_login/BUILD.gn
@@ -55,6 +55,7 @@
     ":edu_login_button",
     ":edu_login_template",
     "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
+    "//ui/webui/resources/js:i18n_behavior.m",
   ]
 }
 
diff --git a/chrome/browser/resources/chromeos/edu_login/edu_login.html b/chrome/browser/resources/chromeos/edu_login/edu_login.html
index 4ba7025e..711ac1c 100644
--- a/chrome/browser/resources/chromeos/edu_login/edu_login.html
+++ b/chrome/browser/resources/chromeos/edu_login/edu_login.html
@@ -2,7 +2,6 @@
 <html dir="$i18n{textdirection}" lang="$i18n{language}">
 <head>
   <meta charset="utf-8">
-  <title>$i18n{welcomeTitle}</title>
   <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
   <style>
     html,
diff --git a/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.html b/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.html
index b2635cd..e6c7603 100644
--- a/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.html
+++ b/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.html
@@ -6,8 +6,8 @@
         <img class="google-logo"
             src="chrome://chrome-signin/googleg.svg" alt="">
       </if>
-      <h1>$i18n{welcomeTitle}</h1>
-      <p>$i18n{welcomeBody}</p>
+      <h1>[[getTitle_()]]</h1>
+      <p>[[getBody_()]]</p>
     </div>
   </span>
   <span slot="buttons">
diff --git a/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.js b/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.js
index 798cbfc..ab4b295f 100644
--- a/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.js
+++ b/chrome/browser/resources/chromeos/edu_login/edu_login_welcome.js
@@ -6,10 +6,49 @@
 import './edu_login_template.js';
 import './edu_login_button.js';
 
+import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
 import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
 
 Polymer({
   is: 'edu-login-welcome',
 
   _template: html`{__html_template__}`,
+
+  behaviors: [I18nBehavior],
+
+  /**
+   * Whether current flow is a reauthentication.
+   * @private {boolean}
+   */
+  reauthFlow_: false,
+
+  /** @override */
+  created() {
+    // For the reauth flow the email is appended to query params in
+    // InlineLoginHandlerDialogChromeOS. It's used later in auth extension to
+    // pass the email value to Gaia.
+    let currentQueryParameters = new URLSearchParams(window.location.search);
+    if (currentQueryParameters.get('email')) {
+      this.reauthFlow_ = true;
+    }
+    document.title = this.getTitle_();
+  },
+
+  /**
+   * @return {string}
+   * @private
+   */
+  getTitle_() {
+    return this.reauthFlow_ ? this.i18n('welcomeReauthTitle') :
+                              this.i18n('welcomeTitle');
+  },
+
+  /**
+   * @return {string}
+   * @private
+   */
+  getBody_() {
+    return this.reauthFlow_ ? this.i18n('welcomeReauthBody') :
+                              this.i18n('welcomeBody');
+  },
 });
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc
index df42aa9c..af83d91 100644
--- a/chrome/browser/ui/webui/signin/inline_login_ui.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -45,6 +45,10 @@
 
   source->AddLocalizedString("welcomeTitle", IDS_EDU_LOGIN_WELCOME_TITLE);
   source->AddLocalizedString("welcomeBody", IDS_EDU_LOGIN_WELCOME_BODY);
+  source->AddLocalizedString("welcomeReauthTitle",
+                             IDS_EDU_LOGIN_WELCOME_REAUTH_TITLE);
+  source->AddLocalizedString("welcomeReauthBody",
+                             IDS_EDU_LOGIN_WELCOME_REAUTH_BODY);
 }
 #endif  // defined(OS_CHROMEOS)