Chromium Code Reviews| 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/chromeos/core_chromeos_options_handler .h" | 5 #include "chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler .h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
| 19 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | |
| 20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" | |
| 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 21 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 21 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" | 23 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" |
| 22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 24 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" | 26 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" |
| 25 #include "chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h" | 27 #include "chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h" |
| 26 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
| 28 #include "components/user_manager/user_manager.h" | 30 #include "components/user_manager/user_manager.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 pref_name, value, &proxy_config_service_); | 218 pref_name, value, &proxy_config_service_); |
| 217 base::StringValue proxy_type(pref_name); | 219 base::StringValue proxy_type(pref_name); |
| 218 web_ui()->CallJavascriptFunction( | 220 web_ui()->CallJavascriptFunction( |
| 219 "options.internet.DetailsInternetPage.updateProxySettings", | 221 "options.internet.DetailsInternetPage.updateProxySettings", |
| 220 proxy_type); | 222 proxy_type); |
| 221 ProcessUserMetric(value, metric); | 223 ProcessUserMetric(value, metric); |
| 222 return; | 224 return; |
| 223 } | 225 } |
| 224 if (!CrosSettings::IsCrosSettings(pref_name)) | 226 if (!CrosSettings::IsCrosSettings(pref_name)) |
| 225 return ::options::CoreOptionsHandler::SetPref(pref_name, value, metric); | 227 return ::options::CoreOptionsHandler::SetPref(pref_name, value, metric); |
| 226 CrosSettings::Get()->Set(pref_name, *value); | 228 Profile* profile = Profile::FromWebUI(web_ui()); |
| 229 OwnerSettingsServiceChromeOS* service = | |
| 230 profile ? OwnerSettingsServiceChromeOSFactory::GetForProfile(profile) | |
| 231 : nullptr; | |
| 232 if (service && service->HandlesSetting(pref_name)) | |
| 233 service->Set(pref_name, *value); | |
| 234 else | |
| 235 CrosSettings::Get()->Set(pref_name, *value); | |
|
Nikita (slow)
2014/10/27 16:44:38
Which settings still go through CrosSettings?
ygorshenin1
2014/10/27 18:29:21
Not so many: https://code.google.com/p/chromium/co
| |
| 227 | 236 |
| 228 ProcessUserMetric(value, metric); | 237 ProcessUserMetric(value, metric); |
| 229 } | 238 } |
| 230 | 239 |
| 231 void CoreChromeOSOptionsHandler::StopObservingPref(const std::string& path) { | 240 void CoreChromeOSOptionsHandler::StopObservingPref(const std::string& path) { |
| 232 if (proxy_cros_settings_parser::IsProxyPref(path)) | 241 if (proxy_cros_settings_parser::IsProxyPref(path)) |
| 233 return; // We unregister those in the destructor. | 242 return; // We unregister those in the destructor. |
| 234 // Unregister this instance from observing prefs of chrome os settings. | 243 // Unregister this instance from observing prefs of chrome os settings. |
| 235 if (CrosSettings::IsCrosSettings(path)) | 244 if (CrosSettings::IsCrosSettings(path)) |
| 236 pref_subscription_map_.erase(path); | 245 pref_subscription_map_.erase(path); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 proxy_cros_settings_parser::GetProxyPrefValue( | 391 proxy_cros_settings_parser::GetProxyPrefValue( |
| 383 proxy_config_service_, kProxySettings[i], &value); | 392 proxy_config_service_, kProxySettings[i], &value); |
| 384 DCHECK(value); | 393 DCHECK(value); |
| 385 scoped_ptr<base::Value> ptr(value); | 394 scoped_ptr<base::Value> ptr(value); |
| 386 DispatchPrefChangeNotification(kProxySettings[i], ptr.Pass()); | 395 DispatchPrefChangeNotification(kProxySettings[i], ptr.Pass()); |
| 387 } | 396 } |
| 388 } | 397 } |
| 389 | 398 |
| 390 } // namespace options | 399 } // namespace options |
| 391 } // namespace chromeos | 400 } // namespace chromeos |
| OLD | NEW |