Commit be738df8 authored by wzang's avatar wzang Committed by Commit bot

Fork PIN keyboard assets and create additional flag for lock screen

Fork relevant assets (as follow-up to CL 2855883005) so that the new
design of lock screen can be implemented in tandem with login screen.

The recently added flag (kShowMdLogin) is reserved for views-based login
and lock screen as they are being implemented.

The new flag added by this CL (kShowNonViewMdLogin) is a temporary flag
used until the views-based screens become available.

The two flags should not be used together.

BUG=718174
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2874303003
Cr-Commit-Position: refs/heads/master@{#471449}
parent 42a0166c
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
<if expr="chromeos"> <if expr="chromeos">
<structure name="IDR_LOCK_HTML" file="resources\chromeos\login\lock.html" flattenhtml="true" type="chrome_html" variables="OOBE=lock" expand_variables="true"/> <structure name="IDR_LOCK_HTML" file="resources\chromeos\login\lock.html" flattenhtml="true" type="chrome_html" variables="OOBE=lock" expand_variables="true"/>
<structure name="IDR_LOCK_JS" file="resources\chromeos\login\lock.js" flattenhtml="true" type="chrome_html" variables="OOBE=lock" expand_variables="true" /> <structure name="IDR_LOCK_JS" file="resources\chromeos\login\lock.js" flattenhtml="true" type="chrome_html" variables="OOBE=lock" expand_variables="true" />
<structure name="IDR_MD_LOCK_HTML" file="resources\chromeos\login\md_lock.html" flattenhtml="true" type="chrome_html" variables="OOBE=md_lock" expand_variables="true"/>
<structure name="IDR_MD_LOCK_JS" file="resources\chromeos\login\md_lock.js" flattenhtml="true" type="chrome_html" />
<structure name="IDR_LOGIN_HTML" file="resources\chromeos\login\login.html" flattenhtml="true" type="chrome_html" variables="OOBE=login" expand_variables="true"/> <structure name="IDR_LOGIN_HTML" file="resources\chromeos\login\login.html" flattenhtml="true" type="chrome_html" variables="OOBE=login" expand_variables="true"/>
<structure name="IDR_LOGIN_JS" file="resources\chromeos\login\login.js" flattenhtml="true" type="chrome_html" /> <structure name="IDR_LOGIN_JS" file="resources\chromeos\login\login.js" flattenhtml="true" type="chrome_html" />
<structure name="IDR_MD_LOGIN_HTML" file="resources\chromeos\login\md_login.html" flattenhtml="true" type="chrome_html" variables="OOBE=md_login" expand_variables="true"/> <structure name="IDR_MD_LOGIN_HTML" file="resources\chromeos\login\md_login.html" flattenhtml="true" type="chrome_html" variables="OOBE=md_login" expand_variables="true"/>
...@@ -72,6 +74,8 @@ ...@@ -72,6 +74,8 @@
<structure name="IDR_CUSTOM_ELEMENTS_LOGIN_JS" file="resources\chromeos\login\custom_elements_login.js" flattenhtml="true" type="chrome_html" /> <structure name="IDR_CUSTOM_ELEMENTS_LOGIN_JS" file="resources\chromeos\login\custom_elements_login.js" flattenhtml="true" type="chrome_html" />
<structure name="IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML" file="resources\chromeos\quick_unlock\pin_keyboard.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" /> <structure name="IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML" file="resources\chromeos\quick_unlock\pin_keyboard.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
<structure name="IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS" file="resources\chromeos\quick_unlock\pin_keyboard.js" type="chrome_html" /> <structure name="IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS" file="resources\chromeos\quick_unlock\pin_keyboard.js" type="chrome_html" />
<structure name="IDR_MD_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML" file="resources\chromeos\quick_unlock\md_pin_keyboard.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
<structure name="IDR_MD_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS" file="resources\chromeos\quick_unlock\md_pin_keyboard.js" type="chrome_html" />
</if> </if>
<structure name="IDR_SIGNIN_SHARED_CSS_HTML" file="resources\signin\signin_shared_css.html" preprocess="true" allowexternalscript="true" type="chrome_html" /> <structure name="IDR_SIGNIN_SHARED_CSS_HTML" file="resources\signin\signin_shared_css.html" preprocess="true" allowexternalscript="true" type="chrome_html" />
<if expr="not is_android and not is_ios and not chromeos"> <if expr="not is_android and not is_ios and not chromeos">
......
...@@ -221,6 +221,7 @@ void DeriveCommandLine(const GURL& start_url, ...@@ -221,6 +221,7 @@ void DeriveCommandLine(const GURL& start_url,
chromeos::switches::kLoginProfile, chromeos::switches::kLoginProfile,
chromeos::switches::kNaturalScrollDefault, chromeos::switches::kNaturalScrollDefault,
chromeos::switches::kShowMdLogin, chromeos::switches::kShowMdLogin,
chromeos::switches::kShowNonViewMdLogin,
chromeos::switches::kSystemInDevMode, chromeos::switches::kSystemInDevMode,
policy::switches::kDeviceManagementUrl, policy::switches::kDeviceManagementUrl,
wm::switches::kWindowAnimationsDisabled, wm::switches::kWindowAnimationsDisabled,
......
<!doctype html>
<html i18n-values="dir:textdirection;
build:buildType;
highlight:highlightStrength;
lang:language">
<head>
<meta charset="utf-8">
<meta name="google" value="notranslate">
<title i18n-content="title"></title>
<include src="login_shared.html">
<!-- custom_elements.html (polymer) gets lazily-loaded in lock.js -->
<script src="chrome://oobe/lock.js"></script>
</head>
<body i18n-values=".style.fontFamily:fontfamily;" class="chromeos">
<include src="screen_container.html">
<script src="chrome://resources/js/i18n_template.js"></script>
</body>
</html>
// Copyright (c) 2016 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.
/**
* @fileoverview Login UI based on a stripped down OOBE controller.
*/
// <include src="login_shared.js">
/**
* Ensures that the pin keyboard is loaded.
* @param {function()} onLoaded Callback run when the pin keyboard is loaded.
*/
function ensurePinKeyboardLoaded(onLoaded) {
'use strict';
// The element we want to see if loaded.
var getPinKeyboard = function() {
return $('pod-row').querySelectorAll('pin-keyboard')[0];
};
// Do not reload assets if they are already loaded. Run |onLoaded| once assets
// are done loading, though.
if (cr.ui.login.ResourceLoader.hasDeferredAssets('custom-elements')) {
cr.ui.login.ResourceLoader.waitUntilLayoutComplete(getPinKeyboard,
onLoaded);
return;
}
// Register loader for custom elements.
cr.ui.login.ResourceLoader.registerAssets({
id: 'custom-elements',
html: [{ url: 'chrome://oobe/custom_elements.html' }]
});
// We only load the PIN element when it is actually shown so that lock screen
// load times remain low when the user is not using a PIN.
//
// Loading the PIN element blocks the DOM, which will interrupt any running
// animations. We load the PIN after an idle notification to allow the pod
// fly-in animation to complete without interruption.
cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', function() {
cr.ui.login.ResourceLoader.waitUntilLayoutComplete(getPinKeyboard,
onLoaded);
});
}
cr.define('cr.ui.Oobe', function() {
return {
/**
* Initializes the OOBE flow. This will cause all C++ handlers to
* be invoked to do final setup.
*/
initialize: function() {
cr.ui.login.DisplayManager.initialize();
login.AccountPickerScreen.register();
cr.ui.Bubble.decorate($('bubble'));
login.HeaderBar.decorate($('login-header-bar'));
chrome.send('screenStateInitialize');
},
/**
* Notification from the host that the PIN keyboard will be used in the
* lock session so it should also get preloaded.
*/
preloadPinKeyboard: function() {
ensurePinKeyboardLoaded(function() {});
},
// Dummy Oobe functions not present with stripped login UI.
initializeA11yMenu: function(e) {},
handleAccessibilityLinkClick: function(e) {},
handleSpokenFeedbackClick: function(e) {},
handleHighContrastClick: function(e) {},
handleScreenMagnifierClick: function(e) {},
setUsageStats: function(checked) {},
setOemEulaUrl: function(oemEulaUrl) {},
setTpmPassword: function(password) {},
refreshA11yInfo: function(data) {},
reloadEulaContent: function(data) {},
/**
* Reloads content of the page.
* @param {!Object} data New dictionary with i18n values.
*/
reloadContent: function(data) {
loadTimeData.overrideValues(data);
i18nTemplate.process(document, loadTimeData);
Oobe.getInstance().updateLocalizedContent_();
},
};
});
<include src="../../../../../ui/login/account_picker/screen_account_picker.html">
\ No newline at end of file
<!-- TODO(crbug.com/603217): Use i18n instead of string literals. Figure out
what i18n to use for keypad, ie, does 1 ABC make
sense in every scenario? -->
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-iconset-svg.html">
<iron-iconset-svg name="pin-keyboard" size="24">
<svg>
<defs>
<!--
Inlined from Polymer's iron-icons to avoid importing everything.
See http://goo.gl/Y1OdAq for instructions on adding additional icons.
-->
<g id="arrow-forward">
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z">
</path>
</g>
<g id="backspace">
<path d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-3 12.59L17.59 17 14 13.41 10.41 17 9 15.59 12.59 12 9 8.41 10.41 7 14 10.59 17.59 7 19 8.41 15.41 12 19 15.59z">
</g>
</defs>
</svg>
</iron-iconset-svg>
<dom-module id="pin-keyboard">
<template>
<style include="cr-shared-style">
:host {
outline: none;
}
:host(:not([enable-submit-button])) #pinInput {
left: 0;
text-align: center;
width: 180px;
}
#root {
direction: ltr;
display: flex;
}
.row {
display: flex;
}
.digit-button {
align-items: center;
background: none;
border-radius: 0;
box-sizing: border-box;
color: #000;
display: flex;
flex-direction: column;
font-size: 18px;
height: 48px;
justify-content: center;
margin: 0;
min-height: 48px;
min-width: 48px;
opacity: 0.87;
padding: 15px 21px;
width: 60px;
}
[hidden=true] {
display: none;
}
.first-row {
height: 43px;
}
.bottom-row {
margin-bottom: 6px;
}
.top-row {
margin-top: 6px;
}
.backspace-button-container {
position: relative;
}
.backspace-button-container paper-ripple {
position: absolute;
top: 0;
}
paper-ripple {
border-radius: 100px;
color: #000;
height: 48px;
left: 6px;
width: 48px;
}
.digit-button.backspace-button {
left: 0;
opacity: var(--dark-primary-opacity);
padding: 14px;
position: absolute;
top: 0;
}
.digit-button.backspace-button:not([has-content]) {
color: #000;
opacity: 0.26;
}
.digit-button inner-text {
color: var(--paper-blue-grey-700);
display: flex;
flex-direction: column;
height: 52px;
}
#pinInput {
background-color: white;
border: 0;
box-sizing: border-box;
font-face: Roboto-Regular;
font-size: 13px;
height: 43px;
left: 10px;
opacity: var(--dark-secondary-opacity);
outline: 0;
position: relative;
width: 127px;
--paper-input-container-input: {
caret-color: var(--paper-input-container-focus-color);
}
}
#pinInput[has-content] {
opacity: var(--dark-primary-opacity);
}
#pinInput[is-input-rtl] {
direction: rtl;
}
#pinInput[type=number]::-webkit-inner-spin-button,
#pinInput[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
.separator {
border-bottom: var(--cr-separator-line);
margin: 0 10px;
position: relative;
}
/* Ensure that all children of paper-button do not consume events. This
* simplifies the event handler code. */
paper-button * {
pointer-events: none;
}
</style>
<div id="root">
<div id="container-constrained-width">
<div class="row first-row">
<paper-input id="pinInput" type="password" no-label-float
value="[[value]]"
is-input-rtl$="[[isInputRtl_(value)]]"
has-content$="[[hasInput_(value)]]"
label="[[getInputPlaceholder_(enablePassword)]]"
on-keydown="onInputKeyDown_"
hidden="[[!showPinInput_]]">
</paper-input>
</div>
<div class="separator" hidden="[[showPinInput_]]"></div>
<div class="row keyboard">
<paper-button class="digit-button" on-tap="onNumberTap_" value="1"
noink>
<inner-text>$i18n{pinKeyboard1}</inner-text>
<paper-ripple>
</paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="2"
noink>
<inner-text>$i18n{pinKeyboard2}</inner-text>
<paper-ripple>
</paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="3"
noink>
<inner-text>$i18n{pinKeyboard3}</inner-text>
<paper-ripple>
</paper-button>
</div>
<div class="row keyboard">
<paper-button class="digit-button" on-tap="onNumberTap_" value="4"
noink>
<inner-text>$i18n{pinKeyboard4}</inner-text>
<paper-ripple>
</paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="5"
noink>
<inner-text>$i18n{pinKeyboard5}</inner-text>
<paper-ripple>
</paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="6"
noink>
<inner-text>$i18n{pinKeyboard6}</inner-text>
<paper-ripple>
</paper-button>
</div>
<div class="row keyboard">
<paper-button class="digit-button" on-tap="onNumberTap_" value="7"
noink>
<inner-text>$i18n{pinKeyboard7}</inner-text>
<paper-ripple>
</paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="8"
noink>
<inner-text>$i18n{pinKeyboard8}</inner-text>
<paper-ripple>
</paper-button>
<paper-button class="digit-button" on-tap="onNumberTap_" value="9"
noink>
<inner-text>$i18n{pinKeyboard9}</inner-text>
<paper-ripple>
</paper-button>
</div>
<div class="row keyboard bottom-row">
<div class="digit-button"></div>
<paper-button class="digit-button" on-tap="onNumberTap_" value="0"
noink>
<inner-text>$i18n{pinKeyboard0}</inner-text>
<paper-ripple>
</paper-button>
<div class="backspace-button-container">
<paper-icon-button class="digit-button backspace-button"
has-content$="[[hasInput_(value)]]"
icon="pin-keyboard:backspace"
on-pointerdown="onBackspacePointerDown_"
on-pointerout="onBackspacePointerOut_"
on-pointerup="onBackspacePointerUp_"
aria-label="$i18n{pinKeyboardDeleteAccessibleName}"
noink>
</paper-icon-button>
<paper-ripple>
</div>
</div>
</div>
</div>
</template>
<script src="pin_keyboard.js"></script>
</dom-module>
...@@ -142,19 +142,29 @@ content::WebUIDataSource* CreateOobeUIDataSource( ...@@ -142,19 +142,29 @@ content::WebUIDataSource* CreateOobeUIDataSource(
IDR_CUSTOM_ELEMENTS_OOBE_HTML); IDR_CUSTOM_ELEMENTS_OOBE_HTML);
source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS); source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_OOBE_JS);
} else if (display_type == OobeUI::kLockDisplay) { } else if (display_type == OobeUI::kLockDisplay) {
source->SetDefaultResource(IDR_LOCK_HTML); if (command_line->HasSwitch(chromeos::switches::kShowNonViewMdLogin)) {
source->AddResourcePath(kLockJSPath, IDR_LOCK_JS); source->SetDefaultResource(IDR_MD_LOCK_HTML);
source->AddResourcePath(kLockJSPath, IDR_MD_LOCK_JS);
source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath,
IDR_MD_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML);
source->AddResourcePath(kCustomElementsPinKeyboardJSPath,
IDR_MD_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS);
} else {
source->SetDefaultResource(IDR_LOCK_HTML);
source->AddResourcePath(kLockJSPath, IDR_LOCK_JS);
source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath,
IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML);
source->AddResourcePath(kCustomElementsPinKeyboardJSPath,
IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS);
}
source->AddResourcePath(kCustomElementsHTMLPath, source->AddResourcePath(kCustomElementsHTMLPath,
IDR_CUSTOM_ELEMENTS_LOCK_HTML); IDR_CUSTOM_ELEMENTS_LOCK_HTML);
source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS); source->AddResourcePath(kCustomElementsJSPath, IDR_CUSTOM_ELEMENTS_LOCK_JS);
source->AddResourcePath(kCustomElementsPinKeyboardHTMLPath,
IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_HTML);
source->AddResourcePath(kCustomElementsPinKeyboardJSPath,
IDR_CUSTOM_ELEMENTS_PIN_KEYBOARD_JS);
source->AddResourcePath(kCustomElementsUserPodHTMLPath, source->AddResourcePath(kCustomElementsUserPodHTMLPath,
IDR_CUSTOM_ELEMENTS_USER_POD_HTML); IDR_CUSTOM_ELEMENTS_USER_POD_HTML);
} else { } else {
if (command_line->HasSwitch(chromeos::switches::kShowMdLogin)) { if (command_line->HasSwitch(chromeos::switches::kShowMdLogin) ||
command_line->HasSwitch(chromeos::switches::kShowNonViewMdLogin)) {
source->SetDefaultResource(IDR_MD_LOGIN_HTML); source->SetDefaultResource(IDR_MD_LOGIN_HTML);
source->AddResourcePath(kLoginJSPath, IDR_MD_LOGIN_JS); source->AddResourcePath(kLoginJSPath, IDR_MD_LOGIN_JS);
} else { } else {
......
...@@ -427,9 +427,12 @@ const char kOobeSkipPostLogin[] = "oobe-skip-postlogin"; ...@@ -427,9 +427,12 @@ const char kOobeSkipPostLogin[] = "oobe-skip-postlogin";
// Interval at which we check for total time on OOBE. // Interval at which we check for total time on OOBE.
const char kOobeTimerInterval[] = "oobe-timer-interval"; const char kOobeTimerInterval[] = "oobe-timer-interval";
// If true, the md login and lock screens will be shown. // If true, the views-based md login and lock screens will be shown.
const char kShowMdLogin[] = "show-md-login"; const char kShowMdLogin[] = "show-md-login";
// If true, the non-views-based md login and lock screens will be shown.
const char kShowNonViewMdLogin[] = "show-non-view-md-login";
// Specifies power stub behavior: // Specifies power stub behavior:
// 'cycle=2' - Cycles power states every 2 seconds. // 'cycle=2' - Cycles power states every 2 seconds.
// See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details. // See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details.
......
...@@ -129,6 +129,7 @@ CHROMEOS_EXPORT extern const char kOobeGuestSession[]; ...@@ -129,6 +129,7 @@ CHROMEOS_EXPORT extern const char kOobeGuestSession[];
CHROMEOS_EXPORT extern const char kOobeSkipPostLogin[]; CHROMEOS_EXPORT extern const char kOobeSkipPostLogin[];
CHROMEOS_EXPORT extern const char kOobeTimerInterval[]; CHROMEOS_EXPORT extern const char kOobeTimerInterval[];
CHROMEOS_EXPORT extern const char kShowMdLogin[]; CHROMEOS_EXPORT extern const char kShowMdLogin[];
CHROMEOS_EXPORT extern const char kShowNonViewMdLogin[];
CHROMEOS_EXPORT extern const char kPowerStub[]; CHROMEOS_EXPORT extern const char kPowerStub[];
CHROMEOS_EXPORT extern const char kShillStub[]; CHROMEOS_EXPORT extern const char kShillStub[];
CHROMEOS_EXPORT extern const char kSmsTestMessages[]; CHROMEOS_EXPORT extern const char kSmsTestMessages[];
......
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