| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 75 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 76 file_system_protocol_handler_; | 76 file_system_protocol_handler_; |
| 77 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 77 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 78 developer_protocol_handler_; | 78 developer_protocol_handler_; |
| 79 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 79 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 80 chrome_protocol_handler_; | 80 chrome_protocol_handler_; |
| 81 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 81 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 82 chrome_devtools_protocol_handler_; | 82 chrome_devtools_protocol_handler_; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 // Factory that creates the ChromeURLRequestContext for extensions. | |
| 86 class FactoryForExtensions : public ChromeURLRequestContextFactory { | |
| 87 public: | |
| 88 explicit FactoryForExtensions(const ProfileIOData* profile_io_data) | |
| 89 : profile_io_data_(profile_io_data) {} | |
| 90 | |
| 91 virtual ChromeURLRequestContext* Create() OVERRIDE { | |
| 92 return profile_io_data_->GetExtensionsRequestContext(); | |
| 93 } | |
| 94 | |
| 95 private: | |
| 96 const ProfileIOData* const profile_io_data_; | |
| 97 }; | |
| 98 | |
| 99 // Factory that creates the ChromeURLRequestContext for a given isolated app. | 85 // Factory that creates the ChromeURLRequestContext for a given isolated app. |
| 100 class FactoryForIsolatedApp : public ChromeURLRequestContextFactory { | 86 class FactoryForIsolatedApp : public ChromeURLRequestContextFactory { |
| 101 public: | 87 public: |
| 102 FactoryForIsolatedApp( | 88 FactoryForIsolatedApp( |
| 103 const ProfileIOData* profile_io_data, | 89 const ProfileIOData* profile_io_data, |
| 104 const StoragePartitionDescriptor& partition_descriptor, | 90 const StoragePartitionDescriptor& partition_descriptor, |
| 105 ChromeURLRequestContextGetter* main_context, | 91 ChromeURLRequestContextGetter* main_context, |
| 106 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 92 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 107 protocol_handler_interceptor, | 93 protocol_handler_interceptor, |
| 108 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 94 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 ChromeURLRequestContextGetter* | 254 ChromeURLRequestContextGetter* |
| 269 ChromeURLRequestContextGetter::CreateOriginalForMedia( | 255 ChromeURLRequestContextGetter::CreateOriginalForMedia( |
| 270 Profile* profile, const ProfileIOData* profile_io_data) { | 256 Profile* profile, const ProfileIOData* profile_io_data) { |
| 271 DCHECK(!profile->IsOffTheRecord()); | 257 DCHECK(!profile->IsOffTheRecord()); |
| 272 return new ChromeURLRequestContextGetter( | 258 return new ChromeURLRequestContextGetter( |
| 273 new FactoryForMedia(profile_io_data)); | 259 new FactoryForMedia(profile_io_data)); |
| 274 } | 260 } |
| 275 | 261 |
| 276 // static | 262 // static |
| 277 ChromeURLRequestContextGetter* | 263 ChromeURLRequestContextGetter* |
| 278 ChromeURLRequestContextGetter::CreateOriginalForExtensions( | |
| 279 Profile* profile, const ProfileIOData* profile_io_data) { | |
| 280 DCHECK(!profile->IsOffTheRecord()); | |
| 281 return new ChromeURLRequestContextGetter( | |
| 282 new FactoryForExtensions(profile_io_data)); | |
| 283 } | |
| 284 | |
| 285 // static | |
| 286 ChromeURLRequestContextGetter* | |
| 287 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( | 264 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( |
| 288 Profile* profile, | 265 Profile* profile, |
| 289 const ProfileIOData* profile_io_data, | 266 const ProfileIOData* profile_io_data, |
| 290 const StoragePartitionDescriptor& partition_descriptor, | 267 const StoragePartitionDescriptor& partition_descriptor, |
| 291 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 268 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 292 protocol_handler_interceptor, | 269 protocol_handler_interceptor, |
| 293 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 270 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 294 blob_protocol_handler, | 271 blob_protocol_handler, |
| 295 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 272 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 296 file_system_protocol_handler, | 273 file_system_protocol_handler, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 new FactoryForMain(profile_io_data, | 321 new FactoryForMain(profile_io_data, |
| 345 blob_protocol_handler.Pass(), | 322 blob_protocol_handler.Pass(), |
| 346 file_system_protocol_handler.Pass(), | 323 file_system_protocol_handler.Pass(), |
| 347 developer_protocol_handler.Pass(), | 324 developer_protocol_handler.Pass(), |
| 348 chrome_protocol_handler.Pass(), | 325 chrome_protocol_handler.Pass(), |
| 349 chrome_devtools_protocol_handler.Pass())); | 326 chrome_devtools_protocol_handler.Pass())); |
| 350 } | 327 } |
| 351 | 328 |
| 352 // static | 329 // static |
| 353 ChromeURLRequestContextGetter* | 330 ChromeURLRequestContextGetter* |
| 354 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( | |
| 355 Profile* profile, const ProfileIOData* profile_io_data) { | |
| 356 DCHECK(profile->IsOffTheRecord()); | |
| 357 return new ChromeURLRequestContextGetter( | |
| 358 new FactoryForExtensions(profile_io_data)); | |
| 359 } | |
| 360 | |
| 361 // static | |
| 362 ChromeURLRequestContextGetter* | |
| 363 ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp( | 331 ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp( |
| 364 Profile* profile, | 332 Profile* profile, |
| 365 const ProfileIOData* profile_io_data, | 333 const ProfileIOData* profile_io_data, |
| 366 const StoragePartitionDescriptor& partition_descriptor, | 334 const StoragePartitionDescriptor& partition_descriptor, |
| 367 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 335 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 368 protocol_handler_interceptor, | 336 protocol_handler_interceptor, |
| 369 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 337 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 370 blob_protocol_handler, | 338 blob_protocol_handler, |
| 371 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 339 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 372 file_system_protocol_handler, | 340 file_system_protocol_handler, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 373 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 406 if (load_time_stats_) | 374 if (load_time_stats_) |
| 407 load_time_stats_->UnregisterURLRequestContext(this); | 375 load_time_stats_->UnregisterURLRequestContext(this); |
| 408 } | 376 } |
| 409 | 377 |
| 410 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { | 378 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { |
| 411 URLRequestContext::CopyFrom(other); | 379 URLRequestContext::CopyFrom(other); |
| 412 | 380 |
| 413 // Copy ChromeURLRequestContext parameters. | 381 // Copy ChromeURLRequestContext parameters. |
| 414 } | 382 } |
| OLD | NEW |