OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/net/proxy_service_factory.h" | 5 #include "ios/chrome/browser/net/proxy_service_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | 10 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
10 #include "ios/web/public/web_thread.h" | 11 #include "ios/web/public/web_thread.h" |
11 #include "net/proxy/proxy_config_service.h" | 12 #include "net/proxy/proxy_config_service.h" |
12 #include "net/proxy/proxy_service.h" | 13 #include "net/proxy/proxy_service.h" |
13 | 14 |
14 namespace ios { | 15 namespace ios { |
15 | 16 |
16 // static | 17 // static |
17 scoped_ptr<net::ProxyConfigService> | 18 std::unique_ptr<net::ProxyConfigService> |
18 ProxyServiceFactory::CreateProxyConfigService(PrefProxyConfigTracker* tracker) { | 19 ProxyServiceFactory::CreateProxyConfigService(PrefProxyConfigTracker* tracker) { |
19 scoped_ptr<net::ProxyConfigService> base_service( | 20 std::unique_ptr<net::ProxyConfigService> base_service( |
20 net::ProxyService::CreateSystemProxyConfigService( | 21 net::ProxyService::CreateSystemProxyConfigService( |
21 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), | 22 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), |
22 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE))); | 23 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE))); |
23 return tracker->CreateTrackingProxyConfigService(std::move(base_service)); | 24 return tracker->CreateTrackingProxyConfigService(std::move(base_service)); |
24 } | 25 } |
25 | 26 |
26 // static | 27 // static |
27 scoped_ptr<PrefProxyConfigTracker> | 28 std::unique_ptr<PrefProxyConfigTracker> |
28 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 29 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
29 PrefService* browser_state_prefs, | 30 PrefService* browser_state_prefs, |
30 PrefService* local_state_prefs) { | 31 PrefService* local_state_prefs) { |
31 return make_scoped_ptr(new PrefProxyConfigTrackerImpl( | 32 return base::WrapUnique(new PrefProxyConfigTrackerImpl( |
32 browser_state_prefs, | 33 browser_state_prefs, |
33 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO))); | 34 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO))); |
34 } | 35 } |
35 | 36 |
36 // static | 37 // static |
37 scoped_ptr<PrefProxyConfigTracker> | 38 std::unique_ptr<PrefProxyConfigTracker> |
38 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 39 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
39 PrefService* local_state_prefs) { | 40 PrefService* local_state_prefs) { |
40 return make_scoped_ptr(new PrefProxyConfigTrackerImpl( | 41 return base::WrapUnique(new PrefProxyConfigTrackerImpl( |
41 local_state_prefs, | 42 local_state_prefs, |
42 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO))); | 43 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO))); |
43 } | 44 } |
44 | 45 |
45 // static | 46 // static |
46 scoped_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService( | 47 std::unique_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService( |
47 net::NetLog* net_log, | 48 net::NetLog* net_log, |
48 net::URLRequestContext* context, | 49 net::URLRequestContext* context, |
49 net::NetworkDelegate* network_delegate, | 50 net::NetworkDelegate* network_delegate, |
50 scoped_ptr<net::ProxyConfigService> proxy_config_service, | 51 std::unique_ptr<net::ProxyConfigService> proxy_config_service, |
51 bool quick_check_enabled) { | 52 bool quick_check_enabled) { |
52 DCHECK_CURRENTLY_ON(web::WebThread::IO); | 53 DCHECK_CURRENTLY_ON(web::WebThread::IO); |
53 scoped_ptr<net::ProxyService> proxy_service( | 54 std::unique_ptr<net::ProxyService> proxy_service( |
54 net::ProxyService::CreateUsingSystemProxyResolver( | 55 net::ProxyService::CreateUsingSystemProxyResolver( |
55 std::move(proxy_config_service), 0, net_log)); | 56 std::move(proxy_config_service), 0, net_log)); |
56 proxy_service->set_quick_check_enabled(quick_check_enabled); | 57 proxy_service->set_quick_check_enabled(quick_check_enabled); |
57 return proxy_service; | 58 return proxy_service; |
58 } | 59 } |
59 | 60 |
60 } // namespace ios | 61 } // namespace ios |
OLD | NEW |