| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" | 97 #include "chrome/browser/ui/webui/options/advanced_options_utils.h" |
| 98 #endif | 98 #endif |
| 99 | 99 |
| 100 #if defined(OS_CHROMEOS) | 100 #if defined(OS_CHROMEOS) |
| 101 #include "ash/ash_switches.h" | 101 #include "ash/ash_switches.h" |
| 102 #include "ash/desktop_background/user_wallpaper_delegate.h" | 102 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 103 #include "ash/magnifier/magnifier_constants.h" | 103 #include "ash/magnifier/magnifier_constants.h" |
| 104 #include "ash/shell.h" | 104 #include "ash/shell.h" |
| 105 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 105 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 106 #include "chrome/browser/chromeos/chromeos_utils.h" | 106 #include "chrome/browser/chromeos/chromeos_utils.h" |
| 107 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 108 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 107 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 109 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 108 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 110 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 109 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 111 #include "chrome/browser/chromeos/reset/metrics.h" | 110 #include "chrome/browser/chromeos/reset/metrics.h" |
| 112 #include "chrome/browser/chromeos/settings/cros_settings.h" | 111 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 113 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 112 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 114 #include "chrome/browser/chromeos/system/timezone_util.h" | 113 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 115 #include "chrome/browser/policy/profile_policy_connector.h" | 114 #include "chrome/browser/policy/profile_policy_connector.h" |
| 116 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 115 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 117 #include "chrome/browser/ui/browser_window.h" | 116 #include "chrome/browser/ui/browser_window.h" |
| 118 #include "chromeos/dbus/dbus_thread_manager.h" | 117 #include "chromeos/dbus/dbus_thread_manager.h" |
| 119 #include "chromeos/dbus/power_manager_client.h" | 118 #include "chromeos/dbus/power_manager_client.h" |
| 120 #include "components/policy/core/common/policy_map.h" | 119 #include "components/policy/core/common/policy_map.h" |
| 121 #include "components/policy/core/common/policy_namespace.h" | 120 #include "components/policy/core/common/policy_namespace.h" |
| 122 #include "components/policy/core/common/policy_service.h" | 121 #include "components/policy/core/common/policy_service.h" |
| 123 #include "components/user_manager/user.h" | 122 #include "components/user_manager/user.h" |
| 123 #include "components/user_manager/user_manager.h" |
| 124 #include "policy/policy_constants.h" | 124 #include "policy/policy_constants.h" |
| 125 #include "policy/proto/device_management_backend.pb.h" | 125 #include "policy/proto/device_management_backend.pb.h" |
| 126 #include "ui/gfx/image/image_skia.h" | 126 #include "ui/gfx/image/image_skia.h" |
| 127 #endif // defined(OS_CHROMEOS) | 127 #endif // defined(OS_CHROMEOS) |
| 128 | 128 |
| 129 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
| 130 #include "chrome/browser/extensions/settings_api_helpers.h" | 130 #include "chrome/browser/extensions/settings_api_helpers.h" |
| 131 #include "chrome/installer/util/auto_launch_util.h" | 131 #include "chrome/installer/util/auto_launch_util.h" |
| 132 #include "content/public/browser/browser_url_handler.h" | 132 #include "content/public/browser/browser_url_handler.h" |
| 133 #endif // defined(OS_WIN) | 133 #endif // defined(OS_WIN) |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 SetupManageCertificatesSection(); | 921 SetupManageCertificatesSection(); |
| 922 SetupManagingSupervisedUsers(); | 922 SetupManagingSupervisedUsers(); |
| 923 SetupEasyUnlock(); | 923 SetupEasyUnlock(); |
| 924 SetupExtensionControlledIndicators(); | 924 SetupExtensionControlledIndicators(); |
| 925 | 925 |
| 926 #if defined(OS_CHROMEOS) | 926 #if defined(OS_CHROMEOS) |
| 927 SetupAccessibilityFeatures(); | 927 SetupAccessibilityFeatures(); |
| 928 policy::BrowserPolicyConnectorChromeOS* connector = | 928 policy::BrowserPolicyConnectorChromeOS* connector = |
| 929 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 929 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 930 if (!connector->IsEnterpriseManaged() && | 930 if (!connector->IsEnterpriseManaged() && |
| 931 !chromeos::UserManager::Get()->IsLoggedInAsGuest() && | 931 !user_manager::UserManager::Get()->IsLoggedInAsGuest() && |
| 932 !chromeos::UserManager::Get()->IsLoggedInAsSupervisedUser()) { | 932 !user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
| 933 web_ui()->CallJavascriptFunction( | 933 web_ui()->CallJavascriptFunction( |
| 934 "BrowserOptions.enableFactoryResetSection"); | 934 "BrowserOptions.enableFactoryResetSection"); |
| 935 } | 935 } |
| 936 | 936 |
| 937 Profile* profile = Profile::FromWebUI(web_ui()); | 937 Profile* profile = Profile::FromWebUI(web_ui()); |
| 938 OnAccountPictureManagedChanged( | 938 OnAccountPictureManagedChanged( |
| 939 policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> | 939 policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> |
| 940 policy_service()->GetPolicies( | 940 policy_service()->GetPolicies( |
| 941 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 941 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
| 942 std::string())) | 942 std::string())) |
| 943 .Get(policy::key::kUserAvatarImage)); | 943 .Get(policy::key::kUserAvatarImage)); |
| 944 | 944 |
| 945 OnWallpaperManagedChanged( | 945 OnWallpaperManagedChanged( |
| 946 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 946 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
| 947 chromeos::UserManager::Get()->GetActiveUser()->email())); | 947 user_manager::UserManager::Get()->GetActiveUser()->email())); |
| 948 #endif | 948 #endif |
| 949 } | 949 } |
| 950 | 950 |
| 951 // static | 951 // static |
| 952 void BrowserOptionsHandler::CheckAutoLaunch( | 952 void BrowserOptionsHandler::CheckAutoLaunch( |
| 953 base::WeakPtr<BrowserOptionsHandler> weak_this, | 953 base::WeakPtr<BrowserOptionsHandler> weak_this, |
| 954 const base::FilePath& profile_path) { | 954 const base::FilePath& profile_path) { |
| 955 #if defined(OS_WIN) | 955 #if defined(OS_WIN) |
| 956 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 956 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 957 | 957 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1330 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1331 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { | 1331 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { |
| 1332 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); | 1332 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); |
| 1333 Profile* profile = Profile::FromWebUI(web_ui()); | 1333 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1334 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); | 1334 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); |
| 1335 } | 1335 } |
| 1336 #endif | 1336 #endif |
| 1337 | 1337 |
| 1338 #if defined(OS_CHROMEOS) | 1338 #if defined(OS_CHROMEOS) |
| 1339 void BrowserOptionsHandler::UpdateAccountPicture() { | 1339 void BrowserOptionsHandler::UpdateAccountPicture() { |
| 1340 std::string email = chromeos::UserManager::Get()->GetLoggedInUser()->email(); | 1340 std::string email = |
| 1341 user_manager::UserManager::Get()->GetLoggedInUser()->email(); |
| 1341 if (!email.empty()) { | 1342 if (!email.empty()) { |
| 1342 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); | 1343 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); |
| 1343 base::StringValue email_value(email); | 1344 base::StringValue email_value(email); |
| 1344 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", | 1345 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", |
| 1345 email_value); | 1346 email_value); |
| 1346 } | 1347 } |
| 1347 } | 1348 } |
| 1348 | 1349 |
| 1349 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) { | 1350 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) { |
| 1350 web_ui()->CallJavascriptFunction("BrowserOptions.setAccountPictureManaged", | 1351 web_ui()->CallJavascriptFunction("BrowserOptions.setAccountPictureManaged", |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 extension = extensions::GetExtensionOverridingProxy( | 1867 extension = extensions::GetExtensionOverridingProxy( |
| 1867 Profile::FromWebUI(web_ui())); | 1868 Profile::FromWebUI(web_ui())); |
| 1868 AppendExtensionData("proxy", extension, &extension_controlled); | 1869 AppendExtensionData("proxy", extension, &extension_controlled); |
| 1869 | 1870 |
| 1870 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1871 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
| 1871 extension_controlled); | 1872 extension_controlled); |
| 1872 #endif // defined(OS_WIN) | 1873 #endif // defined(OS_WIN) |
| 1873 } | 1874 } |
| 1874 | 1875 |
| 1875 } // namespace options | 1876 } // namespace options |
| OLD | NEW |