Commit c3a9ed64 authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Chrome OS: Disable Pin Setup input field in incognito UI.

This Cl disables pin input field whan it is displayed in incognito UI.

Bug: 900351
Change-Id: I7aae9f08403933f12cae5345075e5e94e775e3a4
Reviewed-on: https://chromium-review.googlesource.com/c/1332929
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarWenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607469}
parent 81775c6b
...@@ -134,7 +134,8 @@ ...@@ -134,7 +134,8 @@
set-modes="{{setModes}}" set-modes="{{setModes}}"
quick-unlock-private="[[quickUnlockPrivate_]]" quick-unlock-private="[[quickUnlockPrivate_]]"
write-uma="[[writeUma_]]" write-uma="[[writeUma_]]"
class="focus-on-show"> class="focus-on-show"
is-incognito-ui>
</setup-pin-keyboard> </setup-pin-keyboard>
<img id="done-illustration" hidden="[[isStepHidden_(step_, 'done')]]" <img id="done-illustration" hidden="[[isStepHidden_(step_, 'done')]]"
srcset="images/pin_illustration_1x.svg 1x, srcset="images/pin_illustration_1x.svg 1x,
......
...@@ -182,6 +182,7 @@ ...@@ -182,6 +182,7 @@
} }
#pinInput[has-content] { #pinInput[has-content] {
--cr-disabled-opacity: var(--dark-primary-opacity);
opacity: var(--dark-primary-opacity); opacity: var(--dark-primary-opacity);
} }
...@@ -203,7 +204,8 @@ ...@@ -203,7 +204,8 @@
has-content$="[[hasInput_(value)]]" invalid="[[hasError]]" has-content$="[[hasInput_(value)]]" invalid="[[hasError]]"
placeholder="[[getInputPlaceholder_(enablePassword, placeholder="[[getInputPlaceholder_(enablePassword,
enablePlaceholder)]]" enablePlaceholder)]]"
on-keydown="onInputKeyDown_" force-underline$="[[forceUnderline_]]"> on-keydown="onInputKeyDown_" force-underline$="[[forceUnderline_]]"
disabled="[[isIncognitoUi]]">
</cr-input> </cr-input>
</div> </div>
<slot select="[problem]"></slot> <slot select="[problem]"></slot>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* @type {number} * @type {number}
* @const * @const
*/ */
var REPEAT_BACKSPACE_DELAY_MS = 150; const REPEAT_BACKSPACE_DELAY_MS = 150;
/** /**
* How long the backspace button must be held down before auto backspace * How long the backspace button must be held down before auto backspace
...@@ -37,7 +37,7 @@ var REPEAT_BACKSPACE_DELAY_MS = 150; ...@@ -37,7 +37,7 @@ var REPEAT_BACKSPACE_DELAY_MS = 150;
* @type {number} * @type {number}
* @const * @const
*/ */
var INITIAL_BACKSPACE_DELAY_MS = 500; const INITIAL_BACKSPACE_DELAY_MS = 500;
/** /**
* The key codes of the keys allowed to be used on the pin input, in addition to * The key codes of the keys allowed to be used on the pin input, in addition to
...@@ -45,7 +45,7 @@ var INITIAL_BACKSPACE_DELAY_MS = 500; ...@@ -45,7 +45,7 @@ var INITIAL_BACKSPACE_DELAY_MS = 500;
* @type {Array<number>} * @type {Array<number>}
* @const * @const
*/ */
var PIN_INPUT_ALLOWED_NON_NUMBER_KEY_CODES = [8, 9, 37, 39]; const PIN_INPUT_ALLOWED_NON_NUMBER_KEY_CODES = [8, 9, 37, 39];
Polymer({ Polymer({
is: 'pin-keyboard', is: 'pin-keyboard',
...@@ -119,6 +119,15 @@ Polymer({ ...@@ -119,6 +119,15 @@ Polymer({
type: Boolean, type: Boolean,
value: false, value: false,
}, },
/**
* Turns on "incognito mode". (FIXME after https://crbug.com/900351 is
* fixed).
*/
isIncognitoUi: {
type: Boolean,
value: false,
},
}, },
listeners: { listeners: {
...@@ -211,11 +220,11 @@ Polymer({ ...@@ -211,11 +220,11 @@ Polymer({
* @private * @private
*/ */
onNumberTap_: function(event) { onNumberTap_: function(event) {
var numberValue = event.target.getAttribute('value'); let numberValue = event.target.getAttribute('value');
// Add the number where the caret is, then update the selection range of the // Add the number where the caret is, then update the selection range of the
// input element. // input element.
var selectionStart = this.selectionStart_; let selectionStart = this.selectionStart_;
this.value = this.value.substring(0, this.selectionStart_) + numberValue + this.value = this.value.substring(0, this.selectionStart_) + numberValue +
this.value.substring(this.selectionEnd_); this.value.substring(this.selectionEnd_);
...@@ -254,8 +263,8 @@ Polymer({ ...@@ -254,8 +263,8 @@ Polymer({
// If the input is shown, clear the text based on the caret location or // If the input is shown, clear the text based on the caret location or
// selected region of the input element. If it is just a caret, remove the // selected region of the input element. If it is just a caret, remove the
// character in front of the caret. // character in front of the caret.
var selectionStart = this.selectionStart_; let selectionStart = this.selectionStart_;
var selectionEnd = this.selectionEnd_; let selectionEnd = this.selectionEnd_;
if (selectionStart == selectionEnd && selectionStart) if (selectionStart == selectionEnd && selectionStart)
selectionStart--; selectionStart--;
......
...@@ -82,7 +82,8 @@ Where: ...@@ -82,7 +82,8 @@ Where:
<pin-keyboard id="pinKeyboard" on-pin-change="onPinChange_" <pin-keyboard id="pinKeyboard" on-pin-change="onPinChange_"
on-submit="onPinSubmit_" value="{{pinKeyboardValue_}}" on-submit="onPinSubmit_" value="{{pinKeyboardValue_}}"
has-error="[[hasError_(problemMessageId_, problemClass_)]]" has-error="[[hasError_(problemMessageId_, problemClass_)]]"
enable-placeholder="[[enablePlaceholder]]"> enable-placeholder="[[enablePlaceholder]]"
is-incognito-ui="[[isIncognitoUi]]">
<!-- Warning/error; only shown if title is hidden. --> <!-- Warning/error; only shown if title is hidden. -->
<div id="problemDiv" class$="[[problemClass_]]" <div id="problemDiv" class$="[[problemClass_]]"
invisible$="[[!problemMessageId_]]" problem> invisible$="[[!problemMessageId_]]" problem>
......
...@@ -135,6 +135,15 @@ Polymer({ ...@@ -135,6 +135,15 @@ Polymer({
type: Boolean, type: Boolean,
value: false, value: false,
}, },
/**
* Turns on "incognito mode". (FIXME after https://crbug.com/900351 is
* fixed).
*/
isIncognitoUi: {
type: Boolean,
value: false,
},
}, },
focus: function() { focus: function() {
......
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