Commit 1a6c18c6 authored by Monica Basta's avatar Monica Basta Committed by Commit Bot

[ProfilePicker]: Profile name input and create shortcut checkbox.

Screenshot:
https://drive.google.com/file/d/1z78dkOIi7FbwSXuOzOhC-mpcnuw4JsFl/view?usp=sharing

Bug: 1115056
Fixed: 1121137
Change-Id: I46bb7b3bbd41a7ced628681e84026442a5d414fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2366938
Commit-Queue: Monica Basta <msalama@chromium.org>
Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800994}
parent 8e6f7aa5
...@@ -736,10 +736,8 @@ ...@@ -736,10 +736,8 @@
<message name="IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_INPUT_NAME" desc="Name of the input to configure the profile name in the profile customization window."> <message name="IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_INPUT_NAME" desc="Name of the input to configure the profile name in the profile customization window.">
Example: Work, Personal, Kids, or a name Example: Work, Personal, Kids, or a name
</message> </message>
<if expr="is_win"> <message name="IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_SHORTCUT_TEXT" desc="Text of a box creating a desktop shortcut for the profile.">
<message name="IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_SHORTCUT_TEXT" desc="Text of a box creating a desktop shortcut for the profile."> Create a desktop shortcut
Create a desktop shortcut </message>
</message>
</if>
</if> </if>
</grit-part> </grit-part>
...@@ -82,6 +82,13 @@ js_library("manage_profiles_browser_proxy") { ...@@ -82,6 +82,13 @@ js_library("manage_profiles_browser_proxy") {
externs_list = [ "$externs_path/chrome_send.js" ] externs_list = [ "$externs_path/chrome_send.js" ]
} }
js_library("policy_helper") {
deps = [
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:load_time_data.m",
]
}
group("web_components") { group("web_components") {
public_deps = [ public_deps = [
":web_components_local", ":web_components_local",
......
...@@ -31,7 +31,10 @@ js_library("local_profile_customization") { ...@@ -31,7 +31,10 @@ js_library("local_profile_customization") {
"..:manage_profiles_browser_proxy", "..:manage_profiles_browser_proxy",
"..:navigation_behavior", "..:navigation_behavior",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_elements/cr_checkbox:cr_checkbox.m",
"//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button.m", "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button.m",
"//ui/webui/resources/cr_elements/cr_input:cr_input.m",
"//ui/webui/resources/js:load_time_data.m",
] ]
} }
......
<style include="profile-creation-shared"> <style include="profile-creation-shared">
:host {
--vertical-gap: 24px;
}
#title { #title {
color: var(--theme-text-color); color: var(--theme-text-color);
font-weight: normal; font-weight: normal;
padding-top: 84px; padding-top: 84px;
text-align: center; text-align: center;
} }
#nameInput {
--cr-input-placeholder-color: rgba(var(--google-grey-900-rgb), .5);
--cr-input-border-bottom: 1px solid var(--cr-secondary-text-color);
height: 32px;
margin: calc(var(--avatar-size)/2 + var(--vertical-gap)) auto 0 auto;
width: 300px;
}
#colorPicker {
height: 220px;
margin: var(--vertical-gap) auto var(--vertical-gap) auto;
width: 370px;
}
cr-checkbox {
--cr-checkbox-label-color: var(--cr-secondary-text-color);
--cr-checkbox-label-padding-start: 8px;
height: 20px;
margin: auto;
width: fit-content;
}
cr-checkbox[hidden] {
display: none;
}
@media (prefers-color-scheme: dark) {
#nameInput {
--cr-input-placeholder-color: rgba(var(--google-grey-200-rgb), .5);
}
}
</style> </style>
<div id="headerContainer" <div id="headerContainer"
...@@ -15,6 +51,21 @@ ...@@ -15,6 +51,21 @@
<cr-icon-button id="backButton" class="icon-arrow-back" <cr-icon-button id="backButton" class="icon-arrow-back"
on-click="onClickBack_" aria-label="$i18n{backButtonLabel}"> on-click="onClickBack_" aria-label="$i18n{backButtonLabel}">
</cr-icon-button> </cr-icon-button>
<h2 id="title">$i18n{localProfileCreationTitle}<h2> <h2 id="title">$i18n{localProfileCreationTitle}</h2>
<img class="avatar" src$="[[profileThemeInfo.themeGenericAvatar]]"> <img class="avatar" src$="[[profileThemeInfo.themeGenericAvatar]]">
</div> </div>
<cr-input id="nameInput" value="{{profileName_}}" pattern=".*\\S.*"
placeholder="$i18n{createProfileNamePlaceholder}"
auto-validate spellcheck="false">
</cr-input>
<!-- TODO(crbug.com/1115301): Add color picker. -->
<div id="colorPicker"
style$="background-color:[[profileThemeInfo.themeFrameColor]]">
</div>
<cr-checkbox checked="{{createShortcut_}}"
hidden="[[!isProfileShortcutsEnabled_]]">
$i18n{createDesktopShortcutLabel}
</cr-checkbox>
...@@ -3,9 +3,13 @@ ...@@ -3,9 +3,13 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; import 'chrome://resources/cr_elements/cr_icon_button/cr_icon_button.m.js';
import 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.m.js';
import 'chrome://resources/cr_elements/shared_vars_css.m.js';
import './shared_css.js'; import './shared_css.js';
import '../icons.js'; import '../icons.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.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} from '../manage_profiles_browser_proxy.js'; import {AutogeneratedThemeColorInfo} from '../manage_profiles_browser_proxy.js';
...@@ -21,10 +25,44 @@ Polymer({ ...@@ -21,10 +25,44 @@ Polymer({
profileThemeInfo: { profileThemeInfo: {
type: Object, type: Object,
}, },
/**
* The current profile name.
* @private {string}
*/
profileName_: {
type: String,
value: '',
},
/**
* if true, a desktop shortcut will be created for the new profile.
* @private {boolean}
*/
createShortcut_: {
type: Boolean,
value: true,
},
/**
* True if the profile shortcuts feature is enabled.
* @private
*/
isProfileShortcutsEnabled_: {
type: Boolean,
value: () => loadTimeData.getBoolean('profileShortcutsEnabled'),
},
}, },
/** @private */ /** @private */
onClickBack_() { onClickBack_() {
navigateToPreviousRoute(); navigateToPreviousRoute();
this.reset_();
},
/** @private */
reset_() {
this.profileName_ = '';
this.createShortcut_ = true;
}, },
}); });
<template> <template>
<style include="cr-icons profile-picker-shared"> <style include="cr-icons profile-picker-shared">
:host {
--avatar-size: 100px;
}
#headerContainer { #headerContainer {
background-color: var(--theme-frame-color); background-color: var(--theme-frame-color);
height: 266px; height: 244px;
position: relative; position: relative;
width: 100%; width: 100%;
} }
...@@ -24,7 +28,6 @@ ...@@ -24,7 +28,6 @@
} }
.avatar { .avatar {
--avatar-size: 100px;
border: 2px solid var(--md-background-color); border: 2px solid var(--md-background-color);
border-radius: 50%; border-radius: 50%;
bottom: calc(var(--avatar-size)/-2); bottom: calc(var(--avatar-size)/-2);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
#include "chrome/browser/signin/signin_util.h" #include "chrome/browser/signin/signin_util.h"
#include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/signin/profile_picker_handler.h" #include "chrome/browser/ui/webui/signin/profile_picker_handler.h"
...@@ -73,6 +74,10 @@ void AddStrings(content::WebUIDataSource* html_source) { ...@@ -73,6 +74,10 @@ void AddStrings(content::WebUIDataSource* html_source) {
IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_NOT_NOW_BUTTON_LABEL}, IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_NOT_NOW_BUTTON_LABEL},
{"localProfileCreationTitle", {"localProfileCreationTitle",
IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_TITLE}, IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_TITLE},
{"createProfileNamePlaceholder",
IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_INPUT_NAME},
{"createDesktopShortcutLabel",
IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CREATION_SHORTCUT_TEXT},
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings); AddLocalizedStringsBulk(html_source, kLocalizedStrings);
html_source->AddBoolean("askOnStartup", html_source->AddBoolean("askOnStartup",
...@@ -91,6 +96,8 @@ void AddStrings(content::WebUIDataSource* html_source) { ...@@ -91,6 +96,8 @@ void AddStrings(content::WebUIDataSource* html_source) {
html_source->AddBoolean("isGuestModeEnabled", IsGuestModeEnabled()); html_source->AddBoolean("isGuestModeEnabled", IsGuestModeEnabled());
html_source->AddBoolean("isProfileCreationAllowed", html_source->AddBoolean("isProfileCreationAllowed",
IsProfileCreationAllowed()); IsProfileCreationAllowed());
html_source->AddBoolean("profileShortcutsEnabled",
ProfileShortcutManager::IsFeatureEnabled());
// TODO(crbug.com/1063856): Check if |BrowserSignin| device policy exists. // TODO(crbug.com/1063856): Check if |BrowserSignin| device policy exists.
} }
......
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