| 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/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 iter->second->CleanupOnUIThread(); | 75 iter->second->CleanupOnUIThread(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 if (io_data_->http_server_properties_manager_.get()) | 78 if (io_data_->http_server_properties_manager_.get()) |
| 79 io_data_->http_server_properties_manager_->ShutdownOnUIThread(); | 79 io_data_->http_server_properties_manager_->ShutdownOnUIThread(); |
| 80 io_data_->ShutdownOnUIThread(); | 80 io_data_->ShutdownOnUIThread(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ProfileImplIOData::Handle::Init( | 83 void ProfileImplIOData::Handle::Init( |
| 84 const FilePath& cookie_path, | 84 const FilePath& cookie_path, |
| 85 const FilePath& origin_bound_cert_path, | 85 const FilePath& server_bound_cert_path, |
| 86 const FilePath& cache_path, | 86 const FilePath& cache_path, |
| 87 int cache_max_size, | 87 int cache_max_size, |
| 88 const FilePath& media_cache_path, | 88 const FilePath& media_cache_path, |
| 89 int media_cache_max_size, | 89 int media_cache_max_size, |
| 90 const FilePath& extensions_cookie_path, | 90 const FilePath& extensions_cookie_path, |
| 91 const FilePath& app_path, | 91 const FilePath& app_path, |
| 92 chrome_browser_net::Predictor* predictor, | 92 chrome_browser_net::Predictor* predictor, |
| 93 PrefService* local_state, | 93 PrefService* local_state, |
| 94 IOThread* io_thread, | 94 IOThread* io_thread, |
| 95 bool restore_old_session_cookies) { | 95 bool restore_old_session_cookies) { |
| 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 97 DCHECK(!io_data_->lazy_params_.get()); | 97 DCHECK(!io_data_->lazy_params_.get()); |
| 98 DCHECK(predictor); | 98 DCHECK(predictor); |
| 99 | 99 |
| 100 LazyParams* lazy_params = new LazyParams; | 100 LazyParams* lazy_params = new LazyParams; |
| 101 | 101 |
| 102 lazy_params->cookie_path = cookie_path; | 102 lazy_params->cookie_path = cookie_path; |
| 103 lazy_params->origin_bound_cert_path = origin_bound_cert_path; | 103 lazy_params->server_bound_cert_path = server_bound_cert_path; |
| 104 lazy_params->cache_path = cache_path; | 104 lazy_params->cache_path = cache_path; |
| 105 lazy_params->cache_max_size = cache_max_size; | 105 lazy_params->cache_max_size = cache_max_size; |
| 106 lazy_params->media_cache_path = media_cache_path; | 106 lazy_params->media_cache_path = media_cache_path; |
| 107 lazy_params->media_cache_max_size = media_cache_max_size; | 107 lazy_params->media_cache_max_size = media_cache_max_size; |
| 108 lazy_params->extensions_cookie_path = extensions_cookie_path; | 108 lazy_params->extensions_cookie_path = extensions_cookie_path; |
| 109 lazy_params->restore_old_session_cookies = restore_old_session_cookies; | 109 lazy_params->restore_old_session_cookies = restore_old_session_cookies; |
| 110 | 110 |
| 111 io_data_->lazy_params_.reset(lazy_params); | 111 io_data_->lazy_params_.reset(lazy_params); |
| 112 | 112 |
| 113 // Keep track of isolated app path separately so we can use it on demand. | 113 // Keep track of isolated app path separately so we can use it on demand. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 312 |
| 313 main_context->set_fraudulent_certificate_reporter( | 313 main_context->set_fraudulent_certificate_reporter( |
| 314 fraudulent_certificate_reporter()); | 314 fraudulent_certificate_reporter()); |
| 315 media_request_context_->set_fraudulent_certificate_reporter( | 315 media_request_context_->set_fraudulent_certificate_reporter( |
| 316 fraudulent_certificate_reporter()); | 316 fraudulent_certificate_reporter()); |
| 317 | 317 |
| 318 main_context->set_proxy_service(proxy_service()); | 318 main_context->set_proxy_service(proxy_service()); |
| 319 media_request_context_->set_proxy_service(proxy_service()); | 319 media_request_context_->set_proxy_service(proxy_service()); |
| 320 | 320 |
| 321 scoped_refptr<net::CookieStore> cookie_store = NULL; | 321 scoped_refptr<net::CookieStore> cookie_store = NULL; |
| 322 net::OriginBoundCertService* origin_bound_cert_service = NULL; | 322 net::ServerBoundCertService* server_bound_cert_service = NULL; |
| 323 if (record_mode || playback_mode) { | 323 if (record_mode || playback_mode) { |
| 324 // Don't use existing cookies and use an in-memory store. | 324 // Don't use existing cookies and use an in-memory store. |
| 325 cookie_store = new net::CookieMonster( | 325 cookie_store = new net::CookieMonster( |
| 326 NULL, profile_params->cookie_monster_delegate); | 326 NULL, profile_params->cookie_monster_delegate); |
| 327 // Don't use existing origin-bound certs and use an in-memory store. | 327 // Don't use existing server-bound certs and use an in-memory store. |
| 328 origin_bound_cert_service = new net::OriginBoundCertService( | 328 server_bound_cert_service = new net::ServerBoundCertService( |
| 329 new net::DefaultOriginBoundCertStore(NULL)); | 329 new net::DefaultServerBoundCertStore(NULL)); |
| 330 } | 330 } |
| 331 | 331 |
| 332 // setup cookie store | 332 // setup cookie store |
| 333 if (!cookie_store) { | 333 if (!cookie_store) { |
| 334 DCHECK(!lazy_params_->cookie_path.empty()); | 334 DCHECK(!lazy_params_->cookie_path.empty()); |
| 335 | 335 |
| 336 scoped_refptr<SQLitePersistentCookieStore> cookie_db = | 336 scoped_refptr<SQLitePersistentCookieStore> cookie_db = |
| 337 new SQLitePersistentCookieStore( | 337 new SQLitePersistentCookieStore( |
| 338 lazy_params_->cookie_path, | 338 lazy_params_->cookie_path, |
| 339 lazy_params_->restore_old_session_cookies); | 339 lazy_params_->restore_old_session_cookies); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 353 lazy_params_->restore_old_session_cookies), NULL); | 353 lazy_params_->restore_old_session_cookies), NULL); |
| 354 // Enable cookies for devtools and extension URLs. | 354 // Enable cookies for devtools and extension URLs. |
| 355 const char* schemes[] = {chrome::kChromeDevToolsScheme, | 355 const char* schemes[] = {chrome::kChromeDevToolsScheme, |
| 356 chrome::kExtensionScheme}; | 356 chrome::kExtensionScheme}; |
| 357 extensions_cookie_store->SetCookieableSchemes(schemes, 2); | 357 extensions_cookie_store->SetCookieableSchemes(schemes, 2); |
| 358 | 358 |
| 359 main_context->set_cookie_store(cookie_store); | 359 main_context->set_cookie_store(cookie_store); |
| 360 media_request_context_->set_cookie_store(cookie_store); | 360 media_request_context_->set_cookie_store(cookie_store); |
| 361 extensions_context->set_cookie_store(extensions_cookie_store); | 361 extensions_context->set_cookie_store(extensions_cookie_store); |
| 362 | 362 |
| 363 // Setup origin bound cert service. | 363 // Setup server bound cert service. |
| 364 if (!origin_bound_cert_service) { | 364 if (!server_bound_cert_service) { |
| 365 DCHECK(!lazy_params_->origin_bound_cert_path.empty()); | 365 DCHECK(!lazy_params_->server_bound_cert_path.empty()); |
| 366 | 366 |
| 367 scoped_refptr<SQLiteOriginBoundCertStore> origin_bound_cert_db = | 367 scoped_refptr<SQLiteServerBoundCertStore> server_bound_cert_db = |
| 368 new SQLiteOriginBoundCertStore(lazy_params_->origin_bound_cert_path); | 368 new SQLiteServerBoundCertStore(lazy_params_->server_bound_cert_path); |
| 369 origin_bound_cert_db->SetClearLocalStateOnExit( | 369 server_bound_cert_db->SetClearLocalStateOnExit( |
| 370 profile_params->clear_local_state_on_exit); | 370 profile_params->clear_local_state_on_exit); |
| 371 origin_bound_cert_service = new net::OriginBoundCertService( | 371 server_bound_cert_service = new net::ServerBoundCertService( |
| 372 new net::DefaultOriginBoundCertStore(origin_bound_cert_db.get())); | 372 new net::DefaultServerBoundCertStore(server_bound_cert_db.get())); |
| 373 } | 373 } |
| 374 | 374 |
| 375 set_origin_bound_cert_service(origin_bound_cert_service); | 375 set_server_bound_cert_service(server_bound_cert_service); |
| 376 main_context->set_origin_bound_cert_service(origin_bound_cert_service); | 376 main_context->set_server_bound_cert_service(server_bound_cert_service); |
| 377 media_request_context_->set_origin_bound_cert_service( | 377 media_request_context_->set_server_bound_cert_service( |
| 378 origin_bound_cert_service); | 378 server_bound_cert_service); |
| 379 | 379 |
| 380 net::HttpCache::DefaultBackend* main_backend = | 380 net::HttpCache::DefaultBackend* main_backend = |
| 381 new net::HttpCache::DefaultBackend( | 381 new net::HttpCache::DefaultBackend( |
| 382 net::DISK_CACHE, | 382 net::DISK_CACHE, |
| 383 lazy_params_->cache_path, | 383 lazy_params_->cache_path, |
| 384 lazy_params_->cache_max_size, | 384 lazy_params_->cache_max_size, |
| 385 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 385 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
| 386 net::HttpCache* main_cache = new net::HttpCache( | 386 net::HttpCache* main_cache = new net::HttpCache( |
| 387 main_context->host_resolver(), | 387 main_context->host_resolver(), |
| 388 main_context->cert_verifier(), | 388 main_context->cert_verifier(), |
| 389 main_context->origin_bound_cert_service(), | 389 main_context->server_bound_cert_service(), |
| 390 main_context->transport_security_state(), | 390 main_context->transport_security_state(), |
| 391 main_context->proxy_service(), | 391 main_context->proxy_service(), |
| 392 "", // pass empty ssl_session_cache_shard to share the SSL session cache | 392 "", // pass empty ssl_session_cache_shard to share the SSL session cache |
| 393 // with everything that doesn't explicitly want a different one. | 393 // with everything that doesn't explicitly want a different one. |
| 394 main_context->ssl_config_service(), | 394 main_context->ssl_config_service(), |
| 395 main_context->http_auth_handler_factory(), | 395 main_context->http_auth_handler_factory(), |
| 396 main_context->network_delegate(), | 396 main_context->network_delegate(), |
| 397 main_context->http_server_properties(), | 397 main_context->http_server_properties(), |
| 398 main_context->net_log(), | 398 main_context->net_log(), |
| 399 main_backend); | 399 main_backend); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 scoped_refptr<ChromeURLRequestContext> | 510 scoped_refptr<ChromeURLRequestContext> |
| 511 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 511 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
| 512 scoped_refptr<ChromeURLRequestContext> main_context, | 512 scoped_refptr<ChromeURLRequestContext> main_context, |
| 513 const std::string& app_id) const { | 513 const std::string& app_id) const { |
| 514 // We create per-app contexts on demand, unlike the others above. | 514 // We create per-app contexts on demand, unlike the others above. |
| 515 scoped_refptr<ChromeURLRequestContext> app_request_context = | 515 scoped_refptr<ChromeURLRequestContext> app_request_context = |
| 516 InitializeAppRequestContext(main_context, app_id); | 516 InitializeAppRequestContext(main_context, app_id); |
| 517 DCHECK(app_request_context); | 517 DCHECK(app_request_context); |
| 518 return app_request_context; | 518 return app_request_context; |
| 519 } | 519 } |
| OLD | NEW |