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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 #if !defined(OS_CHROMEOS) | 94 #if !defined(OS_CHROMEOS) |
95 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 95 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
96 #endif | 96 #endif |
97 | 97 |
98 #if defined(OS_CHROMEOS) | 98 #if defined(OS_CHROMEOS) |
99 #include "ash/ash_switches.h" | 99 #include "ash/ash_switches.h" |
100 #include "ash/desktop_background/user_wallpaper_delegate.h" | 100 #include "ash/desktop_background/user_wallpaper_delegate.h" |
101 #include "ash/magnifier/magnifier_constants.h" | 101 #include "ash/magnifier/magnifier_constants.h" |
102 #include "ash/shell.h" | 102 #include "ash/shell.h" |
| 103 #include "chrome/browser/browser_process_platform_part.h" |
103 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 104 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
104 #include "chrome/browser/chromeos/chromeos_utils.h" | 105 #include "chrome/browser/chromeos/chromeos_utils.h" |
105 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 106 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
106 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 107 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
107 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 108 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
108 #include "chrome/browser/chromeos/reset/metrics.h" | 109 #include "chrome/browser/chromeos/reset/metrics.h" |
109 #include "chrome/browser/chromeos/settings/cros_settings.h" | 110 #include "chrome/browser/chromeos/settings/cros_settings.h" |
110 #include "chrome/browser/chromeos/settings/device_settings_service.h" | |
111 #include "chrome/browser/chromeos/system/timezone_util.h" | 111 #include "chrome/browser/chromeos/system/timezone_util.h" |
112 #include "chrome/browser/policy/profile_policy_connector.h" | 112 #include "chrome/browser/policy/profile_policy_connector.h" |
113 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 113 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
114 #include "chrome/browser/ui/browser_window.h" | 114 #include "chrome/browser/ui/browser_window.h" |
115 #include "chromeos/dbus/dbus_thread_manager.h" | 115 #include "chromeos/dbus/dbus_thread_manager.h" |
116 #include "chromeos/dbus/power_manager_client.h" | 116 #include "chromeos/dbus/power_manager_client.h" |
117 #include "components/policy/core/common/policy_map.h" | 117 #include "components/policy/core/common/policy_map.h" |
118 #include "components/policy/core/common/policy_namespace.h" | 118 #include "components/policy/core/common/policy_namespace.h" |
119 #include "components/policy/core/common/policy_service.h" | 119 #include "components/policy/core/common/policy_service.h" |
120 #include "components/user_manager/user.h" | 120 #include "components/user_manager/user.h" |
121 #include "components/user_manager/user_manager.h" | 121 #include "components/user_manager/user_manager.h" |
122 #include "policy/policy_constants.h" | 122 #include "policy/policy_constants.h" |
123 #include "policy/proto/device_management_backend.pb.h" | |
124 #include "ui/gfx/image/image_skia.h" | 123 #include "ui/gfx/image/image_skia.h" |
125 #endif // defined(OS_CHROMEOS) | 124 #endif // defined(OS_CHROMEOS) |
126 | 125 |
127 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
128 #include "chrome/browser/extensions/settings_api_helpers.h" | 127 #include "chrome/browser/extensions/settings_api_helpers.h" |
129 #include "chrome/installer/util/auto_launch_util.h" | 128 #include "chrome/installer/util/auto_launch_util.h" |
130 #include "content/public/browser/browser_url_handler.h" | 129 #include "content/public/browser/browser_url_handler.h" |
131 #endif // defined(OS_WIN) | 130 #endif // defined(OS_WIN) |
132 | 131 |
133 #if defined(ENABLE_SERVICE_DISCOVERY) | 132 #if defined(ENABLE_SERVICE_DISCOVERY) |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 { "autoclickDelayShort", | 398 { "autoclickDelayShort", |
400 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, | 399 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, |
401 { "autoclickDelayLong", | 400 { "autoclickDelayLong", |
402 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, | 401 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, |
403 { "autoclickDelayVeryLong", | 402 { "autoclickDelayVeryLong", |
404 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, | 403 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, |
405 { "consumerManagementDescription", | 404 { "consumerManagementDescription", |
406 IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, | 405 IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, |
407 { "consumerManagementEnrollButton", | 406 { "consumerManagementEnrollButton", |
408 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, | 407 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, |
| 408 { "consumerManagementEnrollingButton", |
| 409 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLLING_BUTTON }, |
409 { "consumerManagementUnenrollButton", | 410 { "consumerManagementUnenrollButton", |
410 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, | 411 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, |
| 412 { "consumerManagementUnenrollingButton", |
| 413 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLLING_BUTTON }, |
411 { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, | 414 { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, |
412 { "enableContentProtectionAttestation", | 415 { "enableContentProtectionAttestation", |
413 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, | 416 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, |
414 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING }, | 417 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING }, |
415 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, | 418 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, |
416 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, | 419 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, |
417 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, | 420 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, |
418 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING }, | 421 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING }, |
419 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL }, | 422 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL }, |
420 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, | 423 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 "easyUnlockAllowed", | 621 "easyUnlockAllowed", |
619 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); | 622 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); |
620 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); | 623 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); |
621 | 624 |
622 #if defined(OS_CHROMEOS) | 625 #if defined(OS_CHROMEOS) |
623 values->SetBoolean( | 626 values->SetBoolean( |
624 "consumerManagementEnabled", | 627 "consumerManagementEnabled", |
625 CommandLine::ForCurrentProcess()->HasSwitch( | 628 CommandLine::ForCurrentProcess()->HasSwitch( |
626 chromeos::switches::kEnableConsumerManagement)); | 629 chromeos::switches::kEnableConsumerManagement)); |
627 | 630 |
628 const enterprise_management::PolicyData* policy_data = | |
629 chromeos::DeviceSettingsService::Get()->policy_data(); | |
630 values->SetBoolean( | |
631 "consumerManagementEnrolled", | |
632 policy_data && | |
633 policy_data->management_mode() == | |
634 enterprise_management::PolicyData::CONSUMER_MANAGED); | |
635 | |
636 RegisterTitle(values, "thirdPartyImeConfirmOverlay", | 631 RegisterTitle(values, "thirdPartyImeConfirmOverlay", |
637 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); | 632 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); |
638 #endif | 633 #endif |
639 | 634 |
640 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); | 635 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); |
641 | 636 |
642 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); | 637 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); |
643 | 638 |
644 values->SetBoolean("websiteSettingsManagerEnabled", | 639 values->SetBoolean("websiteSettingsManagerEnabled", |
645 CommandLine::ForCurrentProcess()->HasSwitch( | 640 CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, | 754 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, |
760 base::Unretained(this))); | 755 base::Unretained(this))); |
761 #endif // defined(OS_WIN) | 756 #endif // defined(OS_WIN) |
762 } | 757 } |
763 | 758 |
764 void BrowserOptionsHandler::Uninitialize() { | 759 void BrowserOptionsHandler::Uninitialize() { |
765 registrar_.RemoveAll(); | 760 registrar_.RemoveAll(); |
766 #if defined(OS_WIN) | 761 #if defined(OS_WIN) |
767 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); | 762 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); |
768 #endif | 763 #endif |
| 764 #if defined(OS_CHROMEOS) |
| 765 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| 766 GetConsumerManagementService()->RemoveObserver(this); |
| 767 #endif |
769 } | 768 } |
770 | 769 |
771 void BrowserOptionsHandler::OnStateChanged() { | 770 void BrowserOptionsHandler::OnStateChanged() { |
772 UpdateSyncState(); | 771 UpdateSyncState(); |
773 } | 772 } |
774 | 773 |
775 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& account_id, | 774 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& account_id, |
776 const std::string& username, | 775 const std::string& username, |
777 const std::string& password) { | 776 const std::string& password) { |
778 OnStateChanged(); | 777 OnStateChanged(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 OnAccountPictureManagedChanged( | 944 OnAccountPictureManagedChanged( |
946 policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> | 945 policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> |
947 policy_service()->GetPolicies( | 946 policy_service()->GetPolicies( |
948 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 947 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
949 std::string())) | 948 std::string())) |
950 .Get(policy::key::kUserAvatarImage)); | 949 .Get(policy::key::kUserAvatarImage)); |
951 | 950 |
952 OnWallpaperManagedChanged( | 951 OnWallpaperManagedChanged( |
953 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 952 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
954 user_manager::UserManager::Get()->GetActiveUser()->email())); | 953 user_manager::UserManager::Get()->GetActiveUser()->email())); |
| 954 |
| 955 OnConsumerManagementStatusChanged(); |
| 956 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| 957 GetConsumerManagementService()->AddObserver(this); |
955 #endif | 958 #endif |
956 } | 959 } |
957 | 960 |
958 // static | 961 // static |
959 void BrowserOptionsHandler::CheckAutoLaunch( | 962 void BrowserOptionsHandler::CheckAutoLaunch( |
960 base::WeakPtr<BrowserOptionsHandler> weak_this, | 963 base::WeakPtr<BrowserOptionsHandler> weak_this, |
961 const base::FilePath& profile_path) { | 964 const base::FilePath& profile_path) { |
962 #if defined(OS_WIN) | 965 #if defined(OS_WIN) |
963 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 966 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
964 | 967 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 } | 1454 } |
1452 | 1455 |
1453 void BrowserOptionsHandler::OnPowerwashDialogShow( | 1456 void BrowserOptionsHandler::OnPowerwashDialogShow( |
1454 const base::ListValue* args) { | 1457 const base::ListValue* args) { |
1455 UMA_HISTOGRAM_ENUMERATION( | 1458 UMA_HISTOGRAM_ENUMERATION( |
1456 "Reset.ChromeOS.PowerwashDialogShown", | 1459 "Reset.ChromeOS.PowerwashDialogShown", |
1457 chromeos::reset::DIALOG_FROM_OPTIONS, | 1460 chromeos::reset::DIALOG_FROM_OPTIONS, |
1458 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); | 1461 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); |
1459 } | 1462 } |
1460 | 1463 |
| 1464 void BrowserOptionsHandler::OnConsumerManagementStatusChanged() { |
| 1465 const std::string& status = g_browser_process->platform_part()-> |
| 1466 browser_policy_connector_chromeos()->GetConsumerManagementService()-> |
| 1467 GetStatusString(); |
| 1468 web_ui()->CallJavascriptFunction( |
| 1469 "BrowserOptions.setConsumerManagementStatus", base::StringValue(status)); |
| 1470 } |
| 1471 |
1461 #endif // defined(OS_CHROMEOS) | 1472 #endif // defined(OS_CHROMEOS) |
1462 | 1473 |
1463 void BrowserOptionsHandler::UpdateSyncState() { | 1474 void BrowserOptionsHandler::UpdateSyncState() { |
1464 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", | 1475 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", |
1465 *GetSyncStateDictionary()); | 1476 *GetSyncStateDictionary()); |
1466 } | 1477 } |
1467 | 1478 |
1468 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { | 1479 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { |
1469 UpdateSyncState(); | 1480 UpdateSyncState(); |
1470 } | 1481 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 extension = extensions::GetExtensionOverridingProxy( | 1872 extension = extensions::GetExtensionOverridingProxy( |
1862 Profile::FromWebUI(web_ui())); | 1873 Profile::FromWebUI(web_ui())); |
1863 AppendExtensionData("proxy", extension, &extension_controlled); | 1874 AppendExtensionData("proxy", extension, &extension_controlled); |
1864 | 1875 |
1865 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1876 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
1866 extension_controlled); | 1877 extension_controlled); |
1867 #endif // defined(OS_WIN) | 1878 #endif // defined(OS_WIN) |
1868 } | 1879 } |
1869 | 1880 |
1870 } // namespace options | 1881 } // namespace options |
OLD | NEW |