| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 | 325 |
| 326 void ProfileImplIOData::InitializeInternal( | 326 void ProfileImplIOData::InitializeInternal( |
| 327 ProfileParams* profile_params, | 327 ProfileParams* profile_params, |
| 328 content::ProtocolHandlerMap* protocol_handlers) const { | 328 content::ProtocolHandlerMap* protocol_handlers) const { |
| 329 ChromeURLRequestContext* main_context = main_request_context(); | 329 ChromeURLRequestContext* main_context = main_request_context(); |
| 330 | 330 |
| 331 IOThread* const io_thread = profile_params->io_thread; | 331 IOThread* const io_thread = profile_params->io_thread; |
| 332 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 332 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 333 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 333 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 334 // Only allow Record Mode if we are in a Debug build or where we are running | |
| 335 // a cycle, and the user has limited control. | |
| 336 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && | 334 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && |
| 337 (chrome::kRecordModeEnabled || | 335 chrome::kRecordModeEnabled; |
| 338 command_line.HasSwitch(switches::kVisitURLs)); | |
| 339 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 336 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
| 340 | 337 |
| 341 network_delegate()->set_predictor(predictor_.get()); | 338 network_delegate()->set_predictor(predictor_.get()); |
| 342 | 339 |
| 343 // Initialize context members. | 340 // Initialize context members. |
| 344 | 341 |
| 345 ApplyProfileParamsToContext(main_context); | 342 ApplyProfileParamsToContext(main_context); |
| 346 | 343 |
| 347 if (http_server_properties_manager_) | 344 if (http_server_properties_manager_) |
| 348 http_server_properties_manager_->InitializeOnIOThread(); | 345 http_server_properties_manager_->InitializeOnIOThread(); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 // Copy most state from the main context. | 513 // Copy most state from the main context. |
| 517 AppRequestContext* context = new AppRequestContext(load_time_stats()); | 514 AppRequestContext* context = new AppRequestContext(load_time_stats()); |
| 518 context->CopyFrom(main_context); | 515 context->CopyFrom(main_context); |
| 519 | 516 |
| 520 base::FilePath cookie_path = partition_descriptor.path.Append( | 517 base::FilePath cookie_path = partition_descriptor.path.Append( |
| 521 chrome::kCookieFilename); | 518 chrome::kCookieFilename); |
| 522 base::FilePath cache_path = | 519 base::FilePath cache_path = |
| 523 partition_descriptor.path.Append(chrome::kCacheDirname); | 520 partition_descriptor.path.Append(chrome::kCacheDirname); |
| 524 | 521 |
| 525 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 522 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 526 // Only allow Record Mode if we are in a Debug build or where we are running | |
| 527 // a cycle, and the user has limited control. | |
| 528 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && | 523 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && |
| 529 (chrome::kRecordModeEnabled || | 524 chrome::kRecordModeEnabled; |
| 530 command_line.HasSwitch(switches::kVisitURLs)); | |
| 531 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 525 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
| 532 | 526 |
| 533 // Use a separate HTTP disk cache for isolated apps. | 527 // Use a separate HTTP disk cache for isolated apps. |
| 534 net::HttpCache::BackendFactory* app_backend = NULL; | 528 net::HttpCache::BackendFactory* app_backend = NULL; |
| 535 if (partition_descriptor.in_memory) { | 529 if (partition_descriptor.in_memory) { |
| 536 app_backend = net::HttpCache::DefaultBackend::InMemory(0); | 530 app_backend = net::HttpCache::DefaultBackend::InMemory(0); |
| 537 } else { | 531 } else { |
| 538 app_backend = new net::HttpCache::DefaultBackend( | 532 app_backend = new net::HttpCache::DefaultBackend( |
| 539 net::DISK_CACHE, | 533 net::DISK_CACHE, |
| 540 ChooseCacheBackendType(), | 534 ChooseCacheBackendType(), |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 const base::Closure& completion) { | 690 const base::Closure& completion) { |
| 697 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 691 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 698 DCHECK(initialized()); | 692 DCHECK(initialized()); |
| 699 | 693 |
| 700 DCHECK(transport_security_state()); | 694 DCHECK(transport_security_state()); |
| 701 // Completes synchronously. | 695 // Completes synchronously. |
| 702 transport_security_state()->DeleteAllDynamicDataSince(time); | 696 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 703 DCHECK(http_server_properties_manager_); | 697 DCHECK(http_server_properties_manager_); |
| 704 http_server_properties_manager_->Clear(completion); | 698 http_server_properties_manager_->Clear(completion); |
| 705 } | 699 } |
| OLD | NEW |