| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_getter.h" | 5 #include "chrome/browser/net/chrome_url_request_context_getter.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Factory that creates the main URLRequestContext. | 42 // Factory that creates the main URLRequestContext. |
| 43 class FactoryForMain : public ChromeURLRequestContextFactory { | 43 class FactoryForMain : public ChromeURLRequestContextFactory { |
| 44 public: | 44 public: |
| 45 FactoryForMain( | 45 FactoryForMain( |
| 46 const ProfileIOData* profile_io_data, | 46 const ProfileIOData* profile_io_data, |
| 47 content::ProtocolHandlerMap* protocol_handlers, | 47 content::ProtocolHandlerMap* protocol_handlers, |
| 48 content::URLRequestInterceptorScopedVector request_interceptors) | 48 content::URLRequestInterceptorScopedVector request_interceptors) |
| 49 : profile_io_data_(profile_io_data), | 49 : profile_io_data_(profile_io_data), |
| 50 request_interceptors_(std::move(request_interceptors)) { | 50 request_interceptors_(std::move(request_interceptors)) { |
| 51 std::swap(protocol_handlers_, *protocol_handlers); | 51 std::swap(protocol_handlers_, *protocol_handlers); |
| 52 #if DCHECK_IS_ON() |
| 53 for (const auto& handler : protocol_handlers_) |
| 54 DCHECK(ProfileIOData::IsBuiltInProtocol(handler.first)); |
| 55 #endif |
| 52 } | 56 } |
| 53 | 57 |
| 54 net::URLRequestContext* Create() override { | 58 net::URLRequestContext* Create() override { |
| 55 profile_io_data_->Init(&protocol_handlers_, | 59 profile_io_data_->Init(&protocol_handlers_, |
| 56 std::move(request_interceptors_)); | 60 std::move(request_interceptors_)); |
| 57 return profile_io_data_->GetMainRequestContext(); | 61 return profile_io_data_->GetMainRequestContext(); |
| 58 } | 62 } |
| 59 | 63 |
| 60 private: | 64 private: |
| 61 const ProfileIOData* const profile_io_data_; | 65 const ProfileIOData* const profile_io_data_; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ChromeURLRequestContextGetter* | 261 ChromeURLRequestContextGetter* |
| 258 ChromeURLRequestContextGetter::CreateForIsolatedMedia( | 262 ChromeURLRequestContextGetter::CreateForIsolatedMedia( |
| 259 Profile* profile, | 263 Profile* profile, |
| 260 ChromeURLRequestContextGetter* app_context, | 264 ChromeURLRequestContextGetter* app_context, |
| 261 const ProfileIOData* profile_io_data, | 265 const ProfileIOData* profile_io_data, |
| 262 const StoragePartitionDescriptor& partition_descriptor) { | 266 const StoragePartitionDescriptor& partition_descriptor) { |
| 263 return new ChromeURLRequestContextGetter( | 267 return new ChromeURLRequestContextGetter( |
| 264 new FactoryForIsolatedMedia( | 268 new FactoryForIsolatedMedia( |
| 265 profile_io_data, partition_descriptor, app_context)); | 269 profile_io_data, partition_descriptor, app_context)); |
| 266 } | 270 } |
| OLD | NEW |