| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 if (media_request_context_.get()) | 262 if (media_request_context_.get()) |
| 263 media_request_context_->AssertNoURLRequests(); | 263 media_request_context_->AssertNoURLRequests(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void ProfileImplIOData::LazyInitializeInternal( | 266 void ProfileImplIOData::LazyInitializeInternal( |
| 267 ProfileParams* profile_params) const { | 267 ProfileParams* profile_params) const { |
| 268 ChromeURLRequestContext* main_context = main_request_context(); | 268 ChromeURLRequestContext* main_context = main_request_context(); |
| 269 ChromeURLRequestContext* extensions_context = extensions_request_context(); | 269 ChromeURLRequestContext* extensions_context = extensions_request_context(); |
| 270 media_request_context_.reset(new ChromeURLRequestContext( | 270 media_request_context_.reset(new ChromeURLRequestContext( |
| 271 ChromeURLRequestContext::CONTEXT_TYPE_MEDIA, cache_stats())); | 271 ChromeURLRequestContext::CONTEXT_TYPE_MEDIA, load_time_stats())); |
| 272 | 272 |
| 273 IOThread* const io_thread = profile_params->io_thread; | 273 IOThread* const io_thread = profile_params->io_thread; |
| 274 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 274 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 275 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 275 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 276 // Only allow Record Mode if we are in a Debug build or where we are running | 276 // Only allow Record Mode if we are in a Debug build or where we are running |
| 277 // a cycle, and the user has limited control. | 277 // a cycle, and the user has limited control. |
| 278 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && | 278 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && |
| 279 (chrome::kRecordModeEnabled || | 279 (chrome::kRecordModeEnabled || |
| 280 command_line.HasSwitch(switches::kVisitURLs)); | 280 command_line.HasSwitch(switches::kVisitURLs)); |
| 281 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 281 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 media_request_context_->set_job_factory(media_request_job_factory_.get()); | 470 media_request_context_->set_job_factory(media_request_job_factory_.get()); |
| 471 extensions_context->set_job_factory(extensions_job_factory_.get()); | 471 extensions_context->set_job_factory(extensions_job_factory_.get()); |
| 472 | 472 |
| 473 lazy_params_.reset(); | 473 lazy_params_.reset(); |
| 474 } | 474 } |
| 475 | 475 |
| 476 ChromeURLRequestContext* | 476 ChromeURLRequestContext* |
| 477 ProfileImplIOData::InitializeAppRequestContext( | 477 ProfileImplIOData::InitializeAppRequestContext( |
| 478 ChromeURLRequestContext* main_context, | 478 ChromeURLRequestContext* main_context, |
| 479 const std::string& app_id) const { | 479 const std::string& app_id) const { |
| 480 AppRequestContext* context = new AppRequestContext(cache_stats()); | 480 AppRequestContext* context = new AppRequestContext(load_time_stats()); |
| 481 | 481 |
| 482 // If this is for a guest process, we should not persist cookies and http | 482 // If this is for a guest process, we should not persist cookies and http |
| 483 // cache. | 483 // cache. |
| 484 bool guest_process = (app_id.find("guest-") != std::string::npos); | 484 bool guest_process = (app_id.find("guest-") != std::string::npos); |
| 485 | 485 |
| 486 // Copy most state from the main context. | 486 // Copy most state from the main context. |
| 487 context->CopyFrom(main_context); | 487 context->CopyFrom(main_context); |
| 488 | 488 |
| 489 FilePath app_path = app_path_.AppendASCII(app_id); | 489 FilePath app_path = app_path_.AppendASCII(app_id); |
| 490 FilePath cookie_path = app_path.Append(chrome::kCookieFilename); | 490 FilePath cookie_path = app_path.Append(chrome::kCookieFilename); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 557 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
| 558 ChromeURLRequestContext* main_context, | 558 ChromeURLRequestContext* main_context, |
| 559 const std::string& app_id) const { | 559 const std::string& app_id) const { |
| 560 // We create per-app contexts on demand, unlike the others above. | 560 // We create per-app contexts on demand, unlike the others above. |
| 561 ChromeURLRequestContext* app_request_context = | 561 ChromeURLRequestContext* app_request_context = |
| 562 InitializeAppRequestContext(main_context, app_id); | 562 InitializeAppRequestContext(main_context, app_id); |
| 563 DCHECK(app_request_context); | 563 DCHECK(app_request_context); |
| 564 return app_request_context; | 564 return app_request_context; |
| 565 } | 565 } |
| 566 | 566 |
| 567 chrome_browser_net::CacheStats* ProfileImplIOData::GetCacheStats( | 567 chrome_browser_net::LoadTimeStats* ProfileImplIOData::GetLoadTimeStats( |
| 568 IOThread::Globals* io_thread_globals) const { | 568 IOThread::Globals* io_thread_globals) const { |
| 569 return io_thread_globals->cache_stats.get(); | 569 return io_thread_globals->load_time_stats.get(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void ProfileImplIOData::CreateFtpProtocolHandler( | 572 void ProfileImplIOData::CreateFtpProtocolHandler( |
| 573 net::URLRequestJobFactory* job_factory, | 573 net::URLRequestJobFactory* job_factory, |
| 574 net::FtpAuthCache* ftp_auth_cache) const { | 574 net::FtpAuthCache* ftp_auth_cache) const { |
| 575 job_factory->SetProtocolHandler( | 575 job_factory->SetProtocolHandler( |
| 576 chrome::kFtpScheme, | 576 chrome::kFtpScheme, |
| 577 new net::FtpProtocolHandler(network_delegate(), | 577 new net::FtpProtocolHandler(network_delegate(), |
| 578 ftp_factory_.get(), | 578 ftp_factory_.get(), |
| 579 ftp_auth_cache)); | 579 ftp_auth_cache)); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 582 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
| 583 base::Time time) { | 583 base::Time time) { |
| 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 585 LazyInitialize(); | 585 LazyInitialize(); |
| 586 | 586 |
| 587 DCHECK(transport_security_state()); | 587 DCHECK(transport_security_state()); |
| 588 transport_security_state()->DeleteSince(time); | 588 transport_security_state()->DeleteSince(time); |
| 589 DCHECK(http_server_properties_manager()); | 589 DCHECK(http_server_properties_manager()); |
| 590 http_server_properties_manager()->Clear(); | 590 http_server_properties_manager()->Clear(); |
| 591 } | 591 } |
| OLD | NEW |