Commit 496b99e7 authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Chrome OS: Update PIN completion screen string


Bug: 902564
Change-Id: Ia77cbc8986acc9c3767cb08dd2f50567b14ddf70
Reviewed-on: https://chromium-review.googlesource.com/c/1351464
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarWenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611546}
parent 58906f9e
......@@ -816,8 +816,11 @@
<message name="IDS_DISCOVER_PIN_SETUP_TITLE3" desc="A title of the dialog that finishes 'PIN-unlock' setup process suggesting that it was successful.">
Your PIN is added
</message>
<message name="IDS_DISCOVER_PIN_SETUP_SUBTITLE3" desc="A sub-title of the dialog that finishes 'PIN-unlock' setup process successfully suggesting how user can use the PIN that they have just set up.">
You can use PIN to unlock your device when you signed out.
<message name="IDS_DISCOVER_PIN_SETUP_SUBTITLE3_NO_LOGIN" desc="A sub-title of the dialog that finishes 'PIN-unlock' setup process successfully suggesting how user can use the PIN that they have just set up.">
You can use your PIN to unlock your device.
</message>
<message name="IDS_DISCOVER_PIN_SETUP_SUBTITLE3_WITH_LOGIN" desc="A sub-title of the dialog that finishes 'PIN-unlock' setup process successfully suggesting how user can use the PIN that they have just set up.">
You can use your PIN to sign in to or unlock your device.
</message>
<message name="IDS_DISCOVER_PIN_SETUP" desc="A label on the button that leads to Pin Unlock feature set up.">
Pin setup
......
......@@ -122,7 +122,12 @@
[[i18nDynamic(locale, 'discoverPinSetupSubtitle1')]]
</div>
<div slot="subtitle" hidden="[[isStepHidden_(step_, 'done')]]">
[[i18nDynamic(locale, 'discoverPinSetupSubtitle3')]]<BR>
<div hidden="[[hasLoginSupport_]]">
[[i18nDynamic(locale, 'discoverPinSetupSubtitle3NoLogin')]]<br>
</div>
<div hidden="[[!hasLoginSupport_]]">
[[i18nDynamic(locale, 'discoverPinSetupSubtitle3WithLogin')]]<br>
</div>
</div>
<div slot="footer" class="flex layout horizontal center-justified">
<setup-pin-keyboard id="pinKeyboard"
......
......@@ -118,6 +118,15 @@ Polymer({
type: Boolean,
value: false,
},
/**
* Should be true when device has support for PIN login.
* @private
*/
hasLoginSupport_: {
type: Boolean,
value: false,
},
},
/**
......@@ -191,6 +200,11 @@ Polymer({
/** @override */
show: function() {
this.discoverCallWithReply(
'discover.pinSetup.getHasLoginSupport', [], (is_available) => {
this.hasLoginSupport_ = is_available;
});
if (this.firstRun) {
this.getFirstRunUserPassword_();
} else {
......
......@@ -8,6 +8,7 @@
#include "base/i18n/number_formatting.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/quick_unlock/pin_backend.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/discover_handler.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
......@@ -34,15 +35,22 @@ class DiscoverModulePinSetupHandler : public DiscoverHandler {
private:
// Message handlers.
void HandleGetUserPassword(const std::string& callbackId);
void HandleGetHasLoginSupport(const std::string& callbackId);
// quick_unlock::PinBackend::HasLoginSupport callback.
void OnPinLoginAvailable(const std::string& callbackId, bool is_available);
base::WeakPtr<DiscoverModulePinSetup> module_;
base::WeakPtrFactory<DiscoverModulePinSetupHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(DiscoverModulePinSetupHandler);
};
DiscoverModulePinSetupHandler::DiscoverModulePinSetupHandler(
base::WeakPtr<DiscoverModulePinSetup> module)
: DiscoverHandler(DiscoverModulePinSetup::kModuleName), module_(module) {}
: DiscoverHandler(DiscoverModulePinSetup::kModuleName),
module_(module),
weak_factory_(this) {}
void DiscoverModulePinSetupHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
......@@ -57,7 +65,10 @@ void DiscoverModulePinSetupHandler::DeclareLocalizedValues(
builder->Add("discoverPinSetupSkip", IDS_DISCOVER_PIN_SETUP_SKIP);
builder->Add("discoverPinSetupTitle2", IDS_DISCOVER_PIN_SETUP_TITLE2);
builder->Add("discoverPinSetupTitle3", IDS_DISCOVER_PIN_SETUP_TITLE3);
builder->Add("discoverPinSetupSubtitle3", IDS_DISCOVER_PIN_SETUP_SUBTITLE3);
builder->Add("discoverPinSetupSubtitle3NoLogin",
IDS_DISCOVER_PIN_SETUP_SUBTITLE3_NO_LOGIN);
builder->Add("discoverPinSetupSubtitle3WithLogin",
IDS_DISCOVER_PIN_SETUP_SUBTITLE3_WITH_LOGIN);
builder->Add("discoverPinSetupPasswordTitle",
IDS_DISCOVER_PIN_SETUP_PASSWORD_TITLE);
builder->Add("discoverPinSetupPasswordSubTitle",
......@@ -93,6 +104,8 @@ void DiscoverModulePinSetupHandler::Initialize() {}
void DiscoverModulePinSetupHandler::RegisterMessages() {
AddCallback("discover.pinSetup.getUserPassword",
&DiscoverModulePinSetupHandler::HandleGetUserPassword);
AddCallback("discover.pinSetup.getHasLoginSupport",
&DiscoverModulePinSetupHandler::HandleGetHasLoginSupport);
}
void DiscoverModulePinSetupHandler::HandleGetUserPassword(
......@@ -103,6 +116,21 @@ void DiscoverModulePinSetupHandler::HandleGetUserPassword(
return;
}
void DiscoverModulePinSetupHandler::OnPinLoginAvailable(
const std::string& callbackId,
bool is_available) {
web_ui()->CallJavascriptFunctionUnsafe("window.discoverReturn",
base::Value(callbackId),
base::Value(is_available));
}
void DiscoverModulePinSetupHandler::HandleGetHasLoginSupport(
const std::string& callbackId) {
chromeos::quick_unlock::PinBackend::GetInstance()->HasLoginSupport(
base::BindOnce(&DiscoverModulePinSetupHandler::OnPinLoginAvailable,
weak_factory_.GetWeakPtr(), callbackId));
}
} // anonymous namespace
/* ***************************************************************** */
......
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