Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / net / proxy_service_factory.cc
blob5520bcbfe14d507a45b9006cbecd91398aebf8f9
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"
12 namespace ios {
14 // static
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();
24 // static
25 scoped_ptr<PrefProxyConfigTracker>
26 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile(
27 PrefService* browser_state_prefs,
28 PrefService* local_state_prefs) {
29 return make_scoped_ptr(new PrefProxyConfigTrackerImpl(
30 browser_state_prefs,
31 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO)));
34 // static
35 scoped_ptr<PrefProxyConfigTracker>
36 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
37 PrefService* local_state_prefs) {
38 return make_scoped_ptr(new PrefProxyConfigTrackerImpl(
39 local_state_prefs,
40 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO)));
43 // static
44 scoped_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService(
45 net::NetLog* net_log,
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,
53 net_log));
54 proxy_service->set_quick_check_enabled(quick_check_enabled);
55 return proxy_service.Pass();
58 } // namespace ios