| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "components/proxy_config/pref_proxy_config_tracker_impl.h" | 5 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 proxy_prefs_.Init(pref_service); | 203 proxy_prefs_.Init(pref_service); |
| 204 proxy_prefs_.Add(proxy_config::prefs::kProxy, | 204 proxy_prefs_.Add(proxy_config::prefs::kProxy, |
| 205 base::Bind(&PrefProxyConfigTrackerImpl::OnProxyPrefChanged, | 205 base::Bind(&PrefProxyConfigTrackerImpl::OnProxyPrefChanged, |
| 206 base::Unretained(this))); | 206 base::Unretained(this))); |
| 207 } | 207 } |
| 208 | 208 |
| 209 PrefProxyConfigTrackerImpl::~PrefProxyConfigTrackerImpl() { | 209 PrefProxyConfigTrackerImpl::~PrefProxyConfigTrackerImpl() { |
| 210 DCHECK(pref_service_ == NULL); | 210 DCHECK(pref_service_ == NULL); |
| 211 } | 211 } |
| 212 | 212 |
| 213 scoped_ptr<net::ProxyConfigService> | 213 std::unique_ptr<net::ProxyConfigService> |
| 214 PrefProxyConfigTrackerImpl::CreateTrackingProxyConfigService( | 214 PrefProxyConfigTrackerImpl::CreateTrackingProxyConfigService( |
| 215 scoped_ptr<net::ProxyConfigService> base_service) { | 215 std::unique_ptr<net::ProxyConfigService> base_service) { |
| 216 proxy_config_service_impl_ = | 216 proxy_config_service_impl_ = |
| 217 new ProxyConfigServiceImpl(base_service.release()); | 217 new ProxyConfigServiceImpl(base_service.release()); |
| 218 VLOG(1) << this << ": set chrome proxy config service to " | 218 VLOG(1) << this << ": set chrome proxy config service to " |
| 219 << proxy_config_service_impl_; | 219 << proxy_config_service_impl_; |
| 220 if (proxy_config_service_impl_ && update_pending_) | 220 if (proxy_config_service_impl_ && update_pending_) |
| 221 OnProxyConfigChanged(config_state_, pref_config_); | 221 OnProxyConfigChanged(config_state_, pref_config_); |
| 222 | 222 |
| 223 return scoped_ptr<net::ProxyConfigService>(proxy_config_service_impl_); | 223 return std::unique_ptr<net::ProxyConfigService>(proxy_config_service_impl_); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void PrefProxyConfigTrackerImpl::DetachFromPrefService() { | 226 void PrefProxyConfigTrackerImpl::DetachFromPrefService() { |
| 227 DCHECK(thread_checker_.CalledOnValidThread()); | 227 DCHECK(thread_checker_.CalledOnValidThread()); |
| 228 // Stop notifications. | 228 // Stop notifications. |
| 229 proxy_prefs_.RemoveAll(); | 229 proxy_prefs_.RemoveAll(); |
| 230 pref_service_ = NULL; | 230 pref_service_ = NULL; |
| 231 proxy_config_service_impl_ = NULL; | 231 proxy_config_service_impl_ = NULL; |
| 232 } | 232 } |
| 233 | 233 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 (config_state_ != ProxyPrefs::CONFIG_UNSET && | 426 (config_state_ != ProxyPrefs::CONFIG_UNSET && |
| 427 !pref_config_.Equals(new_config))) { | 427 !pref_config_.Equals(new_config))) { |
| 428 config_state_ = config_state; | 428 config_state_ = config_state; |
| 429 if (config_state_ != ProxyPrefs::CONFIG_UNSET) | 429 if (config_state_ != ProxyPrefs::CONFIG_UNSET) |
| 430 pref_config_ = new_config; | 430 pref_config_ = new_config; |
| 431 update_pending_ = true; | 431 update_pending_ = true; |
| 432 } | 432 } |
| 433 if (update_pending_) | 433 if (update_pending_) |
| 434 OnProxyConfigChanged(config_state, new_config); | 434 OnProxyConfigChanged(config_state, new_config); |
| 435 } | 435 } |
| OLD | NEW |