Commit 685c1001 authored by Yulun Wu's avatar Yulun Wu Committed by Commit Bot

Add Ekko and Bard assets for fingerprint UI. No translation required.

Improper use of GetLsbReleaseBoard() is tracked here:

https://bugs.chromium.org/p/chromium/issues/detail?id=938738

Bug: b:120050686
Change-Id: I386fff94be6350ce9ae80e4891251e92d31fb92a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1501760Reviewed-by: default avatarDan Erat <derat@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638348}
parent 95fbeff5
......@@ -4,9 +4,14 @@
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h"
#include <string>
#include <vector>
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/no_destructor.h"
#include "base/strings/string_split.h"
#include "base/system/sys_info.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
......@@ -110,6 +115,17 @@ bool IsPinEnabled(PrefService* pref_service) {
return base::FeatureList::IsEnabled(features::kQuickUnlockPin);
}
// Returns true if the fingerprint sensor is on the keyboard.
// TODO(crbug.com/938738): Replace this disallowed board name reference
// with a flag that's determined based on settings from chromeos-config.
bool IsFingerprintReaderOnKeyboard() {
const std::vector<std::string> board =
base::SplitString(base::SysInfo::GetLsbReleaseBoard(), "-",
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
const std::string board_name = board[0];
return board_name == "nami";
}
bool IsFingerprintEnabled(Profile* profile) {
if (enable_for_testing_)
return true;
......
......@@ -42,6 +42,12 @@ bool IsPinEnabled(PrefService* pref_service);
// Returns true if the fingerprint is allowed for specified profile.
bool IsFingerprintEnabled(Profile* profile);
// Whether fingerprint setup UI should use resources that indicate the
// fingerprint sensor placement for laptops, rather than tablets.
// TODO(yulunwu): Reevaluate this once the fingerprint UI settings are supported
// by cros_config.
bool IsFingerprintReaderOnKeyboard();
// Forcibly enable all quick-unlock modes for testing.
void EnableForTesting();
......
......@@ -3,7 +3,7 @@
* found in the LICENSE file. */
[slot='subtitle'] {
color: #5F6368;
color: rgb(95, 99, 104);
font-weight: 400; /* roboto-regular */
}
......@@ -27,7 +27,7 @@
#sensorLocation {
background-image:
url(chrome://theme/IDR_LOGIN_FINGERPRINT_SCANNER_ANIMATION);
url(chrome://oobe/fingerprint_scanner_animation.png);
background-size: 352px 242px;
height: 242px;
width: 352px;
......
......@@ -22,8 +22,17 @@
};
}
.fingerprint-scanner-tablet {
background:
url(chrome://theme/IDR_LOGIN_FINGERPRINT_SCANNER_TABLET_ANIMATION);
}
.fingerprint-scanner-laptop {
background:
url(chrome://theme/IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_ANIMATION);
}
#scannerLocation {
background: url(chrome://theme/IDR_LOGIN_FINGERPRINT_SCANNER_ANIMATION);
background-position: center;
background-repeat: no-repeat;
background-size: 298px 205px;
......@@ -55,6 +64,7 @@
<span>[[getInstructionMessage_(step_, problemMessage_)]]</span>
</div>
<div id="scannerLocation" hidden="[[!showScannerLocation_(step_)]]"
class$="[[getFingerprintScannerAnimationClass_()]]"
aria-label="$i18n{configureFingerprintScannerStepAriaLabel}"
aria-live="polite" >
</div>
......
......@@ -300,5 +300,17 @@ Polymer({
this.$.arc.setProgress(oldValue, newValue, newValue === 100);
},
/**
* Returns the class name for fingerprint scanner animation.
* @private
*/
getFingerprintScannerAnimationClass_: function() {
if (loadTimeData.getBoolean('fingerprintUnlockEnabled') &&
loadTimeData.getBoolean('isFingerprintReaderOnKeyboard')) {
return 'fingerprint-scanner-laptop';
}
return 'fingerprint-scanner-tablet';
},
});
})();
......@@ -7,6 +7,7 @@
#include <stddef.h>
#include <memory>
#include <string>
#include <utility>
#include "ash/public/cpp/ash_features.h"
......@@ -23,6 +24,7 @@
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_view.h"
#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_view.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h"
#include "chrome/browser/chromeos/login/screens/demo_preferences_screen_view.h"
#include "chrome/browser/chromeos/login/screens/demo_setup_screen_view.h"
#include "chrome/browser/chromeos/login/screens/error_screen.h"
......@@ -103,6 +105,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
#include "ui/display/display.h"
#include "ui/events/devices/input_device.h"
#include "ui/events/devices/input_device_manager.h"
......@@ -196,6 +199,16 @@ void AddEnterpriseEnrollmentResources(content::WebUIDataSource* source) {
source->AddResourcePath(kEnrollmentJSPath, IDR_OOBE_ENROLLMENT_JS);
}
void AddFingerprintResources(content::WebUIDataSource* source) {
if (quick_unlock::IsFingerprintReaderOnKeyboard()) {
source->AddResourcePath("fingerprint_scanner_animation.png",
IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_ANIMATION);
} else {
source->AddResourcePath("fingerprint_scanner_animation.png",
IDR_LOGIN_FINGERPRINT_SCANNER_TABLET_ANIMATION);
}
}
// Default and non-shared resource definition for kOobeDisplay display type.
// chrome://oobe/oobe
void AddOobeDisplayTypeDefaultResources(content::WebUIDataSource* source) {
......@@ -251,6 +264,7 @@ content::WebUIDataSource* CreateOobeUIDataSource(
// Configure shared resources
AddProductLogoResources(source);
AddFingerprintResources(source);
AddSyncConsentResources(source);
AddArcScreensResources(source);
AddEnterpriseEnrollmentResources(source);
......
......@@ -113,6 +113,7 @@
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "components/arc/arc_util.h"
#include "ui/base/ui_base_features.h"
#include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
#else // !defined(OS_CHROMEOS)
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/ui/webui/settings/settings_default_browser_handler.h"
......@@ -312,9 +313,15 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
html_source->AddBoolean(
"quickUnlockDisabledByPolicy",
chromeos::quick_unlock::IsPinDisabledByPolicy(profile->GetPrefs()));
html_source->AddBoolean(
"fingerprintUnlockEnabled",
chromeos::quick_unlock::IsFingerprintEnabled(profile));
const bool fingerprint_unlock_enabled =
chromeos::quick_unlock::IsFingerprintEnabled(profile);
html_source->AddBoolean("fingerprintUnlockEnabled",
fingerprint_unlock_enabled);
if (fingerprint_unlock_enabled) {
html_source->AddBoolean(
"isFingerprintReaderOnKeyboard",
chromeos::quick_unlock::IsFingerprintReaderOnKeyboard());
}
html_source->AddBoolean("lockScreenNotificationsEnabled",
ash::features::IsLockScreenNotificationsEnabled());
html_source->AddBoolean(
......
......@@ -96,7 +96,8 @@
<!-- Fingerprint images. -->
<structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_ICON_ANIMATION" file="fingerprint/fingerprint.png" />
<structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_ENROLLMENT_COMPLETE_ANIMATION" file="fingerprint/tick.png" />
<structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_SCANNER_ANIMATION" file="fingerprint/fingerprint_scanner.png" />
<structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_SCANNER_TABLET_ANIMATION" file="fingerprint/fingerprint_scanner.png" />
<structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_ANIMATION" file="fingerprint/fingerprint_scanner_laptop.png" />
</structures>
</release>
......
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