Commit 290a492b authored by Gustavo Sacomoto's avatar Gustavo Sacomoto Committed by Commit Bot

[EasyUnlock] Exposing a proximity threshold selector in settings.

The mocks are here:
https://docs.google.com/a/google.com/presentation/d/1GnKn5ca_KrM_BTQB-He9cCmzAQtwVF6JJJ6Lo6i4gqI/edit?usp=sharing (slide 38)

EasyUnlock is disabled:
https://screenshot.googleplex.com/2WxZMn78UgM

EasyUnlock is enabled (the default value is selected):
https://screenshot.googleplex.com/WJ0KYLa5Jhm

EasyUnlock is enabled, user is selecting the value:
https://screenshot.googleplex.com/AXUadsCLgax

Bug: 724715
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I77e3f7a2d28feb9c5c8c9557df39c61c7e9065f0
Reviewed-on: https://chromium-review.googlesource.com/580407
Commit-Queue: Gustavo Sacomoto <sacomoto@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488642}
parent 93843675
......@@ -18,6 +18,7 @@
#include "components/drive/drive_pref_names.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/proximity_auth/proximity_auth_pref_names.h"
#include "components/proxy_config/proxy_config_pref_names.h"
#include "components/safe_browsing/common/safe_browsing_prefs.h"
#include "components/search_engines/default_search_manager.h"
......@@ -226,6 +227,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_private::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[::prefs::kEnableQuickUnlockFingerprint] =
settings_private::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[proximity_auth::prefs::kEasyUnlockProximityThreshold] =
settings_private::PrefType::PREF_TYPE_NUMBER;
// Accessibility.
(*s_whitelist)[::prefs::kAccessibilitySpokenFeedbackEnabled] =
......
......@@ -86,6 +86,7 @@
'target_name': 'lock_screen',
'dependencies': [
'../compiled_resources2.gyp:route',
'../controls/compiled_resources2.gyp:settings_dropdown_menu',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data',
......
......@@ -48,6 +48,10 @@
#pinPasswordSecondaryActionDiv {
margin: auto;
}
.easy-unlock-nested-settings {
@apply(--settings-list-frame-padding);
}
</style>
<div>
......@@ -72,7 +76,7 @@
</div>
</paper-radio-button>
<paper-radio-button name="pin+password"
class="list-item underbar">
class="list-item">
<div id="pinPasswordDiv" class="start">
$i18n{lockScreenPinOrPassword}
</div>
......@@ -125,7 +129,7 @@
</template>
<template is="dom-if" if="[[easyUnlockAllowed_]]">
<div id="easyUnlock" class="settings-box two-line continuation">
<div id="easyUnlock" class="settings-box two-line">
<div class="start">
<div>$i18n{easyUnlockSectionTitle}</div>
<div class="secondary">
......@@ -151,6 +155,17 @@
</paper-button>
</template>
</div>
<iron-collapse opened="[[easyUnlockEnabled_]]">
<div class="settings-box continuation easy-unlock-nested-settings">
<div class="start">
$i18n{easyUnlockProximityThresholdLabel}
</div>
<settings-dropdown-menu
pref="{{prefs.easy_unlock.proximity_threshold}}"
menu-options="[[easyUnlockProximityThresholdMapping_]]">
</settings-dropdown-menu>
</div>
</iron-collapse>
</template>
<template is="dom-if" if="[[showPasswordPromptDialog_]]" restamp>
......
......@@ -14,6 +14,18 @@
* </settings-lock-screen>
*/
/**
* Possible values of the proximity threshould displayed to the user.
* This should be kept in sync with the enum defined here:
* components/proximity_auth/proximity_monitor_impl.cc
*/
settings.EasyUnlockProximityThreshold = {
VERY_CLOSE: 0,
CLOSE: 1,
FAR: 2,
VERY_FAR: 3,
};
Polymer({
is: 'settings-lock-screen',
......@@ -106,6 +118,36 @@ Polymer({
},
},
/**
* Returns the proximity threshold mapping to be displayed in the
* threshold selector dropdown menu.
*/
easyUnlockProximityThresholdMapping_: {
type: Array,
value: function() {
return [
{
value: settings.EasyUnlockProximityThreshold.VERY_CLOSE,
name:
loadTimeData.getString('easyUnlockProximityThresholdVeryClose')
},
{
value: settings.EasyUnlockProximityThreshold.CLOSE,
name: loadTimeData.getString('easyUnlockProximityThresholdClose')
},
{
value: settings.EasyUnlockProximityThreshold.FAR,
name: loadTimeData.getString('easyUnlockProximityThresholdFar')
},
{
value: settings.EasyUnlockProximityThreshold.VERY_FAR,
name: loadTimeData.getString('easyUnlockProximityThresholdVeryFar')
}
];
},
readOnly: true,
},
/** @private */
showEasyUnlockTurnOffDialog_: {
type: Boolean,
......
......@@ -904,6 +904,16 @@ void AddEasyUnlockStrings(content::WebUIDataSource* html_source) {
{"easyUnlockTurnOffErrorMessage",
IDS_SETTINGS_EASY_UNLOCK_TURN_OFF_ERROR_MESSAGE},
{"easyUnlockTurnOffRetryButton", IDS_SETTINGS_EASY_UNLOCK_TURN_OFF_RETRY},
{"easyUnlockProximityThresholdLabel",
IDS_SETTINGS_EASY_UNLOCK_PROXIMITY_THRESHOLD_LABEL},
{"easyUnlockProximityThresholdVeryClose",
IDS_SETTINGS_EASY_UNLOCK_PROXIMITY_THRESHOLD_VERY_CLOSE},
{"easyUnlockProximityThresholdClose",
IDS_SETTINGS_EASY_UNLOCK_PROXIMITY_THRESHOLD_CLOSE},
{"easyUnlockProximityThresholdFar",
IDS_SETTINGS_EASY_UNLOCK_PROXIMITY_THRESHOLD_FAR},
{"easyUnlockProximityThresholdVeryFar",
IDS_SETTINGS_EASY_UNLOCK_PROXIMITY_THRESHOLD_VERY_FAR},
};
AddLocalizedStringsBulk(html_source, localized_strings,
arraysize(localized_strings));
......@@ -926,6 +936,10 @@ void AddEasyUnlockStrings(content::WebUIDataSource* html_source) {
"easyUnlockTurnOffDescription",
l10n_util::GetStringFUTF16(IDS_SETTINGS_EASY_UNLOCK_TURN_OFF_DESCRIPTION,
device_name));
html_source->AddString(
"easyUnlockProximityThresholdLabel",
l10n_util::GetStringFUTF16(
IDS_SETTINGS_EASY_UNLOCK_PROXIMITY_THRESHOLD_LABEL, device_name));
html_source->AddString("easyUnlockLearnMoreURL",
chrome::kEasyUnlockLearnMoreUrl);
......
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