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.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 "profile files to the root directory!"; | 424 "profile files to the root directory!"; |
425 | 425 |
426 #if defined(ENABLE_SESSION_SERVICE) | 426 #if defined(ENABLE_SESSION_SERVICE) |
427 create_session_service_timer_.Start(FROM_HERE, | 427 create_session_service_timer_.Start(FROM_HERE, |
428 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 428 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
429 &ProfileImpl::EnsureSessionServiceCreated); | 429 &ProfileImpl::EnsureSessionServiceCreated); |
430 #endif | 430 #endif |
431 | 431 |
432 // Determine if prefetch is enabled for this profile. | 432 // Determine if prefetch is enabled for this profile. |
433 // If not profile_manager is present, it means we are in a unittest. | 433 // If not profile_manager is present, it means we are in a unittest. |
434 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 434 const base::CommandLine* command_line = |
| 435 base::CommandLine::ForCurrentProcess(); |
435 predictor_ = chrome_browser_net::Predictor::CreatePredictor( | 436 predictor_ = chrome_browser_net::Predictor::CreatePredictor( |
436 !command_line->HasSwitch(switches::kDisablePreconnect), | 437 !command_line->HasSwitch(switches::kDisablePreconnect), |
437 !command_line->HasSwitch(switches::kDnsPrefetchDisable), | 438 !command_line->HasSwitch(switches::kDnsPrefetchDisable), |
438 g_browser_process->profile_manager() == NULL); | 439 g_browser_process->profile_manager() == NULL); |
439 | 440 |
440 // If we are creating the profile synchronously, then we should load the | 441 // If we are creating the profile synchronously, then we should load the |
441 // policy data immediately. | 442 // policy data immediately. |
442 bool force_immediate_policy_load = (create_mode == CREATE_MODE_SYNCHRONOUS); | 443 bool force_immediate_policy_load = (create_mode == CREATE_MODE_SYNCHRONOUS); |
443 #if defined(ENABLE_CONFIGURATION_POLICY) | 444 #if defined(ENABLE_CONFIGURATION_POLICY) |
444 policy::BrowserPolicyConnector* connector = | 445 policy::BrowserPolicyConnector* connector = |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 SSLConfigServiceManager::CreateDefaultManager(local_state)); | 585 SSLConfigServiceManager::CreateDefaultManager(local_state)); |
585 | 586 |
586 #if defined(ENABLE_BACKGROUND) | 587 #if defined(ENABLE_BACKGROUND) |
587 // Initialize the BackgroundModeManager - this has to be done here before | 588 // Initialize the BackgroundModeManager - this has to be done here before |
588 // InitExtensions() is called because it relies on receiving notifications | 589 // InitExtensions() is called because it relies on receiving notifications |
589 // when extensions are loaded. BackgroundModeManager is not needed under | 590 // when extensions are loaded. BackgroundModeManager is not needed under |
590 // ChromeOS because Chrome is always running, no need for special keep-alive | 591 // ChromeOS because Chrome is always running, no need for special keep-alive |
591 // or launch-on-startup support unless kKeepAliveForTest is set. | 592 // or launch-on-startup support unless kKeepAliveForTest is set. |
592 bool init_background_mode_manager = true; | 593 bool init_background_mode_manager = true; |
593 #if defined(OS_CHROMEOS) | 594 #if defined(OS_CHROMEOS) |
594 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kKeepAliveForTest)) | 595 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 596 switches::kKeepAliveForTest)) |
595 init_background_mode_manager = false; | 597 init_background_mode_manager = false; |
596 #endif | 598 #endif |
597 if (init_background_mode_manager) { | 599 if (init_background_mode_manager) { |
598 if (g_browser_process->background_mode_manager()) | 600 if (g_browser_process->background_mode_manager()) |
599 g_browser_process->background_mode_manager()->RegisterProfile(this); | 601 g_browser_process->background_mode_manager()->RegisterProfile(this); |
600 } | 602 } |
601 #endif // defined(ENABLE_BACKGROUND) | 603 #endif // defined(ENABLE_BACKGROUND) |
602 | 604 |
603 base::FilePath cookie_path = GetPath(); | 605 base::FilePath cookie_path = GetPath(); |
604 cookie_path = cookie_path.Append(chrome::kCookieFilename); | 606 cookie_path = cookie_path.Append(chrome::kCookieFilename); |
(...skipping 16 matching lines...) Expand all Loading... |
621 base::FilePath infinite_cache_path = GetPath(); | 623 base::FilePath infinite_cache_path = GetPath(); |
622 infinite_cache_path = | 624 infinite_cache_path = |
623 infinite_cache_path.Append(FILE_PATH_LITERAL("Infinite Cache")); | 625 infinite_cache_path.Append(FILE_PATH_LITERAL("Infinite Cache")); |
624 | 626 |
625 #if defined(OS_ANDROID) | 627 #if defined(OS_ANDROID) |
626 SessionStartupPref::Type startup_pref_type = | 628 SessionStartupPref::Type startup_pref_type = |
627 SessionStartupPref::GetDefaultStartupType(); | 629 SessionStartupPref::GetDefaultStartupType(); |
628 #else | 630 #else |
629 SessionStartupPref::Type startup_pref_type = | 631 SessionStartupPref::Type startup_pref_type = |
630 StartupBrowserCreator::GetSessionStartupPref( | 632 StartupBrowserCreator::GetSessionStartupPref( |
631 *CommandLine::ForCurrentProcess(), this).type; | 633 *base::CommandLine::ForCurrentProcess(), this).type; |
632 #endif | 634 #endif |
633 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = | 635 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = |
634 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; | 636 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; |
635 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || | 637 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || |
636 startup_pref_type == SessionStartupPref::LAST) { | 638 startup_pref_type == SessionStartupPref::LAST) { |
637 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; | 639 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; |
638 } | 640 } |
639 | 641 |
640 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); | 642 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); |
641 | 643 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 } | 1301 } |
1300 | 1302 |
1301 void ProfileImpl::ClearNetworkingHistorySince( | 1303 void ProfileImpl::ClearNetworkingHistorySince( |
1302 base::Time time, | 1304 base::Time time, |
1303 const base::Closure& completion) { | 1305 const base::Closure& completion) { |
1304 io_data_.ClearNetworkingHistorySince(time, completion); | 1306 io_data_.ClearNetworkingHistorySince(time, completion); |
1305 } | 1307 } |
1306 | 1308 |
1307 GURL ProfileImpl::GetHomePage() { | 1309 GURL ProfileImpl::GetHomePage() { |
1308 // --homepage overrides any preferences. | 1310 // --homepage overrides any preferences. |
1309 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1311 const base::CommandLine& command_line = |
| 1312 *base::CommandLine::ForCurrentProcess(); |
1310 if (command_line.HasSwitch(switches::kHomePage)) { | 1313 if (command_line.HasSwitch(switches::kHomePage)) { |
1311 // TODO(evanm): clean up usage of DIR_CURRENT. | 1314 // TODO(evanm): clean up usage of DIR_CURRENT. |
1312 // http://code.google.com/p/chromium/issues/detail?id=60630 | 1315 // http://code.google.com/p/chromium/issues/detail?id=60630 |
1313 // For now, allow this code to call getcwd(). | 1316 // For now, allow this code to call getcwd(). |
1314 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1317 base::ThreadRestrictions::ScopedAllowIO allow_io; |
1315 | 1318 |
1316 base::FilePath browser_directory; | 1319 base::FilePath browser_directory; |
1317 PathService::Get(base::DIR_CURRENT, &browser_directory); | 1320 PathService::Get(base::DIR_CURRENT, &browser_directory); |
1318 GURL home_page(url_fixer::FixupRelativeFile( | 1321 GURL home_page(url_fixer::FixupRelativeFile( |
1319 browser_directory, | 1322 browser_directory, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1419 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1417 domain_reliability::DomainReliabilityService* service = | 1420 domain_reliability::DomainReliabilityService* service = |
1418 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1421 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1419 GetForBrowserContext(this); | 1422 GetForBrowserContext(this); |
1420 if (!service) | 1423 if (!service) |
1421 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1424 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1422 | 1425 |
1423 return service->CreateMonitor( | 1426 return service->CreateMonitor( |
1424 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1427 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
1425 } | 1428 } |
OLD | NEW |