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 // Keep track of clear_local_state_on_exit for isolated apps. | 261 // Keep track of clear_local_state_on_exit for isolated apps. |
262 clear_local_state_on_exit_ = profile_params->clear_local_state_on_exit; | 262 clear_local_state_on_exit_ = profile_params->clear_local_state_on_exit; |
263 | 263 |
264 ChromeURLRequestContext* main_context = main_request_context(); | 264 ChromeURLRequestContext* main_context = main_request_context(); |
265 ChromeURLRequestContext* extensions_context = extensions_request_context(); | 265 ChromeURLRequestContext* extensions_context = extensions_request_context(); |
266 media_request_context_.reset(new ChromeURLRequestContext); | 266 media_request_context_.reset(new ChromeURLRequestContext); |
267 | 267 |
268 IOThread* const io_thread = profile_params->io_thread; | 268 IOThread* const io_thread = profile_params->io_thread; |
269 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 269 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
270 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 270 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
271 bool record_mode = chrome::kRecordModeEnabled && | 271 // Only allow Record Mode if we are in a Debug build or where we are running |
272 command_line.HasSwitch(switches::kRecordMode); | 272 // a cycle, and the user has limited control. |
| 273 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && |
| 274 (chrome::kRecordModeEnabled || |
| 275 command_line.HasSwitch(switches::kVisitURLs)); |
273 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 276 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
274 | 277 |
275 // Initialize context members. | 278 // Initialize context members. |
276 | 279 |
277 ApplyProfileParamsToContext(main_context); | 280 ApplyProfileParamsToContext(main_context); |
278 ApplyProfileParamsToContext(media_request_context_.get()); | 281 ApplyProfileParamsToContext(media_request_context_.get()); |
279 ApplyProfileParamsToContext(extensions_context); | 282 ApplyProfileParamsToContext(extensions_context); |
280 | 283 |
281 if (http_server_properties_manager()) | 284 if (http_server_properties_manager()) |
282 http_server_properties_manager()->InitializeOnIOThread(); | 285 http_server_properties_manager()->InitializeOnIOThread(); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // Copy most state from the main context. | 461 // Copy most state from the main context. |
459 context->CopyFrom(main_context); | 462 context->CopyFrom(main_context); |
460 | 463 |
461 FilePath app_path = app_path_.AppendASCII(app_id); | 464 FilePath app_path = app_path_.AppendASCII(app_id); |
462 FilePath cookie_path = app_path.Append(chrome::kCookieFilename); | 465 FilePath cookie_path = app_path.Append(chrome::kCookieFilename); |
463 FilePath cache_path = app_path.Append(chrome::kCacheDirname); | 466 FilePath cache_path = app_path.Append(chrome::kCacheDirname); |
464 // TODO(creis): Determine correct cache size. | 467 // TODO(creis): Determine correct cache size. |
465 int cache_max_size = 0; | 468 int cache_max_size = 0; |
466 | 469 |
467 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 470 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
468 bool record_mode = chrome::kRecordModeEnabled && | 471 // Only allow Record Mode if we are in a Debug build or where we are running |
469 command_line.HasSwitch(switches::kRecordMode); | 472 // a cycle, and the user has limited control. |
| 473 bool record_mode = command_line.HasSwitch(switches::kRecordMode) && |
| 474 (chrome::kRecordModeEnabled || |
| 475 command_line.HasSwitch(switches::kVisitURLs)); |
470 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 476 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
471 | 477 |
472 // Use a separate HTTP disk cache for isolated apps. | 478 // Use a separate HTTP disk cache for isolated apps. |
473 net::HttpCache::DefaultBackend* app_backend = | 479 net::HttpCache::DefaultBackend* app_backend = |
474 new net::HttpCache::DefaultBackend( | 480 new net::HttpCache::DefaultBackend( |
475 net::DISK_CACHE, | 481 net::DISK_CACHE, |
476 cache_path, | 482 cache_path, |
477 cache_max_size, | 483 cache_max_size, |
478 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 484 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
479 net::HttpNetworkSession* main_network_session = | 485 net::HttpNetworkSession* main_network_session = |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 537 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
532 base::Time time) { | 538 base::Time time) { |
533 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 539 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
534 LazyInitialize(); | 540 LazyInitialize(); |
535 | 541 |
536 DCHECK(transport_security_state()); | 542 DCHECK(transport_security_state()); |
537 transport_security_state()->DeleteSince(time); | 543 transport_security_state()->DeleteSince(time); |
538 DCHECK(http_server_properties_manager()); | 544 DCHECK(http_server_properties_manager()); |
539 http_server_properties_manager()->Clear(); | 545 http_server_properties_manager()->Clear(); |
540 } | 546 } |
OLD | NEW |