OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 // ---------------------------------------------------------------------------- | 36 // ---------------------------------------------------------------------------- |
37 // Helper factories | 37 // Helper factories |
38 // ---------------------------------------------------------------------------- | 38 // ---------------------------------------------------------------------------- |
39 | 39 |
40 // Factory that creates the main ChromeURLRequestContext. | 40 // Factory that creates the main ChromeURLRequestContext. |
41 class FactoryForMain : public ChromeURLRequestContextFactory { | 41 class FactoryForMain : public ChromeURLRequestContextFactory { |
42 public: | 42 public: |
43 explicit FactoryForMain(const ProfileIOData* profile_io_data) | 43 FactoryForMain( |
44 : profile_io_data_(profile_io_data) {} | 44 const ProfileIOData* profile_io_data, |
| 45 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 46 blob_protocol_handler, |
| 47 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 48 file_system_protocol_handler, |
| 49 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 50 developer_protocol_handler, |
| 51 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 52 chrome_protocol_handler, |
| 53 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 54 chrome_devtools_protocol_handler) |
| 55 : profile_io_data_(profile_io_data), |
| 56 blob_protocol_handler_(blob_protocol_handler.Pass()), |
| 57 file_system_protocol_handler_(file_system_protocol_handler.Pass()), |
| 58 developer_protocol_handler_(developer_protocol_handler.Pass()), |
| 59 chrome_protocol_handler_(chrome_protocol_handler.Pass()), |
| 60 chrome_devtools_protocol_handler_( |
| 61 chrome_devtools_protocol_handler.Pass()) {} |
45 | 62 |
46 virtual ChromeURLRequestContext* Create() OVERRIDE { | 63 virtual ChromeURLRequestContext* Create() OVERRIDE { |
| 64 profile_io_data_->Init(blob_protocol_handler_.Pass(), |
| 65 file_system_protocol_handler_.Pass(), |
| 66 developer_protocol_handler_.Pass(), |
| 67 chrome_protocol_handler_.Pass(), |
| 68 chrome_devtools_protocol_handler_.Pass()); |
47 return profile_io_data_->GetMainRequestContext(); | 69 return profile_io_data_->GetMainRequestContext(); |
48 } | 70 } |
49 | 71 |
50 private: | 72 private: |
51 const ProfileIOData* const profile_io_data_; | 73 const ProfileIOData* const profile_io_data_; |
| 74 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler_; |
| 75 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 76 file_system_protocol_handler_; |
| 77 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 78 developer_protocol_handler_; |
| 79 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 80 chrome_protocol_handler_; |
| 81 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 82 chrome_devtools_protocol_handler_; |
52 }; | 83 }; |
53 | 84 |
54 // Factory that creates the ChromeURLRequestContext for extensions. | 85 // Factory that creates the ChromeURLRequestContext for extensions. |
55 class FactoryForExtensions : public ChromeURLRequestContextFactory { | 86 class FactoryForExtensions : public ChromeURLRequestContextFactory { |
56 public: | 87 public: |
57 explicit FactoryForExtensions(const ProfileIOData* profile_io_data) | 88 explicit FactoryForExtensions(const ProfileIOData* profile_io_data) |
58 : profile_io_data_(profile_io_data) {} | 89 : profile_io_data_(profile_io_data) {} |
59 | 90 |
60 virtual ChromeURLRequestContext* Create() OVERRIDE { | 91 virtual ChromeURLRequestContext* Create() OVERRIDE { |
61 return profile_io_data_->GetExtensionsRequestContext(); | 92 return profile_io_data_->GetExtensionsRequestContext(); |
62 } | 93 } |
63 | 94 |
64 private: | 95 private: |
65 const ProfileIOData* const profile_io_data_; | 96 const ProfileIOData* const profile_io_data_; |
66 }; | 97 }; |
67 | 98 |
68 // Factory that creates the ChromeURLRequestContext for a given isolated app. | 99 // Factory that creates the ChromeURLRequestContext for a given isolated app. |
69 class FactoryForIsolatedApp : public ChromeURLRequestContextFactory { | 100 class FactoryForIsolatedApp : public ChromeURLRequestContextFactory { |
70 public: | 101 public: |
71 FactoryForIsolatedApp( | 102 FactoryForIsolatedApp( |
72 const ProfileIOData* profile_io_data, | 103 const ProfileIOData* profile_io_data, |
73 const StoragePartitionDescriptor& partition_descriptor, | 104 const StoragePartitionDescriptor& partition_descriptor, |
74 ChromeURLRequestContextGetter* main_context, | 105 ChromeURLRequestContextGetter* main_context, |
75 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 106 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
76 protocol_handler_interceptor) | 107 protocol_handler_interceptor, |
| 108 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 109 blob_protocol_handler, |
| 110 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 111 file_system_protocol_handler, |
| 112 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 113 developer_protocol_handler, |
| 114 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 115 chrome_protocol_handler, |
| 116 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 117 chrome_devtools_protocol_handler) |
77 : profile_io_data_(profile_io_data), | 118 : profile_io_data_(profile_io_data), |
78 partition_descriptor_(partition_descriptor), | 119 partition_descriptor_(partition_descriptor), |
79 main_request_context_getter_(main_context), | 120 main_request_context_getter_(main_context), |
80 protocol_handler_interceptor_(protocol_handler_interceptor.Pass()) {} | 121 protocol_handler_interceptor_(protocol_handler_interceptor.Pass()), |
| 122 blob_protocol_handler_(blob_protocol_handler.Pass()), |
| 123 file_system_protocol_handler_(file_system_protocol_handler.Pass()), |
| 124 developer_protocol_handler_(developer_protocol_handler.Pass()), |
| 125 chrome_protocol_handler_(chrome_protocol_handler.Pass()), |
| 126 chrome_devtools_protocol_handler_( |
| 127 chrome_devtools_protocol_handler.Pass()) {} |
81 | 128 |
82 virtual ChromeURLRequestContext* Create() OVERRIDE { | 129 virtual ChromeURLRequestContext* Create() OVERRIDE { |
83 // We will copy most of the state from the main request context. | 130 // We will copy most of the state from the main request context. |
84 // | 131 // |
85 // Note that this factory is one-shot. After Create() is called once, the | 132 // Note that this factory is one-shot. After Create() is called once, the |
86 // factory is actually destroyed. Thus it is safe to destructively pass | 133 // factory is actually destroyed. Thus it is safe to destructively pass |
87 // state onwards. | 134 // state onwards. |
88 return profile_io_data_->GetIsolatedAppRequestContext( | 135 return profile_io_data_->GetIsolatedAppRequestContext( |
89 main_request_context_getter_->GetIOContext(), partition_descriptor_, | 136 main_request_context_getter_->GetIOContext(), partition_descriptor_, |
90 protocol_handler_interceptor_.Pass()); | 137 protocol_handler_interceptor_.Pass(), blob_protocol_handler_.Pass(), |
| 138 file_system_protocol_handler_.Pass(), |
| 139 developer_protocol_handler_.Pass(), |
| 140 chrome_protocol_handler_.Pass(), |
| 141 chrome_devtools_protocol_handler_.Pass()); |
91 } | 142 } |
92 | 143 |
93 private: | 144 private: |
94 const ProfileIOData* const profile_io_data_; | 145 const ProfileIOData* const profile_io_data_; |
95 const StoragePartitionDescriptor partition_descriptor_; | 146 const StoragePartitionDescriptor partition_descriptor_; |
96 scoped_refptr<ChromeURLRequestContextGetter> | 147 scoped_refptr<ChromeURLRequestContextGetter> |
97 main_request_context_getter_; | 148 main_request_context_getter_; |
98 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 149 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
99 protocol_handler_interceptor_; | 150 protocol_handler_interceptor_; |
| 151 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 152 blob_protocol_handler_; |
| 153 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 154 file_system_protocol_handler_; |
| 155 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 156 developer_protocol_handler_; |
| 157 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 158 chrome_protocol_handler_; |
| 159 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 160 chrome_devtools_protocol_handler_; |
100 }; | 161 }; |
101 | 162 |
102 // Factory that creates the media ChromeURLRequestContext for a given isolated | 163 // Factory that creates the media ChromeURLRequestContext for a given isolated |
103 // app. The media context is based on the corresponding isolated app's context. | 164 // app. The media context is based on the corresponding isolated app's context. |
104 class FactoryForIsolatedMedia : public ChromeURLRequestContextFactory { | 165 class FactoryForIsolatedMedia : public ChromeURLRequestContextFactory { |
105 public: | 166 public: |
106 FactoryForIsolatedMedia( | 167 FactoryForIsolatedMedia( |
107 const ProfileIOData* profile_io_data, | 168 const ProfileIOData* profile_io_data, |
108 const StoragePartitionDescriptor& partition_descriptor, | 169 const StoragePartitionDescriptor& partition_descriptor, |
109 ChromeURLRequestContextGetter* app_context) | 170 ChromeURLRequestContextGetter* app_context) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 236 } |
176 | 237 |
177 scoped_refptr<base::SingleThreadTaskRunner> | 238 scoped_refptr<base::SingleThreadTaskRunner> |
178 ChromeURLRequestContextGetter::GetNetworkTaskRunner() const { | 239 ChromeURLRequestContextGetter::GetNetworkTaskRunner() const { |
179 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 240 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
180 } | 241 } |
181 | 242 |
182 // static | 243 // static |
183 ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal( | 244 ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal( |
184 Profile* profile, | 245 Profile* profile, |
185 const ProfileIOData* profile_io_data) { | 246 const ProfileIOData* profile_io_data, |
| 247 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 248 blob_protocol_handler, |
| 249 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 250 file_system_protocol_handler, |
| 251 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 252 developer_protocol_handler, |
| 253 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 254 chrome_protocol_handler, |
| 255 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 256 chrome_devtools_protocol_handler) { |
186 DCHECK(!profile->IsOffTheRecord()); | 257 DCHECK(!profile->IsOffTheRecord()); |
187 return new ChromeURLRequestContextGetter( | 258 return new ChromeURLRequestContextGetter( |
188 new FactoryForMain(profile_io_data)); | 259 new FactoryForMain(profile_io_data, |
| 260 blob_protocol_handler.Pass(), |
| 261 file_system_protocol_handler.Pass(), |
| 262 developer_protocol_handler.Pass(), |
| 263 chrome_protocol_handler.Pass(), |
| 264 chrome_devtools_protocol_handler.Pass())); |
189 } | 265 } |
190 | 266 |
191 // static | 267 // static |
192 ChromeURLRequestContextGetter* | 268 ChromeURLRequestContextGetter* |
193 ChromeURLRequestContextGetter::CreateOriginalForMedia( | 269 ChromeURLRequestContextGetter::CreateOriginalForMedia( |
194 Profile* profile, const ProfileIOData* profile_io_data) { | 270 Profile* profile, const ProfileIOData* profile_io_data) { |
195 DCHECK(!profile->IsOffTheRecord()); | 271 DCHECK(!profile->IsOffTheRecord()); |
196 return new ChromeURLRequestContextGetter( | 272 return new ChromeURLRequestContextGetter( |
197 new FactoryForMedia(profile_io_data)); | 273 new FactoryForMedia(profile_io_data)); |
198 } | 274 } |
199 | 275 |
200 // static | 276 // static |
201 ChromeURLRequestContextGetter* | 277 ChromeURLRequestContextGetter* |
202 ChromeURLRequestContextGetter::CreateOriginalForExtensions( | 278 ChromeURLRequestContextGetter::CreateOriginalForExtensions( |
203 Profile* profile, const ProfileIOData* profile_io_data) { | 279 Profile* profile, const ProfileIOData* profile_io_data) { |
204 DCHECK(!profile->IsOffTheRecord()); | 280 DCHECK(!profile->IsOffTheRecord()); |
205 return new ChromeURLRequestContextGetter( | 281 return new ChromeURLRequestContextGetter( |
206 new FactoryForExtensions(profile_io_data)); | 282 new FactoryForExtensions(profile_io_data)); |
207 } | 283 } |
208 | 284 |
209 // static | 285 // static |
210 ChromeURLRequestContextGetter* | 286 ChromeURLRequestContextGetter* |
211 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( | 287 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( |
212 Profile* profile, | 288 Profile* profile, |
213 const ProfileIOData* profile_io_data, | 289 const ProfileIOData* profile_io_data, |
214 const StoragePartitionDescriptor& partition_descriptor, | 290 const StoragePartitionDescriptor& partition_descriptor, |
215 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 291 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
216 protocol_handler_interceptor) { | 292 protocol_handler_interceptor, |
| 293 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 294 blob_protocol_handler, |
| 295 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 296 file_system_protocol_handler, |
| 297 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 298 developer_protocol_handler, |
| 299 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 300 chrome_protocol_handler, |
| 301 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 302 chrome_devtools_protocol_handler) { |
217 DCHECK(!profile->IsOffTheRecord()); | 303 DCHECK(!profile->IsOffTheRecord()); |
218 ChromeURLRequestContextGetter* main_context = | 304 ChromeURLRequestContextGetter* main_context = |
219 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); | 305 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); |
220 return new ChromeURLRequestContextGetter( | 306 return new ChromeURLRequestContextGetter( |
221 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, | 307 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, |
222 main_context, protocol_handler_interceptor.Pass())); | 308 main_context, protocol_handler_interceptor.Pass(), |
| 309 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), |
| 310 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), |
| 311 chrome_devtools_protocol_handler.Pass())); |
223 } | 312 } |
224 | 313 |
225 // static | 314 // static |
226 ChromeURLRequestContextGetter* | 315 ChromeURLRequestContextGetter* |
227 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( | 316 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( |
228 Profile* profile, | 317 Profile* profile, |
229 ChromeURLRequestContextGetter* app_context, | 318 ChromeURLRequestContextGetter* app_context, |
230 const ProfileIOData* profile_io_data, | 319 const ProfileIOData* profile_io_data, |
231 const StoragePartitionDescriptor& partition_descriptor) { | 320 const StoragePartitionDescriptor& partition_descriptor) { |
232 DCHECK(!profile->IsOffTheRecord()); | 321 DCHECK(!profile->IsOffTheRecord()); |
233 return new ChromeURLRequestContextGetter( | 322 return new ChromeURLRequestContextGetter( |
234 new FactoryForIsolatedMedia( | 323 new FactoryForIsolatedMedia( |
235 profile_io_data, partition_descriptor, app_context)); | 324 profile_io_data, partition_descriptor, app_context)); |
236 } | 325 } |
237 | 326 |
238 // static | 327 // static |
239 ChromeURLRequestContextGetter* | 328 ChromeURLRequestContextGetter* |
240 ChromeURLRequestContextGetter::CreateOffTheRecord( | 329 ChromeURLRequestContextGetter::CreateOffTheRecord( |
241 Profile* profile, const ProfileIOData* profile_io_data) { | 330 Profile* profile, |
| 331 const ProfileIOData* profile_io_data, |
| 332 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 333 blob_protocol_handler, |
| 334 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 335 file_system_protocol_handler, |
| 336 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 337 developer_protocol_handler, |
| 338 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 339 chrome_protocol_handler, |
| 340 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 341 chrome_devtools_protocol_handler) { |
242 DCHECK(profile->IsOffTheRecord()); | 342 DCHECK(profile->IsOffTheRecord()); |
243 return new ChromeURLRequestContextGetter( | 343 return new ChromeURLRequestContextGetter( |
244 new FactoryForMain(profile_io_data)); | 344 new FactoryForMain(profile_io_data, |
| 345 blob_protocol_handler.Pass(), |
| 346 file_system_protocol_handler.Pass(), |
| 347 developer_protocol_handler.Pass(), |
| 348 chrome_protocol_handler.Pass(), |
| 349 chrome_devtools_protocol_handler.Pass())); |
245 } | 350 } |
246 | 351 |
247 // static | 352 // static |
248 ChromeURLRequestContextGetter* | 353 ChromeURLRequestContextGetter* |
249 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( | 354 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( |
250 Profile* profile, const ProfileIOData* profile_io_data) { | 355 Profile* profile, const ProfileIOData* profile_io_data) { |
251 DCHECK(profile->IsOffTheRecord()); | 356 DCHECK(profile->IsOffTheRecord()); |
252 return new ChromeURLRequestContextGetter( | 357 return new ChromeURLRequestContextGetter( |
253 new FactoryForExtensions(profile_io_data)); | 358 new FactoryForExtensions(profile_io_data)); |
254 } | 359 } |
255 | 360 |
256 // static | 361 // static |
257 ChromeURLRequestContextGetter* | 362 ChromeURLRequestContextGetter* |
258 ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp( | 363 ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp( |
259 Profile* profile, | 364 Profile* profile, |
260 const ProfileIOData* profile_io_data, | 365 const ProfileIOData* profile_io_data, |
261 const StoragePartitionDescriptor& partition_descriptor, | 366 const StoragePartitionDescriptor& partition_descriptor, |
262 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 367 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
263 protocol_handler_interceptor) { | 368 protocol_handler_interceptor, |
| 369 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 370 blob_protocol_handler, |
| 371 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 372 file_system_protocol_handler, |
| 373 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 374 developer_protocol_handler, |
| 375 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 376 chrome_protocol_handler, |
| 377 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 378 chrome_devtools_protocol_handler) { |
264 DCHECK(profile->IsOffTheRecord()); | 379 DCHECK(profile->IsOffTheRecord()); |
265 ChromeURLRequestContextGetter* main_context = | 380 ChromeURLRequestContextGetter* main_context = |
266 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); | 381 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); |
267 return new ChromeURLRequestContextGetter( | 382 return new ChromeURLRequestContextGetter( |
268 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, | 383 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, |
269 main_context, protocol_handler_interceptor.Pass())); | 384 main_context, protocol_handler_interceptor.Pass(), |
| 385 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), |
| 386 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), |
| 387 chrome_devtools_protocol_handler.Pass())); |
270 } | 388 } |
271 | 389 |
272 // ---------------------------------------------------------------------------- | 390 // ---------------------------------------------------------------------------- |
273 // ChromeURLRequestContext | 391 // ChromeURLRequestContext |
274 // ---------------------------------------------------------------------------- | 392 // ---------------------------------------------------------------------------- |
275 | 393 |
276 ChromeURLRequestContext::ChromeURLRequestContext( | 394 ChromeURLRequestContext::ChromeURLRequestContext( |
277 ContextType type, | 395 ContextType type, |
278 chrome_browser_net::LoadTimeStats* load_time_stats) | 396 chrome_browser_net::LoadTimeStats* load_time_stats) |
279 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 397 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
280 load_time_stats_(load_time_stats) { | 398 load_time_stats_(load_time_stats) { |
281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
282 if (load_time_stats_) | 400 if (load_time_stats_) |
283 load_time_stats_->RegisterURLRequestContext(this, type); | 401 load_time_stats_->RegisterURLRequestContext(this, type); |
284 } | 402 } |
285 | 403 |
286 ChromeURLRequestContext::~ChromeURLRequestContext() { | 404 ChromeURLRequestContext::~ChromeURLRequestContext() { |
287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
288 if (load_time_stats_) | 406 if (load_time_stats_) |
289 load_time_stats_->UnregisterURLRequestContext(this); | 407 load_time_stats_->UnregisterURLRequestContext(this); |
290 } | 408 } |
291 | 409 |
292 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { | 410 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { |
293 URLRequestContext::CopyFrom(other); | 411 URLRequestContext::CopyFrom(other); |
294 | 412 |
295 // Copy ChromeURLRequestContext parameters. | 413 // Copy ChromeURLRequestContext parameters. |
296 } | 414 } |
OLD | NEW |