| 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_->GetIOContext(), partition_descriptor_, | 98 main_request_context_getter_->GetIOContext(), |
| 137 protocol_handler_interceptor_.Pass(), blob_protocol_handler_.Pass(), | 99 partition_descriptor_, |
| 138 file_system_protocol_handler_.Pass(), | 100 protocol_handler_interceptor_.Pass(), |
| 139 developer_protocol_handler_.Pass(), | 101 &protocol_handlers_); |
| 140 chrome_protocol_handler_.Pass(), | |
| 141 chrome_devtools_protocol_handler_.Pass()); | |
| 142 } | 102 } |
| 143 | 103 |
| 144 private: | 104 private: |
| 145 const ProfileIOData* const profile_io_data_; | 105 const ProfileIOData* const profile_io_data_; |
| 146 const StoragePartitionDescriptor partition_descriptor_; | 106 const StoragePartitionDescriptor partition_descriptor_; |
| 147 scoped_refptr<ChromeURLRequestContextGetter> | 107 scoped_refptr<ChromeURLRequestContextGetter> |
| 148 main_request_context_getter_; | 108 main_request_context_getter_; |
| 149 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 109 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 150 protocol_handler_interceptor_; | 110 protocol_handler_interceptor_; |
| 151 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 111 content::ProtocolHandlerMap protocol_handlers_; |
| 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_; | |
| 161 }; | 112 }; |
| 162 | 113 |
| 163 // Factory that creates the media ChromeURLRequestContext for a given isolated | 114 // Factory that creates the media ChromeURLRequestContext for a given isolated |
| 164 // 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. |
| 165 class FactoryForIsolatedMedia : public ChromeURLRequestContextFactory { | 116 class FactoryForIsolatedMedia : public ChromeURLRequestContextFactory { |
| 166 public: | 117 public: |
| 167 FactoryForIsolatedMedia( | 118 FactoryForIsolatedMedia( |
| 168 const ProfileIOData* profile_io_data, | 119 const ProfileIOData* profile_io_data, |
| 169 const StoragePartitionDescriptor& partition_descriptor, | 120 const StoragePartitionDescriptor& partition_descriptor, |
| 170 ChromeURLRequestContextGetter* app_context) | 121 ChromeURLRequestContextGetter* app_context) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 188 |
| 238 scoped_refptr<base::SingleThreadTaskRunner> | 189 scoped_refptr<base::SingleThreadTaskRunner> |
| 239 ChromeURLRequestContextGetter::GetNetworkTaskRunner() const { | 190 ChromeURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 240 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 191 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 241 } | 192 } |
| 242 | 193 |
| 243 // static | 194 // static |
| 244 ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal( | 195 ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal( |
| 245 Profile* profile, | 196 Profile* profile, |
| 246 const ProfileIOData* profile_io_data, | 197 const ProfileIOData* profile_io_data, |
| 247 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 198 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()); | 199 DCHECK(!profile->IsOffTheRecord()); |
| 258 return new ChromeURLRequestContextGetter( | 200 return new ChromeURLRequestContextGetter( |
| 259 new FactoryForMain(profile_io_data, | 201 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 } | 202 } |
| 266 | 203 |
| 267 // static | 204 // static |
| 268 ChromeURLRequestContextGetter* | 205 ChromeURLRequestContextGetter* |
| 269 ChromeURLRequestContextGetter::CreateOriginalForMedia( | 206 ChromeURLRequestContextGetter::CreateOriginalForMedia( |
| 270 Profile* profile, const ProfileIOData* profile_io_data) { | 207 Profile* profile, const ProfileIOData* profile_io_data) { |
| 271 DCHECK(!profile->IsOffTheRecord()); | 208 DCHECK(!profile->IsOffTheRecord()); |
| 272 return new ChromeURLRequestContextGetter( | 209 return new ChromeURLRequestContextGetter( |
| 273 new FactoryForMedia(profile_io_data)); | 210 new FactoryForMedia(profile_io_data)); |
| 274 } | 211 } |
| 275 | 212 |
| 276 // static | 213 // static |
| 277 ChromeURLRequestContextGetter* | 214 ChromeURLRequestContextGetter* |
| 278 ChromeURLRequestContextGetter::CreateOriginalForExtensions( | 215 ChromeURLRequestContextGetter::CreateOriginalForExtensions( |
| 279 Profile* profile, const ProfileIOData* profile_io_data) { | 216 Profile* profile, const ProfileIOData* profile_io_data) { |
| 280 DCHECK(!profile->IsOffTheRecord()); | 217 DCHECK(!profile->IsOffTheRecord()); |
| 281 return new ChromeURLRequestContextGetter( | 218 return new ChromeURLRequestContextGetter( |
| 282 new FactoryForExtensions(profile_io_data)); | 219 new FactoryForExtensions(profile_io_data)); |
| 283 } | 220 } |
| 284 | 221 |
| 285 // static | 222 // static |
| 286 ChromeURLRequestContextGetter* | 223 ChromeURLRequestContextGetter* |
| 287 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( | 224 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( |
| 288 Profile* profile, | 225 Profile* profile, |
| 289 const ProfileIOData* profile_io_data, | 226 const ProfileIOData* profile_io_data, |
| 290 const StoragePartitionDescriptor& partition_descriptor, | 227 const StoragePartitionDescriptor& partition_descriptor, |
| 291 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 228 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 292 protocol_handler_interceptor, | 229 protocol_handler_interceptor, |
| 293 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 230 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()); | 231 DCHECK(!profile->IsOffTheRecord()); |
| 304 ChromeURLRequestContextGetter* main_context = | 232 ChromeURLRequestContextGetter* main_context = |
| 305 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); | 233 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); |
| 306 return new ChromeURLRequestContextGetter( | 234 return new ChromeURLRequestContextGetter( |
| 307 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, | 235 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, |
| 308 main_context, protocol_handler_interceptor.Pass(), | 236 main_context, |
| 309 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), | 237 protocol_handler_interceptor.Pass(), |
| 310 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | 238 protocol_handlers)); |
| 311 chrome_devtools_protocol_handler.Pass())); | |
| 312 } | 239 } |
| 313 | 240 |
| 314 // static | 241 // static |
| 315 ChromeURLRequestContextGetter* | 242 ChromeURLRequestContextGetter* |
| 316 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( | 243 ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia( |
| 317 Profile* profile, | 244 Profile* profile, |
| 318 ChromeURLRequestContextGetter* app_context, | 245 ChromeURLRequestContextGetter* app_context, |
| 319 const ProfileIOData* profile_io_data, | 246 const ProfileIOData* profile_io_data, |
| 320 const StoragePartitionDescriptor& partition_descriptor) { | 247 const StoragePartitionDescriptor& partition_descriptor) { |
| 321 DCHECK(!profile->IsOffTheRecord()); | 248 DCHECK(!profile->IsOffTheRecord()); |
| 322 return new ChromeURLRequestContextGetter( | 249 return new ChromeURLRequestContextGetter( |
| 323 new FactoryForIsolatedMedia( | 250 new FactoryForIsolatedMedia( |
| 324 profile_io_data, partition_descriptor, app_context)); | 251 profile_io_data, partition_descriptor, app_context)); |
| 325 } | 252 } |
| 326 | 253 |
| 327 // static | 254 // static |
| 328 ChromeURLRequestContextGetter* | 255 ChromeURLRequestContextGetter* |
| 329 ChromeURLRequestContextGetter::CreateOffTheRecord( | 256 ChromeURLRequestContextGetter::CreateOffTheRecord( |
| 330 Profile* profile, | 257 Profile* profile, |
| 331 const ProfileIOData* profile_io_data, | 258 const ProfileIOData* profile_io_data, |
| 332 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 259 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()); | 260 DCHECK(profile->IsOffTheRecord()); |
| 343 return new ChromeURLRequestContextGetter( | 261 return new ChromeURLRequestContextGetter( |
| 344 new FactoryForMain(profile_io_data, | 262 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 } | 263 } |
| 351 | 264 |
| 352 // static | 265 // static |
| 353 ChromeURLRequestContextGetter* | 266 ChromeURLRequestContextGetter* |
| 354 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( | 267 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions( |
| 355 Profile* profile, const ProfileIOData* profile_io_data) { | 268 Profile* profile, const ProfileIOData* profile_io_data) { |
| 356 DCHECK(profile->IsOffTheRecord()); | 269 DCHECK(profile->IsOffTheRecord()); |
| 357 return new ChromeURLRequestContextGetter( | 270 return new ChromeURLRequestContextGetter( |
| 358 new FactoryForExtensions(profile_io_data)); | 271 new FactoryForExtensions(profile_io_data)); |
| 359 } | 272 } |
| 360 | 273 |
| 361 // static | 274 // static |
| 362 ChromeURLRequestContextGetter* | 275 ChromeURLRequestContextGetter* |
| 363 ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp( | 276 ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp( |
| 364 Profile* profile, | 277 Profile* profile, |
| 365 const ProfileIOData* profile_io_data, | 278 const ProfileIOData* profile_io_data, |
| 366 const StoragePartitionDescriptor& partition_descriptor, | 279 const StoragePartitionDescriptor& partition_descriptor, |
| 367 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 280 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 368 protocol_handler_interceptor, | 281 protocol_handler_interceptor, |
| 369 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 282 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()); | 283 DCHECK(profile->IsOffTheRecord()); |
| 380 ChromeURLRequestContextGetter* main_context = | 284 ChromeURLRequestContextGetter* main_context = |
| 381 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); | 285 static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext()); |
| 382 return new ChromeURLRequestContextGetter( | 286 return new ChromeURLRequestContextGetter( |
| 383 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, | 287 new FactoryForIsolatedApp(profile_io_data, partition_descriptor, |
| 384 main_context, protocol_handler_interceptor.Pass(), | 288 main_context, |
| 385 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), | 289 protocol_handler_interceptor.Pass(), |
| 386 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | 290 protocol_handlers)); |
| 387 chrome_devtools_protocol_handler.Pass())); | |
| 388 } | 291 } |
| 389 | 292 |
| 390 // ---------------------------------------------------------------------------- | 293 // ---------------------------------------------------------------------------- |
| 391 // ChromeURLRequestContext | 294 // ChromeURLRequestContext |
| 392 // ---------------------------------------------------------------------------- | 295 // ---------------------------------------------------------------------------- |
| 393 | 296 |
| 394 ChromeURLRequestContext::ChromeURLRequestContext( | 297 ChromeURLRequestContext::ChromeURLRequestContext( |
| 395 ContextType type, | 298 ContextType type, |
| 396 chrome_browser_net::LoadTimeStats* load_time_stats) | 299 chrome_browser_net::LoadTimeStats* load_time_stats) |
| 397 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 300 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 398 load_time_stats_(load_time_stats) { | 301 load_time_stats_(load_time_stats) { |
| 399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 302 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 400 if (load_time_stats_) | 303 if (load_time_stats_) |
| 401 load_time_stats_->RegisterURLRequestContext(this, type); | 304 load_time_stats_->RegisterURLRequestContext(this, type); |
| 402 } | 305 } |
| 403 | 306 |
| 404 ChromeURLRequestContext::~ChromeURLRequestContext() { | 307 ChromeURLRequestContext::~ChromeURLRequestContext() { |
| 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 308 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 406 if (load_time_stats_) | 309 if (load_time_stats_) |
| 407 load_time_stats_->UnregisterURLRequestContext(this); | 310 load_time_stats_->UnregisterURLRequestContext(this); |
| 408 } | 311 } |
| 409 | 312 |
| 410 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { | 313 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { |
| 411 URLRequestContext::CopyFrom(other); | 314 URLRequestContext::CopyFrom(other); |
| 412 | 315 |
| 413 // Copy ChromeURLRequestContext parameters. | 316 // Copy ChromeURLRequestContext parameters. |
| 414 } | 317 } |
| OLD | NEW |