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