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