Commit 5e0eeff1 authored by Anastasiia N's avatar Anastasiia N Committed by Chromium LUCI CQ

Add a checkbox to welcome page in Add account flow

Add a 'Don't remind me again' checkbox to the welcome page.

Screenshot: http://screen/7mZimAEabQv5agq.png

Bug: 1144114
Change-Id: Ib0f5cb1b429d84da982fd239c0afb0ff933d010d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2549764Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Commit-Queue: Anastasiia N <anastasiian@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834621}
parent 4751319d
......@@ -5487,6 +5487,9 @@
<message name="IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_TITLE" desc="Title for the Welcome screen in Chrome OS 'Add account' dialog.">
Add a secondary Google Account for <ph name="USER_NAME">$1<ex>John</ex></ph>
</message>
<message name="IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_CHECKBOX" desc="Checkbox text for the Welcome screen in Chrome OS 'Add account' dialog. If user checks this checkbox, this screen will not be shown the next time they open the dialog.">
Don't remind me next time
</message>
<message name="IDS_ACCOUNT_MANAGER_ERROR_NO_INTERNET_TITLE" desc="Title for the network error screen.">
No Internet
</message>
......
3cd2c3d820354c5f7e641c8eb7f1b6d2608f1535
\ No newline at end of file
......@@ -161,7 +161,7 @@
<!-- In-session login flow -->
<include name="IDR_INLINE_LOGIN_HTML" file="resources\inline_login\inline_login.html" type="BINDATA" />
<include name="IDR_INLINE_LOGIN_APP_JS" file="${root_gen_dir}\chrome\browser\resources\inline_login\inline_login_app.js" use_base_dir="false" type ="BINDATA" preprocess="true" />
<include name="IDR_INLINE_LOGIN_BROWSER_PROXY_JS" file="resources\inline_login\inline_login_browser_proxy.js" type ="BINDATA"/>
<include name="IDR_INLINE_LOGIN_BROWSER_PROXY_JS" file="resources\inline_login\inline_login_browser_proxy.js" type ="BINDATA" preprocess="true"/>
</if>
<if expr="chromeos">
......
......@@ -22,6 +22,7 @@ js_type_check("closure_compile") {
js_library("inline_login_app") {
deps = [
":inline_login_browser_proxy",
":welcome_page_app",
"//chrome/browser/resources/gaia_auth_host:authenticator.m",
"//third_party/polymer/v3_0/components-chromium/paper-spinner:paper-spinner-lite",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
......
......@@ -8,7 +8,6 @@ import 'chrome://resources/cr_elements/icons.m.js';
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
import 'chrome://resources/cr_elements/cr_view_manager/cr_view_manager.m.js';
import {isChromeOS} from '//resources/js/cr.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {isRTL} from 'chrome://resources/js/util.m.js';
......@@ -88,6 +87,19 @@ Polymer({
type: String,
value: '',
},
/*
* True if welcome page should not be shown.
* @private
*/
shouldSkipWelcomePage_: {
type: Boolean,
value() {
// TODO(crbug.com/1144114): get value from pref.
return false;
},
readOnly: true,
},
},
/** @private {?InlineLoginBrowserProxy} */
......@@ -252,6 +264,9 @@ Polymer({
if (this.$.signinFrame.canGoBack()) {
this.$.signinFrame.back();
this.$.signinFrame.focus();
} else if (this.isWelcomePageEnabled_()) {
// Allow user go back to the welcome page, if it's enabled.
this.switchView_(View.welcome);
} else {
this.closeDialog_();
}
......@@ -312,13 +327,20 @@ Polymer({
* @private
*/
isWelcomePageEnabled_() {
return this.isAccountManagementFlowsV2Enabled_;
return this.isAccountManagementFlowsV2Enabled_ &&
!this.shouldSkipWelcomePage_;
},
// <if expr="chromeos">
/** @private */
onOkButtonClick_() {
this.switchView_(View.addAccount);
const skipChecked =
/** @type {WelcomePageAppElement} */ (this.$$('welcome-page-app'))
.isSkipCheckboxChecked();
this.browserProxy_.skipWelcomePage(skipChecked);
},
// </if>
/** @param {Object} authExtHost */
setAuthExtHostForTest(authExtHost) {
......
......@@ -55,6 +55,14 @@ export class InlineLoginBrowserProxy {
/** Send 'dialogClose' message to close the login dialog. */
dialogClose() {}
// <if expr="chromeos">
/**
* Send 'skipWelcomePage' message to the handler.
* @param {boolean} skip Whether the welcome page should be skipped.
*/
skipWelcomePage(skip) {}
// </if>
}
/** @implements {InlineLoginBrowserProxy} */
......@@ -103,6 +111,13 @@ export class InlineLoginBrowserProxyImpl {
dialogClose() {
chrome.send('dialogClose');
}
// <if expr="chromeos">
/** @override */
skipWelcomePage(skip) {
chrome.send('skipWelcomePage', [skip]);
}
// </if>
}
addSingletonGetter(InlineLoginBrowserProxyImpl);
......@@ -6,11 +6,16 @@
width: 338px;
}
.google-full-logo {
/* The same size as in webview. */
width: 74px;
}
.secondary {
color: var(--cr-secondary-text-color);
}
.skip-checkbox {
margin: auto;
margin-top: 40px;
}
</style>
<div class="main-container">
......@@ -20,11 +25,17 @@
</if>
<h1>[[getWelcomeTitle_()]]</h1>
<p class="secondary" inner-h-t-m-l="[[getWelcomeBody_()]]"></p>
<if expr="_google_chrome">
<div class="image-container">
<div class="image-container">
<if expr="_google_chrome">
<img class="welcome-image" alt=""
srcset="account_manager_welcome_1x.png 1x,
account_manager_welcome_2x.png 2x">
</div>
</if>
</if>
</div>
<div class="skip-checkbox">
<cr-checkbox id="checkbox"
aria-label="$i18n{accountManagerDialogWelcomeCheckbox}">
<span class="secondary">$i18n{accountManagerDialogWelcomeCheckbox}</span>
</cr-checkbox>
</div>
</div>
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';
import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.m.js';
import './account_manager_shared_css.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
......@@ -21,6 +22,11 @@ Polymer({
() => this.dispatchEvent(new CustomEvent('opened-new-window')));
},
/** @return {boolean} */
isSkipCheckboxChecked() {
return this.$.checkbox.checked;
},
/**
* @return {string}
* @private
......
......@@ -355,6 +355,10 @@ void InlineLoginHandlerChromeOS::RegisterMessages() {
"getAccounts",
base::BindRepeating(&InlineLoginHandlerChromeOS::GetAccountsInSession,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"skipWelcomePage",
base::BindRepeating(&InlineLoginHandlerChromeOS::HandleSkipWelcomePage,
base::Unretained(this)));
}
void InlineLoginHandlerChromeOS::SetExtraInitParams(
......@@ -496,4 +500,9 @@ void InlineLoginHandlerChromeOS::OnGetAccounts(
std::move(account_emails));
}
void InlineLoginHandlerChromeOS::HandleSkipWelcomePage(
const base::ListValue* args) {
// TODO(crbug.com/1144114): write to pref.
}
} // namespace chromeos
......@@ -41,6 +41,7 @@ class InlineLoginHandlerChromeOS : public InlineLoginHandler {
void GetAccountsInSession(const base::ListValue* args);
void OnGetAccounts(const std::string& callback_id,
const std::vector<::account_manager::Account>& accounts);
void HandleSkipWelcomePage(const base::ListValue* args);
base::RepeatingClosure close_dialog_closure_;
base::WeakPtrFactory<InlineLoginHandlerChromeOS> weak_factory_{this};
......
......@@ -188,6 +188,8 @@ content::WebUIDataSource* CreateWebUIDataSource(Profile* profile) {
IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_TITLE},
{"accountManagerDialogWelcomeBody",
IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY},
{"accountManagerDialogWelcomeCheckbox",
IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_CHECKBOX},
{"accountManagerErrorNoInternetTitle",
IDS_ACCOUNT_MANAGER_ERROR_NO_INTERNET_TITLE},
{"accountManagerErrorNoInternetBody",
......
......@@ -262,6 +262,11 @@ if (include_js_tests) {
]
}
if (is_chromeos_ash || is_win) {
deps += [ "inline_login:preprocess" ]
data += [ "$root_gen_dir/chrome/test/data/webui/inline_login/inline_login_test_util.js" ]
}
if (is_chromeos_ash) {
data += [
"$root_gen_dir/chrome/test/data/webui/chromeos/fake_network_config_mojom.m.js",
......
......@@ -3,6 +3,13 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/preprocess_if_expr.gni")
preprocess_if_expr("preprocess") {
in_folder = "./"
out_folder = "$target_gen_dir"
in_files = [ "inline_login_test_util.js" ]
}
js_type_check("closure_compile") {
is_polymer3 = true
......
......@@ -71,6 +71,9 @@ export class TestInlineLoginBrowserProxy extends TestBrowserProxy {
'showIncognito',
'getAccounts',
'dialogClose',
// <if expr="chromeos">
'skipWelcomePage',
// </if>
]);
}
......@@ -119,4 +122,11 @@ export class TestInlineLoginBrowserProxy extends TestBrowserProxy {
dialogClose() {
this.methodCalled('dialogClose');
}
// <if expr="chromeos">
/** @override */
skipWelcomePage(skip) {
this.methodCalled('skipWelcomePage', skip);
}
// </if>
}
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