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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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/chromeos/accessibility/accessibility_util.h" | 106 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
107 #include "chrome/browser/chromeos/chromeos_utils.h" | 107 #include "chrome/browser/chromeos/chromeos_utils.h" |
108 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 108 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
109 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 109 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
110 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | |
bartfab (slow)
2014/08/20 14:40:02
Nit: Already included by the header file.
davidyu
2014/08/21 09:40:29
Done.
| |
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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 { "autoclickDelayShort", | 403 { "autoclickDelayShort", |
405 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, | 404 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_SHORT }, |
406 { "autoclickDelayLong", | 405 { "autoclickDelayLong", |
407 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, | 406 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_LONG }, |
408 { "autoclickDelayVeryLong", | 407 { "autoclickDelayVeryLong", |
409 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, | 408 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_AUTOCLICK_DELAY_VERY_LONG }, |
410 { "consumerManagementDescription", | 409 { "consumerManagementDescription", |
411 IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, | 410 IDS_OPTIONS_CONSUMER_MANAGEMENT_DESCRIPTION }, |
412 { "consumerManagementEnrollButton", | 411 { "consumerManagementEnrollButton", |
413 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, | 412 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLL_BUTTON }, |
413 { "consumerManagementEnrollingButton", | |
414 IDS_OPTIONS_CONSUMER_MANAGEMENT_ENROLLING_BUTTON }, | |
414 { "consumerManagementUnenrollButton", | 415 { "consumerManagementUnenrollButton", |
415 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, | 416 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLL_BUTTON }, |
417 { "consumerManagementUnenrollingButton", | |
418 IDS_OPTIONS_CONSUMER_MANAGEMENT_UNENROLLING_BUTTON }, | |
416 { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, | 419 { "deviceControlTitle", IDS_OPTIONS_DEVICE_CONTROL_SECTION_TITLE }, |
417 { "enableContentProtectionAttestation", | 420 { "enableContentProtectionAttestation", |
418 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, | 421 IDS_OPTIONS_ENABLE_CONTENT_PROTECTION_ATTESTATION }, |
419 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING }, | 422 { "factoryResetHeading", IDS_OPTIONS_FACTORY_RESET_HEADING }, |
420 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, | 423 { "factoryResetTitle", IDS_OPTIONS_FACTORY_RESET }, |
421 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, | 424 { "factoryResetRestart", IDS_OPTIONS_FACTORY_RESET_BUTTON }, |
422 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, | 425 { "factoryResetDataRestart", IDS_RELAUNCH_BUTTON }, |
423 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING }, | 426 { "factoryResetWarning", IDS_OPTIONS_FACTORY_RESET_WARNING }, |
424 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL }, | 427 { "factoryResetHelpUrl", IDS_FACTORY_RESET_HELP_URL }, |
425 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, | 428 { "changePicture", IDS_OPTIONS_CHANGE_PICTURE }, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 "easyUnlockAllowed", | 629 "easyUnlockAllowed", |
627 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); | 630 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->IsAllowed()); |
628 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); | 631 values->SetString("easyUnlockLearnMoreURL", chrome::kEasyUnlockLearnMoreUrl); |
629 | 632 |
630 #if defined(OS_CHROMEOS) | 633 #if defined(OS_CHROMEOS) |
631 values->SetBoolean( | 634 values->SetBoolean( |
632 "consumerManagementEnabled", | 635 "consumerManagementEnabled", |
633 CommandLine::ForCurrentProcess()->HasSwitch( | 636 CommandLine::ForCurrentProcess()->HasSwitch( |
634 chromeos::switches::kEnableConsumerManagement)); | 637 chromeos::switches::kEnableConsumerManagement)); |
635 | 638 |
636 const enterprise_management::PolicyData* policy_data = | |
637 chromeos::DeviceSettingsService::Get()->policy_data(); | |
638 values->SetBoolean( | |
639 "consumerManagementEnrolled", | |
640 policy_data && | |
641 policy_data->management_mode() == | |
642 enterprise_management::PolicyData::CONSUMER_MANAGED); | |
643 | |
644 RegisterTitle(values, "thirdPartyImeConfirmOverlay", | 639 RegisterTitle(values, "thirdPartyImeConfirmOverlay", |
645 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); | 640 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE); |
646 #endif | 641 #endif |
647 | 642 |
648 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); | 643 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); |
649 | 644 |
650 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); | 645 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); |
651 | 646 |
652 values->SetBoolean("websiteSettingsManagerEnabled", | 647 values->SetBoolean("websiteSettingsManagerEnabled", |
653 CommandLine::ForCurrentProcess()->HasSwitch( | 648 CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
767 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, | 762 &BrowserOptionsHandler::HandleRefreshExtensionControlIndicators, |
768 base::Unretained(this))); | 763 base::Unretained(this))); |
769 #endif // defined(OS_WIN) | 764 #endif // defined(OS_WIN) |
770 } | 765 } |
771 | 766 |
772 void BrowserOptionsHandler::Uninitialize() { | 767 void BrowserOptionsHandler::Uninitialize() { |
773 registrar_.RemoveAll(); | 768 registrar_.RemoveAll(); |
774 #if defined(OS_WIN) | 769 #if defined(OS_WIN) |
775 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); | 770 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))->RemoveObserver(this); |
776 #endif | 771 #endif |
772 #if defined(OS_CHROMEOS) | |
773 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | |
bartfab (slow)
2014/08/20 14:40:02
Nit: #include "chrome/browser/browser_process_plat
davidyu
2014/08/21 09:40:29
Done.
| |
774 GetConsumerManagementService()->RemoveObserver(this); | |
775 #endif | |
777 } | 776 } |
778 | 777 |
779 void BrowserOptionsHandler::OnStateChanged() { | 778 void BrowserOptionsHandler::OnStateChanged() { |
780 UpdateSyncState(); | 779 UpdateSyncState(); |
781 } | 780 } |
782 | 781 |
783 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& username, | 782 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& username, |
784 const std::string& password) { | 783 const std::string& password) { |
785 OnStateChanged(); | 784 OnStateChanged(); |
786 } | 785 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
947 OnAccountPictureManagedChanged( | 946 OnAccountPictureManagedChanged( |
948 policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> | 947 policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> |
949 policy_service()->GetPolicies( | 948 policy_service()->GetPolicies( |
950 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 949 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
951 std::string())) | 950 std::string())) |
952 .Get(policy::key::kUserAvatarImage)); | 951 .Get(policy::key::kUserAvatarImage)); |
953 | 952 |
954 OnWallpaperManagedChanged( | 953 OnWallpaperManagedChanged( |
955 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 954 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
956 user_manager::UserManager::Get()->GetActiveUser()->email())); | 955 user_manager::UserManager::Get()->GetActiveUser()->email())); |
956 | |
957 policy::ConsumerManagementService* consumer_management_service = | |
958 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | |
959 GetConsumerManagementService(); | |
960 OnConsumerManagementEnrollmentStateChanged(consumer_management_service); | |
961 consumer_management_service->AddObserver(this); | |
957 #endif | 962 #endif |
958 } | 963 } |
959 | 964 |
960 // static | 965 // static |
961 void BrowserOptionsHandler::CheckAutoLaunch( | 966 void BrowserOptionsHandler::CheckAutoLaunch( |
962 base::WeakPtr<BrowserOptionsHandler> weak_this, | 967 base::WeakPtr<BrowserOptionsHandler> weak_this, |
963 const base::FilePath& profile_path) { | 968 const base::FilePath& profile_path) { |
964 #if defined(OS_WIN) | 969 #if defined(OS_WIN) |
965 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 970 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
966 | 971 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1473 } | 1478 } |
1474 | 1479 |
1475 void BrowserOptionsHandler::OnPowerwashDialogShow( | 1480 void BrowserOptionsHandler::OnPowerwashDialogShow( |
1476 const base::ListValue* args) { | 1481 const base::ListValue* args) { |
1477 UMA_HISTOGRAM_ENUMERATION( | 1482 UMA_HISTOGRAM_ENUMERATION( |
1478 "Reset.ChromeOS.PowerwashDialogShown", | 1483 "Reset.ChromeOS.PowerwashDialogShown", |
1479 chromeos::reset::DIALOG_FROM_OPTIONS, | 1484 chromeos::reset::DIALOG_FROM_OPTIONS, |
1480 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); | 1485 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); |
1481 } | 1486 } |
1482 | 1487 |
1488 void BrowserOptionsHandler::OnConsumerManagementEnrollmentStateChanged( | |
1489 policy::ConsumerManagementService* service) { | |
1490 std::string state; | |
1491 if (service->IsEnrolled()) { | |
bartfab (slow)
2014/08/20 14:40:03
Nit: No need for curly braces.
davidyu
2014/08/21 09:40:29
Done.
| |
1492 state = service->IsUnenrolling() ? "unenrolling" : "enrolled"; | |
bartfab (slow)
2014/08/20 14:40:02
I would not be surprised if this nested conditiona
davidyu
2014/08/21 09:40:30
Done.
| |
1493 } else { | |
1494 state = service->IsEnrolling() ? "enrolling" : "unenrolled"; | |
1495 } | |
1496 web_ui()->CallJavascriptFunction( | |
1497 "BrowserOptions.setConsumerManagementEnrollmentState", | |
1498 base::StringValue(state)); | |
1499 } | |
1500 | |
1483 #endif // defined(OS_CHROMEOS) | 1501 #endif // defined(OS_CHROMEOS) |
1484 | 1502 |
1485 void BrowserOptionsHandler::UpdateSyncState() { | 1503 void BrowserOptionsHandler::UpdateSyncState() { |
1486 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", | 1504 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", |
1487 *GetSyncStateDictionary()); | 1505 *GetSyncStateDictionary()); |
1488 } | 1506 } |
1489 | 1507 |
1490 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { | 1508 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { |
1491 UpdateSyncState(); | 1509 UpdateSyncState(); |
1492 } | 1510 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1883 extension = extensions::GetExtensionOverridingProxy( | 1901 extension = extensions::GetExtensionOverridingProxy( |
1884 Profile::FromWebUI(web_ui())); | 1902 Profile::FromWebUI(web_ui())); |
1885 AppendExtensionData("proxy", extension, &extension_controlled); | 1903 AppendExtensionData("proxy", extension, &extension_controlled); |
1886 | 1904 |
1887 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1905 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
1888 extension_controlled); | 1906 extension_controlled); |
1889 #endif // defined(OS_WIN) | 1907 #endif // defined(OS_WIN) |
1890 } | 1908 } |
1891 | 1909 |
1892 } // namespace options | 1910 } // namespace options |
OLD | NEW |