Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 2236213002: Add quick unlock Settings in options page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/environment.h" 15 #include "base/environment.h"
16 #include "base/i18n/number_formatting.h" 16 #include "base/i18n/number_formatting.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
19 #include "base/metrics/field_trial.h" 19 #include "base/metrics/field_trial.h"
20 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
21 #include "base/stl_util.h" 21 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
23 #include "base/value_conversions.h" 24 #include "base/value_conversions.h"
24 #include "base/values.h" 25 #include "base/values.h"
25 #include "build/build_config.h" 26 #include "build/build_config.h"
26 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/chrome_notification_types.h" 28 #include "chrome/browser/chrome_notification_types.h"
28 #include "chrome/browser/custom_home_pages_table_model.h" 29 #include "chrome/browser/custom_home_pages_table_model.h"
29 #include "chrome/browser/download/download_prefs.h" 30 #include "chrome/browser/download/download_prefs.h"
30 #include "chrome/browser/extensions/settings_api_helpers.h" 31 #include "chrome/browser/extensions/settings_api_helpers.h"
31 #include "chrome/browser/gpu/gpu_mode_manager.h" 32 #include "chrome/browser/gpu/gpu_mode_manager.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 #if defined(OS_CHROMEOS) 116 #if defined(OS_CHROMEOS)
116 #include "ash/common/accessibility_types.h" 117 #include "ash/common/accessibility_types.h"
117 #include "ash/common/ash_switches.h" 118 #include "ash/common/ash_switches.h"
118 #include "ash/common/system/chromeos/devicetype_utils.h" 119 #include "ash/common/system/chromeos/devicetype_utils.h"
119 #include "ash/desktop_background/user_wallpaper_delegate.h" 120 #include "ash/desktop_background/user_wallpaper_delegate.h"
120 #include "ash/shell.h" 121 #include "ash/shell.h"
121 #include "chrome/browser/browser_process_platform_part.h" 122 #include "chrome/browser/browser_process_platform_part.h"
122 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 123 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
123 #include "chrome/browser/chromeos/arc/arc_auth_service.h" 124 #include "chrome/browser/chromeos/arc/arc_auth_service.h"
125 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h"
124 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 126 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
125 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" 127 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h"
126 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 128 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
127 #include "chrome/browser/chromeos/profiles/profile_helper.h" 129 #include "chrome/browser/chromeos/profiles/profile_helper.h"
128 #include "chrome/browser/chromeos/reset/metrics.h" 130 #include "chrome/browser/chromeos/reset/metrics.h"
129 #include "chrome/browser/chromeos/settings/cros_settings.h" 131 #include "chrome/browser/chromeos/settings/cros_settings.h"
130 #include "chrome/browser/chromeos/system/timezone_util.h" 132 #include "chrome/browser/chromeos/system/timezone_util.h"
131 #include "chrome/browser/policy/profile_policy_connector.h" 133 #include "chrome/browser/policy/profile_policy_connector.h"
132 #include "chrome/browser/policy/profile_policy_connector_factory.h" 134 #include "chrome/browser/policy/profile_policy_connector_factory.h"
133 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 135 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_SHORT }, 461 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_SHORT },
460 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, 462 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE },
461 { "changePictureCaption", IDS_OPTIONS_CHANGE_PICTURE_CAPTION }, 463 { "changePictureCaption", IDS_OPTIONS_CHANGE_PICTURE_CAPTION },
462 { "datetimeTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME }, 464 { "datetimeTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME },
463 { "deviceGroupDescription", IDS_OPTIONS_DEVICE_GROUP_DESCRIPTION }, 465 { "deviceGroupDescription", IDS_OPTIONS_DEVICE_GROUP_DESCRIPTION },
464 { "deviceGroupPointer", IDS_OPTIONS_DEVICE_GROUP_POINTER_SECTION }, 466 { "deviceGroupPointer", IDS_OPTIONS_DEVICE_GROUP_POINTER_SECTION },
465 { "disableGData", IDS_OPTIONS_DISABLE_GDATA }, 467 { "disableGData", IDS_OPTIONS_DISABLE_GDATA },
466 { "displayOptions", IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_BUTTON_LABEL }, 468 { "displayOptions", IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_BUTTON_LABEL },
467 { "enableContentProtectionAttestation", 469 { "enableContentProtectionAttestation",
468 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, 470 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION },
469 { "enableScreenlock", IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX }, 471 { "manageScreenlock", IDS_OPTIONS_MANAGE_SCREENLOCKER },
470 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, 472 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON },
471 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, 473 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION,
472 IDS_SHORT_PRODUCT_NAME }, 474 IDS_SHORT_PRODUCT_NAME },
473 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING }, 475 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING },
474 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL }, 476 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL },
475 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, 477 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON },
476 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, 478 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET },
477 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING }, 479 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING },
478 { "internetOptionsButtonTitle", IDS_OPTIONS_INTERNET_OPTIONS_BUTTON_TITLE }, 480 { "internetOptionsButtonTitle", IDS_OPTIONS_INTERNET_OPTIONS_BUTTON_TITLE },
479 { "keyboardSettingsButtonTitle", 481 { "keyboardSettingsButtonTitle",
480 IDS_OPTIONS_DEVICE_GROUP_KEYBOARD_SETTINGS_BUTTON_TITLE }, 482 IDS_OPTIONS_DEVICE_GROUP_KEYBOARD_SETTINGS_BUTTON_TITLE },
481 { "manageAccountsButtonTitle", IDS_OPTIONS_ACCOUNTS_BUTTON_TITLE }, 483 { "manageAccountsButtonTitle", IDS_OPTIONS_ACCOUNTS_BUTTON_TITLE },
482 { "mouseSpeed", IDS_OPTIONS_SETTINGS_MOUSE_SPEED_DESCRIPTION }, 484 { "mouseSpeed", IDS_OPTIONS_SETTINGS_MOUSE_SPEED_DESCRIPTION },
483 { "noPointingDevices", IDS_OPTIONS_NO_POINTING_DEVICES }, 485 { "noPointingDevices", IDS_OPTIONS_NO_POINTING_DEVICES },
486 { "confirm", IDS_CONFIRM },
487 { "pinKeyboardClear", IDS_PIN_KEYBOARD_CLEAR },
488 { "configurePinChoosePinTitle",
489 IDS_SETTINGS_PEOPLE_CONFIGURE_PIN_CHOOSE_PIN_TITLE },
490 { "configurePinConfirmPinTitle",
491 IDS_SETTINGS_PEOPLE_CONFIGURE_PIN_CONFIRM_PIN_TITLE },
492 { "configurePinContinueButton",
493 IDS_SETTINGS_PEOPLE_CONFIGURE_PIN_CONTINUE_BUTTON },
494 { "configurePinMismatched", IDS_SETTINGS_PEOPLE_CONFIGURE_PIN_MISMATCHED },
495 { "configurePinTooShort", IDS_SETTINGS_PEOPLE_CONFIGURE_PIN_TOO_SHORT} ,
496 { "configurePinWeakPin", IDS_SETTINGS_PEOPLE_CONFIGURE_PIN_WEAK_PIN },
497 { "lockScreenChangePinButton",
498 IDS_SETTINGS_PEOPLE_LOCK_SCREEN_CHANGE_PIN_BUTTON},
499 { "lockScreenNone", IDS_SETTINGS_PEOPLE_LOCK_SCREEN_NONE },
500 { "lockScreenPasswordOnly", IDS_SETTINGS_PEOPLE_LOCK_SCREEN_PASSWORD_ONLY },
501 { "lockScreenPinOrPassword",
502 IDS_SETTINGS_PEOPLE_LOCK_SCREEN_PIN_OR_PASSWORD },
503 { "lockScreenSetupPinButton",
504 IDS_SETTINGS_PEOPLE_LOCK_SCREEN_SETUP_PIN_BUTTON },
505 { "lockScreenTitle", IDS_SETTINGS_PEOPLE_LOCK_SCREEN_TITLE },
506 { "passwordPromptEnterPassword",
507 IDS_SETTINGS_PEOPLE_PASSWORD_PROMPT_ENTER_PASSWORD },
508 { "passwordPromptInvalidPassword",
509 IDS_SETTINGS_PEOPLE_PASSWORD_PROMPT_INVALID_PASSWORD },
510 { "passwordPromptPasswordLabel",
511 IDS_SETTINGS_PEOPLE_PASSWORD_PROMPT_PASSWORD_LABEL },
512 { "passwordPromptTitle", IDS_SETTINGS_PEOPLE_PASSWORD_PROMPT_TITLE },
513 { "pinKeyboardPlaceholderPin", IDS_PIN_KEYBOARD_HINT_TEXT_PIN },
514 { "pinKeyboardPlaceholderPinPassword",
515 IDS_PIN_KEYBOARD_HINT_TEXT_PIN_PASSWORD },
484 { "powerSettingsButton", 516 { "powerSettingsButton",
485 IDS_OPTIONS_DEVICE_GROUP_POWER_SETTINGS_BUTTON }, 517 IDS_OPTIONS_DEVICE_GROUP_POWER_SETTINGS_BUTTON },
486 { "resolveTimezoneByGeoLocation", 518 { "resolveTimezoneByGeoLocation",
487 IDS_OPTIONS_RESOLVE_TIMEZONE_BY_GEOLOCATION_DESCRIPTION }, 519 IDS_OPTIONS_RESOLVE_TIMEZONE_BY_GEOLOCATION_DESCRIPTION },
488 { "sectionTitleDevice", IDS_OPTIONS_DEVICE_GROUP_NAME }, 520 { "sectionTitleDevice", IDS_OPTIONS_DEVICE_GROUP_NAME },
489 { "sectionTitleInternet", IDS_OPTIONS_INTERNET_OPTIONS_GROUP_LABEL }, 521 { "sectionTitleInternet", IDS_OPTIONS_INTERNET_OPTIONS_GROUP_LABEL },
490 { "storageManagerButtonTitle", 522 { "storageManagerButtonTitle",
491 IDS_OPTIONS_DEVICE_GROUP_STORAGE_MANAGER_BUTTON_TITLE }, 523 IDS_OPTIONS_DEVICE_GROUP_STORAGE_MANAGER_BUTTON_TITLE },
492 { "syncButtonTextStart", IDS_SYNC_SETUP_BUTTON_LABEL }, 524 { "syncButtonTextStart", IDS_SYNC_SETUP_BUTTON_LABEL },
493 { "thirdPartyImeConfirmDisable", IDS_CANCEL }, 525 { "thirdPartyImeConfirmDisable", IDS_CANCEL },
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 chromeos::switches::kEnableExperimentalAccessibilityFeatures)); 733 chromeos::switches::kEnableExperimentalAccessibilityFeatures));
702 734
703 chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get(); 735 chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get();
704 bool allow_bluetooth = true; 736 bool allow_bluetooth = true;
705 cros_settings->GetBoolean(chromeos::kAllowBluetooth, &allow_bluetooth); 737 cros_settings->GetBoolean(chromeos::kAllowBluetooth, &allow_bluetooth);
706 values->SetBoolean("allowBluetooth", allow_bluetooth); 738 values->SetBoolean("allowBluetooth", allow_bluetooth);
707 739
708 values->SetBoolean("enableStorageManager", 740 values->SetBoolean("enableStorageManager",
709 !base::CommandLine::ForCurrentProcess()->HasSwitch( 741 !base::CommandLine::ForCurrentProcess()->HasSwitch(
710 chromeos::switches::kDisableStorageManager)); 742 chromeos::switches::kDisableStorageManager));
743
744 values->SetBoolean("showQuickUnlockSettings",
745 chromeos::IsQuickUnlockEnabled());
746 if (chromeos::IsQuickUnlockEnabled()) {
747 values->SetString(
748 "enableScreenlock",
749 l10n_util::GetStringUTF16(
750 IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX_WITH_QUICK_UNLOCK));
751 } else {
752 values->SetString(
753 "enableScreenlock",
754 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX));
755 }
756 // Format numbers to be used on the pin keyboard.
757 for (int j = 0; j <= 9; ++j) {
758 values->SetString("pinKeyboard" + base::IntToString(j),
759 base::FormatNumber(int64_t{j}));
760 }
711 #endif 761 #endif
712 } 762 }
713 763
714 #if defined(ENABLE_PRINT_PREVIEW) 764 #if defined(ENABLE_PRINT_PREVIEW)
715 void BrowserOptionsHandler::RegisterCloudPrintValues( 765 void BrowserOptionsHandler::RegisterCloudPrintValues(
716 base::DictionaryValue* values) { 766 base::DictionaryValue* values) {
717 values->SetString("cloudPrintOptionLabel", 767 values->SetString("cloudPrintOptionLabel",
718 l10n_util::GetStringFUTF16( 768 l10n_util::GetStringFUTF16(
719 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, 769 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL,
720 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); 770 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)));
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 2232
2183 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2233 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2184 #if defined(OS_CHROMEOS) 2234 #if defined(OS_CHROMEOS)
2185 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2235 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2186 #else 2236 #else
2187 return true; 2237 return true;
2188 #endif 2238 #endif
2189 } 2239 }
2190 2240
2191 } // namespace options 2241 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options_resources.grd ('k') | chrome/browser/ui/webui/options/options_browsertest_base.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698