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