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.
5 #include "ios/chrome/browser/net/proxy_service_factory.h"
7 #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
8 #include "ios/web/public/web_thread.h"
9 #include "net/proxy/proxy_config_service.h"
10 #include "net/proxy/proxy_service.h"
15 scoped_ptr
<net::ProxyConfigService
>
16 ProxyServiceFactory::CreateProxyConfigService(PrefProxyConfigTracker
* tracker
) {
17 scoped_ptr
<net::ProxyConfigService
> base_service(
18 net::ProxyService::CreateSystemProxyConfigService(
19 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO
),
20 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE)));
21 return tracker
->CreateTrackingProxyConfigService(base_service
.Pass()).Pass();
25 scoped_ptr
<PrefProxyConfigTracker
>
26 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile(
27 PrefService
* browser_state_prefs
,
28 PrefService
* local_state_prefs
) {
29 return make_scoped_ptr(new PrefProxyConfigTrackerImpl(
31 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO
)));
35 scoped_ptr
<PrefProxyConfigTracker
>
36 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
37 PrefService
* local_state_prefs
) {
38 return make_scoped_ptr(new PrefProxyConfigTrackerImpl(
40 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO
)));
44 scoped_ptr
<net::ProxyService
> ProxyServiceFactory::CreateProxyService(
46 net::URLRequestContext
* context
,
47 net::NetworkDelegate
* network_delegate
,
48 net::ProxyConfigService
* proxy_config_service
,
49 bool quick_check_enabled
) {
50 DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::IO
);
51 scoped_ptr
<net::ProxyService
> proxy_service(
52 net::ProxyService::CreateUsingSystemProxyResolver(proxy_config_service
, 0,
54 proxy_service
->set_quick_check_enabled(quick_check_enabled
);
55 return proxy_service
.Pass();