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 "apps/app_window.h" | 10 #include "apps/app_window.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 96 |
97 #if !defined(OS_CHROMEOS) | 97 #if !defined(OS_CHROMEOS) |
98 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 98 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
99 #endif | 99 #endif |
100 | 100 |
101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
102 #include "ash/ash_switches.h" | 102 #include "ash/ash_switches.h" |
103 #include "ash/desktop_background/user_wallpaper_delegate.h" | 103 #include "ash/desktop_background/user_wallpaper_delegate.h" |
104 #include "ash/magnifier/magnifier_constants.h" | 104 #include "ash/magnifier/magnifier_constants.h" |
105 #include "ash/shell.h" | 105 #include "ash/shell.h" |
106 #include "chrome/browser/browser_process_platform_part.h" | |
106 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 107 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
107 #include "chrome/browser/chromeos/chromeos_utils.h" | 108 #include "chrome/browser/chromeos/chromeos_utils.h" |
108 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 109 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
109 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 110 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
110 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 111 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
111 #include "chrome/browser/chromeos/reset/metrics.h" | 112 #include "chrome/browser/chromeos/reset/metrics.h" |
112 #include "chrome/browser/chromeos/settings/cros_settings.h" | 113 #include "chrome/browser/chromeos/settings/cros_settings.h" |
113 #include "chrome/browser/chromeos/settings/device_settings_service.h" | |
114 #include "chrome/browser/chromeos/system/timezone_util.h" | 114 #include "chrome/browser/chromeos/system/timezone_util.h" |
115 #include "chrome/browser/policy/profile_policy_connector.h" | 115 #include "chrome/browser/policy/profile_policy_connector.h" |
116 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 116 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
117 #include "chrome/browser/ui/browser_window.h" | 117 #include "chrome/browser/ui/browser_window.h" |
118 #include "chromeos/dbus/dbus_thread_manager.h" | 118 #include "chromeos/dbus/dbus_thread_manager.h" |
119 #include "chromeos/dbus/power_manager_client.h" | 119 #include "chromeos/dbus/power_manager_client.h" |
120 #include "components/policy/core/common/policy_map.h" | 120 #include "components/policy/core/common/policy_map.h" |
121 #include "components/policy/core/common/policy_namespace.h" | 121 #include "components/policy/core/common/policy_namespace.h" |
122 #include "components/policy/core/common/policy_service.h" | 122 #include "components/policy/core/common/policy_service.h" |
123 #include "components/user_manager/user.h" | 123 #include "components/user_manager/user.h" |
124 #include "components/user_manager/user_manager.h" | 124 #include "components/user_manager/user_manager.h" |
125 #include "policy/policy_constants.h" | 125 #include "policy/policy_constants.h" |
126 #include "policy/proto/device_management_backend.pb.h" | |
127 #include "ui/gfx/image/image_skia.h" | 126 #include "ui/gfx/image/image_skia.h" |
128 #endif // defined(OS_CHROMEOS) | 127 #endif // defined(OS_CHROMEOS) |
129 | 128 |
130 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
131 #include "chrome/browser/extensions/settings_api_helpers.h" | 130 #include "chrome/browser/extensions/settings_api_helpers.h" |
132 #include "chrome/installer/util/auto_launch_util.h" | 131 #include "chrome/installer/util/auto_launch_util.h" |
133 #include "content/public/browser/browser_url_handler.h" | 132 #include "content/public/browser/browser_url_handler.h" |
134 #endif // defined(OS_WIN) | 133 #endif // defined(OS_WIN) |
135 | 134 |
136 #if defined(ENABLE_SERVICE_DISCOVERY) | 135 #if defined(ENABLE_SERVICE_DISCOVERY) |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 { "autoclickDelayShort", | 401 { "autoclickDelayShort", |
403 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, | 402 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, |
404 { "autoclickDelayLong", | 403 { "autoclickDelayLong", |
405 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, | 404 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, |
406 { "autoclickDelayVeryLong", | 405 { "autoclickDelayVeryLong", |
407 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, | 406 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, |
408 { "consumerManagementDescription", | 407 { "consumerManagementDescription", |
409 IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, | 408 IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, |
410 { "consumerManagementEnrollButton", | 409 { "consumerManagementEnrollButton", |
411 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, | 410 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, |
411 { "consumerManagementEnrollingButton", | |
412 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLLING_BUTTON }, | |
412 { "consumerManagementUnenrollButton", | 413 { "consumerManagementUnenrollButton", |
413 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, | 414 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, |
415 { "consumerManagementUnenrollingButton", | |
416 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLLING_BUTTON }, | |
414 { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, | 417 { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, |
415 { "enableContentProtectionAttestation", | 418 { "enableContentProtectionAttestation", |
416 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, | 419 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, |
417 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING }, | 420 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING }, |
418 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, | 421 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, |
419 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, | 422 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, |
420 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, | 423 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, |
421 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING }, | 424 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING }, |
422 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL }, | 425 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL }, |
423 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, | 426 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 "easyUnlockAllowed", | 627 "easyUnlockAllowed", |
625 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); | 628 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); |
626 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); | 629 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); |
627 | 630 |
628 #if defined(OS_CHROMEOS) | 631 #if defined(OS_CHROMEOS) |
629 values->SetBoolean( | 632 values->SetBoolean( |
630 "consumerManagementEnabled", | 633 "consumerManagementEnabled", |
631 CommandLine::ForCurrentProcess()->HasSwitch( | 634 CommandLine::ForCurrentProcess()->HasSwitch( |
632 chromeos::switches::kEnableConsumerManagement)); | 635 chromeos::switches::kEnableConsumerManagement)); |
633 | 636 |
634 const enterprise_management::PolicyData* policy_data = | |
635 chromeos::DeviceSettingsService::Get()->policy_data(); | |
636 values->SetBoolean( | |
637 "consumerManagementEnrolled", | |
638 policy_data && | |
639 policy_data->management_mode() == | |
640 enterprise_management::PolicyData::CONSUMER_MANAGED); | |
641 | |
642 RegisterTitle(values, "thirdPartyImeConfirmOverlay", | 637 RegisterTitle(values, "thirdPartyImeConfirmOverlay", |
643 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); | 638 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); |
644 #endif | 639 #endif |
645 | 640 |
646 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); | 641 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); |
647 | 642 |
648 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); | 643 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); |
649 | 644 |
650 values->SetBoolean("websiteSettingsManagerEnabled", | 645 values->SetBoolean("websiteSettingsManagerEnabled", |
651 CommandLine::ForCurrentProcess()->HasSwitch( | 646 CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
765 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, | 760 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, |
766 base::Unretained(this))); | 761 base::Unretained(this))); |
767 #endif // defined(OS_WIN) | 762 #endif // defined(OS_WIN) |
768 } | 763 } |
769 | 764 |
770 void BrowserOptionsHandler::Uninitialize() { | 765 void BrowserOptionsHandler::Uninitialize() { |
771 registrar_.RemoveAll(); | 766 registrar_.RemoveAll(); |
772 #if defined(OS_WIN) | 767 #if defined(OS_WIN) |
773 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); | 768 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); |
774 #endif | 769 #endif |
770 #if defined(OS_CHROMEOS) | |
771 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | |
772 GetConsumerManagementService()->RemoveObserver(this); | |
773 #endif | |
775 } | 774 } |
776 | 775 |
777 void BrowserOptionsHandler::OnStateChanged() { | 776 void BrowserOptionsHandler::OnStateChanged() { |
778 UpdateSyncState(); | 777 UpdateSyncState(); |
779 } | 778 } |
780 | 779 |
781 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& username, | 780 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& username, |
782 const std::string& password) { | 781 const std::string& password) { |
783 OnStateChanged(); | 782 OnStateChanged(); |
784 } | 783 } |
(...skipping 160 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 policy::ConsumerManagementService* consumer_management_service = | |
956 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | |
957 GetConsumerManagementService(); | |
958 OnConsumerManagementStatusChanged(consumer_management_service->GetStatus()); | |
959 consumer_management_service->AddObserver(this); | |
955 #endif | 960 #endif |
956 } | 961 } |
957 | 962 |
958 // static | 963 // static |
959 void BrowserOptionsHandler::CheckAutoLaunch( | 964 void BrowserOptionsHandler::CheckAutoLaunch( |
960 base::WeakPtr<BrowserOptionsHandler> weak_this, | 965 base::WeakPtr<BrowserOptionsHandler> weak_this, |
961 const base::FilePath& profile_path) { | 966 const base::FilePath& profile_path) { |
962 #if defined(OS_WIN) | 967 #if defined(OS_WIN) |
963 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 968 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
964 | 969 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1452 } | 1457 } |
1453 | 1458 |
1454 void BrowserOptionsHandler::OnPowerwashDialogShow( | 1459 void BrowserOptionsHandler::OnPowerwashDialogShow( |
1455 const base::ListValue* args) { | 1460 const base::ListValue* args) { |
1456 UMA_HISTOGRAM_ENUMERATION( | 1461 UMA_HISTOGRAM_ENUMERATION( |
1457 "Reset.ChromeOS.PowerwashDialogShown", | 1462 "Reset.ChromeOS.PowerwashDialogShown", |
1458 chromeos::reset::DIALOG_FROM_OPTIONS, | 1463 chromeos::reset::DIALOG_FROM_OPTIONS, |
1459 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); | 1464 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); |
1460 } | 1465 } |
1461 | 1466 |
1467 void BrowserOptionsHandler::OnConsumerManagementStatusChanged( | |
1468 policy::ConsumerManagementService::Status status) { | |
1469 web_ui()->CallJavascriptFunction( | |
1470 "BrowserOptions.setConsumerManagementStatus", | |
1471 base::StringValue(policy::ConsumerManagementService::GetStatusString( | |
bartfab (slow)
2014/08/21 11:39:35
Nit: How about we remove the argument from GetStat
davidyu
2014/08/22 05:14:13
Done.
| |
1472 status))); | |
1473 } | |
1474 | |
1462 #endif // defined(OS_CHROMEOS) | 1475 #endif // defined(OS_CHROMEOS) |
1463 | 1476 |
1464 void BrowserOptionsHandler::UpdateSyncState() { | 1477 void BrowserOptionsHandler::UpdateSyncState() { |
1465 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", | 1478 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", |
1466 *GetSyncStateDictionary()); | 1479 *GetSyncStateDictionary()); |
1467 } | 1480 } |
1468 | 1481 |
1469 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { | 1482 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { |
1470 UpdateSyncState(); | 1483 UpdateSyncState(); |
1471 } | 1484 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1862 extension = extensions::GetExtensionOverridingProxy( | 1875 extension = extensions::GetExtensionOverridingProxy( |
1863 Profile::FromWebUI(web_ui())); | 1876 Profile::FromWebUI(web_ui())); |
1864 AppendExtensionData("proxy", extension, &extension_controlled); | 1877 AppendExtensionData("proxy", extension, &extension_controlled); |
1865 | 1878 |
1866 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1879 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
1867 extension_controlled); | 1880 extension_controlled); |
1868 #endif // defined(OS_WIN) | 1881 #endif // defined(OS_WIN) |
1869 } | 1882 } |
1870 | 1883 |
1871 } // namespace options | 1884 } // namespace options |
OLD | NEW |