OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_view/internal/criwv_url_request_context_getter.h" | 5 #include "ios/web_view/internal/cwv_url_request_context_getter.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
15 #import "ios/net/cookies/cookie_store_ios_persistent.h" | 15 #import "ios/net/cookies/cookie_store_ios_persistent.h" |
(...skipping 20 matching lines...) Expand all Loading... |
36 #include "net/url_request/url_request_context.h" | 36 #include "net/url_request/url_request_context.h" |
37 #include "net/url_request/url_request_context_storage.h" | 37 #include "net/url_request/url_request_context_storage.h" |
38 #include "net/url_request/url_request_job_factory_impl.h" | 38 #include "net/url_request/url_request_job_factory_impl.h" |
39 | 39 |
40 #if !defined(__has_feature) || !__has_feature(objc_arc) | 40 #if !defined(__has_feature) || !__has_feature(objc_arc) |
41 #error "This file requires ARC support." | 41 #error "This file requires ARC support." |
42 #endif | 42 #endif |
43 | 43 |
44 namespace ios_web_view { | 44 namespace ios_web_view { |
45 | 45 |
46 CRIWVURLRequestContextGetter::CRIWVURLRequestContextGetter( | 46 CWVURLRequestContextGetter::CWVURLRequestContextGetter( |
47 const base::FilePath& base_path, | 47 const base::FilePath& base_path, |
48 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner, | 48 const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner, |
49 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner, | 49 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner, |
50 const scoped_refptr<base::SingleThreadTaskRunner>& cache_task_runner) | 50 const scoped_refptr<base::SingleThreadTaskRunner>& cache_task_runner) |
51 : base_path_(base_path), | 51 : base_path_(base_path), |
52 file_task_runner_(file_task_runner), | 52 file_task_runner_(file_task_runner), |
53 network_task_runner_(network_task_runner), | 53 network_task_runner_(network_task_runner), |
54 cache_task_runner_(cache_task_runner), | 54 cache_task_runner_(cache_task_runner), |
55 proxy_config_service_(new net::ProxyConfigServiceIOS), | 55 proxy_config_service_(new net::ProxyConfigServiceIOS), |
56 net_log_(new net::NetLog()) {} | 56 net_log_(new net::NetLog()) {} |
57 | 57 |
58 CRIWVURLRequestContextGetter::~CRIWVURLRequestContextGetter() {} | 58 CWVURLRequestContextGetter::~CWVURLRequestContextGetter() {} |
59 | 59 |
60 net::URLRequestContext* CRIWVURLRequestContextGetter::GetURLRequestContext() { | 60 net::URLRequestContext* CWVURLRequestContextGetter::GetURLRequestContext() { |
61 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 61 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
62 | 62 |
63 if (!url_request_context_) { | 63 if (!url_request_context_) { |
64 url_request_context_.reset(new net::URLRequestContext()); | 64 url_request_context_.reset(new net::URLRequestContext()); |
65 url_request_context_->set_net_log(net_log_.get()); | 65 url_request_context_->set_net_log(net_log_.get()); |
66 DCHECK(!network_delegate_.get()); | 66 DCHECK(!network_delegate_.get()); |
67 network_delegate_.reset(new CWVNetworkDelegate); | 67 network_delegate_.reset(new CWVNetworkDelegate); |
68 url_request_context_->set_network_delegate(network_delegate_.get()); | 68 url_request_context_->set_network_delegate(network_delegate_.get()); |
69 | 69 |
70 storage_.reset( | 70 storage_.reset( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 "data", base::MakeUnique<net::DataProtocolHandler>()); | 152 "data", base::MakeUnique<net::DataProtocolHandler>()); |
153 DCHECK(set_protocol); | 153 DCHECK(set_protocol); |
154 | 154 |
155 storage_->set_job_factory(std::move(job_factory)); | 155 storage_->set_job_factory(std::move(job_factory)); |
156 } | 156 } |
157 | 157 |
158 return url_request_context_.get(); | 158 return url_request_context_.get(); |
159 } | 159 } |
160 | 160 |
161 scoped_refptr<base::SingleThreadTaskRunner> | 161 scoped_refptr<base::SingleThreadTaskRunner> |
162 CRIWVURLRequestContextGetter::GetNetworkTaskRunner() const { | 162 CWVURLRequestContextGetter::GetNetworkTaskRunner() const { |
163 return network_task_runner_; | 163 return network_task_runner_; |
164 } | 164 } |
165 | 165 |
166 } // namespace ios_web_view | 166 } // namespace ios_web_view |
OLD | NEW |