| 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/profiles/off_the_record_profile_io_data.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 26 #include "components/net_log/chrome_net_log.h" | 26 #include "components/net_log/chrome_net_log.h" |
| 27 #include "components/prefs/pref_service.h" | 27 #include "components/prefs/pref_service.h" |
| 28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/cookie_store_factory.h" | 29 #include "content/public/browser/cookie_store_factory.h" |
| 30 #include "content/public/browser/resource_context.h" | 30 #include "content/public/browser/resource_context.h" |
| 31 #include "extensions/common/constants.h" | 31 #include "extensions/common/constants.h" |
| 32 #include "extensions/features/features.h" | 32 #include "extensions/features/features.h" |
| 33 #include "net/http/http_cache.h" | 33 #include "net/http/http_cache.h" |
| 34 #include "net/http/http_network_session.h" | 34 #include "net/http/http_network_session.h" |
| 35 #include "net/http/http_server_properties_impl.h" | |
| 36 #include "net/ssl/channel_id_service.h" | 35 #include "net/ssl/channel_id_service.h" |
| 37 #include "net/ssl/default_channel_id_store.h" | 36 #include "net/ssl/default_channel_id_store.h" |
| 38 #include "net/url_request/url_request_context_storage.h" | 37 #include "net/url_request/url_request_context_storage.h" |
| 39 #include "net/url_request/url_request_job_factory_impl.h" | 38 #include "net/url_request/url_request_job_factory_impl.h" |
| 40 #include "storage/browser/database/database_tracker.h" | 39 #include "storage/browser/database/database_tracker.h" |
| 41 | 40 |
| 42 #if BUILDFLAG(ENABLE_EXTENSIONS) | 41 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 43 #include "extensions/common/extension.h" | 42 #include "extensions/common/extension.h" |
| 44 #endif | 43 #endif |
| 45 | 44 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 191 } |
| 193 | 192 |
| 194 void OffTheRecordProfileIOData::InitializeInternal( | 193 void OffTheRecordProfileIOData::InitializeInternal( |
| 195 ProfileParams* profile_params, | 194 ProfileParams* profile_params, |
| 196 content::ProtocolHandlerMap* protocol_handlers, | 195 content::ProtocolHandlerMap* protocol_handlers, |
| 197 content::URLRequestInterceptorScopedVector request_interceptors) const { | 196 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| 198 net::URLRequestContext* main_context = main_request_context(); | 197 net::URLRequestContext* main_context = main_request_context(); |
| 199 net::URLRequestContextStorage* main_context_storage = | 198 net::URLRequestContextStorage* main_context_storage = |
| 200 main_request_context_storage(); | 199 main_request_context_storage(); |
| 201 | 200 |
| 202 // For incognito, we use the default non-persistent HttpServerPropertiesImpl. | |
| 203 main_context_storage->set_http_server_properties( | |
| 204 base::MakeUnique<net::HttpServerPropertiesImpl>()); | |
| 205 | |
| 206 // For incognito, we use a non-persistent channel ID store. | |
| 207 main_context_storage->set_channel_id_service( | |
| 208 base::MakeUnique<net::ChannelIDService>( | |
| 209 new net::DefaultChannelIDStore(nullptr))); | |
| 210 | |
| 211 using content::CookieStoreConfig; | |
| 212 main_context_storage->set_cookie_store(CreateCookieStore(CookieStoreConfig( | |
| 213 base::FilePath(), CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, NULL, | |
| 214 profile_params->cookie_monster_delegate.get()))); | |
| 215 | |
| 216 main_context->cookie_store()->SetChannelIDServiceID( | |
| 217 main_context->channel_id_service()->GetUniqueID()); | |
| 218 | |
| 219 main_context_storage->set_http_network_session( | |
| 220 CreateHttpNetworkSession(*profile_params)); | |
| 221 main_context_storage->set_http_transaction_factory( | |
| 222 CreateMainHttpFactory(main_context_storage->http_network_session(), | |
| 223 net::HttpCache::DefaultBackend::InMemory(0))); | |
| 224 | |
| 225 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory( | |
| 226 new net::URLRequestJobFactoryImpl()); | |
| 227 | |
| 228 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); | |
| 229 main_context_storage->set_job_factory(SetUpJobFactoryDefaults( | 201 main_context_storage->set_job_factory(SetUpJobFactoryDefaults( |
| 230 std::move(main_job_factory), std::move(request_interceptors), | 202 std::move(main_job_factory), std::move(request_interceptors), |
| 231 std::move(profile_params->protocol_handler_interceptor), | 203 std::move(profile_params->protocol_handler_interceptor), |
| 232 main_context->network_delegate(), main_context->host_resolver())); | 204 main_context->network_delegate(), main_context->host_resolver())); |
| 233 | 205 |
| 234 #if BUILDFLAG(ENABLE_EXTENSIONS) | 206 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 235 InitializeExtensionsRequestContext(profile_params); | 207 InitializeExtensionsRequestContext(profile_params); |
| 236 #endif | 208 #endif |
| 237 } | 209 } |
| 238 | 210 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 return app_request_context; | 304 return app_request_context; |
| 333 } | 305 } |
| 334 | 306 |
| 335 net::URLRequestContext* | 307 net::URLRequestContext* |
| 336 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( | 308 OffTheRecordProfileIOData::AcquireIsolatedMediaRequestContext( |
| 337 net::URLRequestContext* app_context, | 309 net::URLRequestContext* app_context, |
| 338 const StoragePartitionDescriptor& partition_descriptor) const { | 310 const StoragePartitionDescriptor& partition_descriptor) const { |
| 339 NOTREACHED(); | 311 NOTREACHED(); |
| 340 return NULL; | 312 return NULL; |
| 341 } | 313 } |
| OLD | NEW |