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/chromeos/proxy_config_service_impl.h" | 5 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
14 #include "chrome/browser/chromeos/login/user_manager.h" | 14 #include "chrome/browser/chromeos/login/user_manager.h" |
15 #include "chrome/browser/chromeos/settings/cros_settings.h" | 15 #include "chrome/browser/chromeos/settings/cros_settings.h" |
16 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
17 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" | 17 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" |
| 18 #include "chrome/browser/prefs/pref_registry_simple.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 20 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
20 #include "chrome/browser/prefs/proxy_prefs.h" | 21 #include "chrome/browser/prefs/proxy_prefs.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chromeos/network/onc/onc_constants.h" | 25 #include "chromeos/network/onc/onc_constants.h" |
25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
26 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
27 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 JSONStringValueSerializer serializer(network->proxy_config()); | 574 JSONStringValueSerializer serializer(network->proxy_config()); |
574 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL)); | 575 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL)); |
575 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY) | 576 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY) |
576 return false; | 577 return false; |
577 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get())); | 578 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get())); |
578 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict, | 579 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict, |
579 proxy_config); | 580 proxy_config); |
580 } | 581 } |
581 | 582 |
582 // static | 583 // static |
583 void ProxyConfigServiceImpl::RegisterPrefs(PrefServiceSimple* pref_service) { | 584 void ProxyConfigServiceImpl::RegisterPrefs(PrefRegistrySimple* pref_service) { |
584 // Use shared proxies default to off. GetUseSharedProxies will return the | 585 // Use shared proxies default to off. GetUseSharedProxies will return the |
585 // correct value based on pre-login and login. | 586 // correct value based on pre-login and login. |
586 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, true); | 587 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, true); |
587 } | 588 } |
588 | 589 |
589 // static | 590 // static |
590 void ProxyConfigServiceImpl::RegisterUserPrefs( | 591 void ProxyConfigServiceImpl::RegisterUserPrefs( |
591 PrefServiceSyncable* pref_service) { | 592 PrefServiceSyncable* pref_service) { |
592 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, | 593 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, |
593 true, | 594 true, |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 device_config_.clear(); | 847 device_config_.clear(); |
847 return; | 848 return; |
848 } | 849 } |
849 if (!active_network_.empty()) { | 850 if (!active_network_.empty()) { |
850 VLOG(1) << "Try migrating device config to " << active_network_; | 851 VLOG(1) << "Try migrating device config to " << active_network_; |
851 SetProxyConfigForNetwork(active_network_, device_config_, true); | 852 SetProxyConfigForNetwork(active_network_, device_config_, true); |
852 } | 853 } |
853 } | 854 } |
854 | 855 |
855 } // namespace chromeos | 856 } // namespace chromeos |
OLD | NEW |