| OLD | NEW |
| 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> |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 { "autoclickDelayLong", | 452 { "autoclickDelayLong", |
| 453 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, | 453 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, |
| 454 { "autoclickDelayShort", | 454 { "autoclickDelayShort", |
| 455 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, | 455 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, |
| 456 { "autoclickDelayVeryLong", | 456 { "autoclickDelayVeryLong", |
| 457 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, | 457 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, |
| 458 { "autoclickDelayVeryShort", | 458 { "autoclickDelayVeryShort", |
| 459 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_SHORT }, | 459 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_SHORT }, |
| 460 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, | 460 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, |
| 461 { "changePictureCaption", IDS_OPTIONS_CHANGE_PICTURE_CAPTION }, | 461 { "changePictureCaption", IDS_OPTIONS_CHANGE_PICTURE_CAPTION }, |
| 462 { "consumerManagementDescription", | |
| 463 IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, | |
| 464 { "consumerManagementEnrollButton", | |
| 465 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, | |
| 466 { "consumerManagementEnrollingButton", | |
| 467 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLLING_BUTTON }, | |
| 468 { "consumerManagementUnenrollButton", | |
| 469 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, | |
| 470 { "consumerManagementUnenrollingButton", | |
| 471 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLLING_BUTTON }, | |
| 472 { "datetimeTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME }, | 462 { "datetimeTitle", IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME }, |
| 473 { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, | |
| 474 { "deviceGroupDescription", IDS_OPTIONS_DEVICE_GROUP_DESCRIPTION }, | 463 { "deviceGroupDescription", IDS_OPTIONS_DEVICE_GROUP_DESCRIPTION }, |
| 475 { "deviceGroupPointer", IDS_OPTIONS_DEVICE_GROUP_POINTER_SECTION }, | 464 { "deviceGroupPointer", IDS_OPTIONS_DEVICE_GROUP_POINTER_SECTION }, |
| 476 { "disableGData", IDS_OPTIONS_DISABLE_GDATA }, | 465 { "disableGData", IDS_OPTIONS_DISABLE_GDATA }, |
| 477 { "displayOptions", IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_BUTTON_LABEL }, | 466 { "displayOptions", IDS_OPTIONS_SETTINGS_DISPLAY_OPTIONS_BUTTON_LABEL }, |
| 478 { "enableContentProtectionAttestation", | 467 { "enableContentProtectionAttestation", |
| 479 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, | 468 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, |
| 480 { "enableScreenlock", IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX }, | 469 { "enableScreenlock", IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX }, |
| 481 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, | 470 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, |
| 482 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, | 471 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, |
| 483 IDS_SHORT_PRODUCT_NAME }, | 472 IDS_SHORT_PRODUCT_NAME }, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 661 |
| 673 values->SetBoolean( | 662 values->SetBoolean( |
| 674 "easyUnlockAllowed", | 663 "easyUnlockAllowed", |
| 675 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); | 664 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); |
| 676 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); | 665 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); |
| 677 values->SetBoolean("easyUnlockProximityDetectionAllowed", | 666 values->SetBoolean("easyUnlockProximityDetectionAllowed", |
| 678 base::CommandLine::ForCurrentProcess()->HasSwitch( | 667 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 679 proximity_auth::switches::kEnableProximityDetection)); | 668 proximity_auth::switches::kEnableProximityDetection)); |
| 680 | 669 |
| 681 #if defined(OS_CHROMEOS) | 670 #if defined(OS_CHROMEOS) |
| 682 values->SetBoolean("consumerManagementEnabled", | |
| 683 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 684 chromeos::switches::kEnableConsumerManagement)); | |
| 685 | |
| 686 RegisterTitle(values, "thirdPartyImeConfirmOverlay", | 671 RegisterTitle(values, "thirdPartyImeConfirmOverlay", |
| 687 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); | 672 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); |
| 688 values->SetBoolean("usingNewProfilesUI", false); | 673 values->SetBoolean("usingNewProfilesUI", false); |
| 689 #else | 674 #else |
| 690 values->SetBoolean("usingNewProfilesUI", true); | 675 values->SetBoolean("usingNewProfilesUI", true); |
| 691 #endif | 676 #endif |
| 692 | 677 |
| 693 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); | 678 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); |
| 694 | 679 |
| 695 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); | 680 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 } | 847 } |
| 863 | 848 |
| 864 void BrowserOptionsHandler::Uninitialize() { | 849 void BrowserOptionsHandler::Uninitialize() { |
| 865 registrar_.RemoveAll(); | 850 registrar_.RemoveAll(); |
| 866 g_browser_process->profile_manager()-> | 851 g_browser_process->profile_manager()-> |
| 867 GetProfileAttributesStorage().RemoveObserver(this); | 852 GetProfileAttributesStorage().RemoveObserver(this); |
| 868 #if defined(OS_WIN) | 853 #if defined(OS_WIN) |
| 869 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); | 854 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); |
| 870 #endif | 855 #endif |
| 871 #if defined(OS_CHROMEOS) | 856 #if defined(OS_CHROMEOS) |
| 872 policy::ConsumerManagementService* consumer_management = | |
| 873 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | |
| 874 GetConsumerManagementService(); | |
| 875 if (consumer_management) | |
| 876 consumer_management->RemoveObserver(this); | |
| 877 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get( | 857 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get( |
| 878 Profile::FromWebUI(web_ui())); | 858 Profile::FromWebUI(web_ui())); |
| 879 if (arc_prefs) | 859 if (arc_prefs) |
| 880 arc_prefs->RemoveObserver(this); | 860 arc_prefs->RemoveObserver(this); |
| 881 #endif | 861 #endif |
| 882 } | 862 } |
| 883 | 863 |
| 884 void BrowserOptionsHandler::OnStateChanged() { | 864 void BrowserOptionsHandler::OnStateChanged() { |
| 885 UpdateSyncState(); | 865 UpdateSyncState(); |
| 886 } | 866 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | 1064 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 1085 ->policy_service() | 1065 ->policy_service() |
| 1086 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 1066 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
| 1087 std::string())) | 1067 std::string())) |
| 1088 .Get(policy::key::kUserAvatarImage)); | 1068 .Get(policy::key::kUserAvatarImage)); |
| 1089 | 1069 |
| 1090 OnWallpaperManagedChanged( | 1070 OnWallpaperManagedChanged( |
| 1091 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 1071 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
| 1092 user->GetAccountId())); | 1072 user->GetAccountId())); |
| 1093 | 1073 |
| 1094 policy::ConsumerManagementService* consumer_management = | |
| 1095 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | |
| 1096 GetConsumerManagementService(); | |
| 1097 if (consumer_management) { | |
| 1098 OnConsumerManagementStatusChanged(); | |
| 1099 consumer_management->AddObserver(this); | |
| 1100 } | |
| 1101 | |
| 1102 if (arc::ArcAuthService::IsAllowedForProfile(profile) && | 1074 if (arc::ArcAuthService::IsAllowedForProfile(profile) && |
| 1103 !arc::ArcAuthService::IsOptInVerificationDisabled()) { | 1075 !arc::ArcAuthService::IsOptInVerificationDisabled()) { |
| 1104 base::FundamentalValue is_arc_enabled( | 1076 base::FundamentalValue is_arc_enabled( |
| 1105 arc::ArcAuthService::Get()->IsArcEnabled()); | 1077 arc::ArcAuthService::Get()->IsArcEnabled()); |
| 1106 web_ui()->CallJavascriptFunctionUnsafe( | 1078 web_ui()->CallJavascriptFunctionUnsafe( |
| 1107 "BrowserOptions.showAndroidAppsSection", | 1079 "BrowserOptions.showAndroidAppsSection", |
| 1108 is_arc_enabled); | 1080 is_arc_enabled); |
| 1109 // Get the initial state of Android Settings app readiness. | 1081 // Get the initial state of Android Settings app readiness. |
| 1110 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 1082 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 1111 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); | 1083 ArcAppListPrefs::Get(profile)->GetApp(arc::kSettingsAppId); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 } | 1575 } |
| 1604 | 1576 |
| 1605 void BrowserOptionsHandler::OnPowerwashDialogShow( | 1577 void BrowserOptionsHandler::OnPowerwashDialogShow( |
| 1606 const base::ListValue* args) { | 1578 const base::ListValue* args) { |
| 1607 UMA_HISTOGRAM_ENUMERATION( | 1579 UMA_HISTOGRAM_ENUMERATION( |
| 1608 "Reset.ChromeOS.PowerwashDialogShown", | 1580 "Reset.ChromeOS.PowerwashDialogShown", |
| 1609 chromeos::reset::DIALOG_FROM_OPTIONS, | 1581 chromeos::reset::DIALOG_FROM_OPTIONS, |
| 1610 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); | 1582 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); |
| 1611 } | 1583 } |
| 1612 | 1584 |
| 1613 void BrowserOptionsHandler::OnConsumerManagementStatusChanged() { | |
| 1614 const std::string& status = g_browser_process->platform_part()-> | |
| 1615 browser_policy_connector_chromeos()->GetConsumerManagementService()-> | |
| 1616 GetStatusString(); | |
| 1617 web_ui()->CallJavascriptFunctionUnsafe( | |
| 1618 "BrowserOptions.setConsumerManagementStatus", base::StringValue(status)); | |
| 1619 } | |
| 1620 | |
| 1621 #endif // defined(OS_CHROMEOS) | 1585 #endif // defined(OS_CHROMEOS) |
| 1622 | 1586 |
| 1623 void BrowserOptionsHandler::UpdateSyncState() { | 1587 void BrowserOptionsHandler::UpdateSyncState() { |
| 1624 web_ui()->CallJavascriptFunctionUnsafe("BrowserOptions.updateSyncState", | 1588 web_ui()->CallJavascriptFunctionUnsafe("BrowserOptions.updateSyncState", |
| 1625 *GetSyncStateDictionary()); | 1589 *GetSyncStateDictionary()); |
| 1626 | 1590 |
| 1627 // A change in sign-in state also affects how hotwording and audio history are | 1591 // A change in sign-in state also affects how hotwording and audio history are |
| 1628 // displayed. Hide all hotwording and re-display properly. | 1592 // displayed. Hide all hotwording and re-display properly. |
| 1629 web_ui()->CallJavascriptFunctionUnsafe( | 1593 web_ui()->CallJavascriptFunctionUnsafe( |
| 1630 "BrowserOptions.setAllHotwordSectionsVisible", | 1594 "BrowserOptions.setAllHotwordSectionsVisible", |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 | 2182 |
| 2219 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2183 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2220 #if defined(OS_CHROMEOS) | 2184 #if defined(OS_CHROMEOS) |
| 2221 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2185 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2222 #else | 2186 #else |
| 2223 return true; | 2187 return true; |
| 2224 #endif | 2188 #endif |
| 2225 } | 2189 } |
| 2226 | 2190 |
| 2227 } // namespace options | 2191 } // namespace options |
| OLD | NEW |