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