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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 bool incognito_pref_store) { | 272 bool incognito_pref_store) { |
273 #if defined(ENABLE_EXTENSIONS) | 273 #if defined(ENABLE_EXTENSIONS) |
274 return new ExtensionPrefStore( | 274 return new ExtensionPrefStore( |
275 ExtensionPrefValueMapFactory::GetForBrowserContext(profile), | 275 ExtensionPrefValueMapFactory::GetForBrowserContext(profile), |
276 incognito_pref_store); | 276 incognito_pref_store); |
277 #else | 277 #else |
278 return NULL; | 278 return NULL; |
279 #endif | 279 #endif |
280 } | 280 } |
281 | 281 |
| 282 bool IsValidProfile(Profile* profile) { |
| 283 return g_browser_process && g_browser_process->profile_manager() && |
| 284 g_browser_process->profile_manager()->IsValidProfile(profile); |
| 285 } |
| 286 |
282 } // namespace | 287 } // namespace |
283 | 288 |
284 // static | 289 // static |
285 Profile* Profile::CreateProfile(const base::FilePath& path, | 290 Profile* Profile::CreateProfile(const base::FilePath& path, |
286 Delegate* delegate, | 291 Delegate* delegate, |
287 CreateMode create_mode) { | 292 CreateMode create_mode) { |
288 TRACE_EVENT1("browser,startup", | 293 TRACE_EVENT1("browser,startup", |
289 "Profile::CreateProfile", | 294 "Profile::CreateProfile", |
290 "profile_path", | 295 "profile_path", |
291 path.AsUTF8Unsafe()); | 296 path.AsUTF8Unsafe()); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 StartupBrowserCreator::GetSessionStartupPref( | 608 StartupBrowserCreator::GetSessionStartupPref( |
604 *base::CommandLine::ForCurrentProcess(), this).type; | 609 *base::CommandLine::ForCurrentProcess(), this).type; |
605 #endif | 610 #endif |
606 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = | 611 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = |
607 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; | 612 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; |
608 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || | 613 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || |
609 startup_pref_type == SessionStartupPref::LAST) { | 614 startup_pref_type == SessionStartupPref::LAST) { |
610 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; | 615 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; |
611 } | 616 } |
612 | 617 |
| 618 std::unique_ptr<reporting::ReportingNetworkDelegate::Handle> |
| 619 reporting_handle = |
| 620 base::MakeUnique<reporting::ReportingNetworkDelegate::Handle>(); |
| 621 reporting_handle->task_runner = base::MessageLoop::current()->task_runner(); |
| 622 reporting_handle->browser_context_is_valid = |
| 623 base::Bind(&IsValidProfile, base::Unretained(this)); |
| 624 |
| 625 reporting_handle->browser_context = this; |
| 626 |
613 // Make sure we initialize the ProfileIOData after everything else has been | 627 // Make sure we initialize the ProfileIOData after everything else has been |
614 // initialized that we might be reading from the IO thread. | 628 // initialized that we might be reading from the IO thread. |
615 | 629 |
616 io_data_.Init(cookie_path, channel_id_path, cache_path, | 630 io_data_.Init( |
617 cache_max_size, media_cache_path, media_cache_max_size, | 631 cookie_path, channel_id_path, cache_path, cache_max_size, |
618 extensions_cookie_path, GetPath(), predictor_, | 632 media_cache_path, media_cache_max_size, extensions_cookie_path, GetPath(), |
619 session_cookie_mode, GetSpecialStoragePolicy(), | 633 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), |
620 CreateDomainReliabilityMonitor(local_state)); | 634 CreateDomainReliabilityMonitor(local_state), std::move(reporting_handle)); |
621 | 635 |
622 #if defined(ENABLE_PLUGINS) | 636 #if defined(ENABLE_PLUGINS) |
623 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 637 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
624 this, io_data_.GetResourceContextNoInit()); | 638 this, io_data_.GetResourceContextNoInit()); |
625 #endif | 639 #endif |
626 | 640 |
627 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); | 641 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); |
628 content::BrowserContext::GetDefaultStoragePartition(this)-> | 642 content::BrowserContext::GetDefaultStoragePartition(this)-> |
629 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); | 643 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); |
630 | 644 |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1285 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1272 domain_reliability::DomainReliabilityService* service = | 1286 domain_reliability::DomainReliabilityService* service = |
1273 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1287 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1274 GetForBrowserContext(this); | 1288 GetForBrowserContext(this); |
1275 if (!service) | 1289 if (!service) |
1276 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1290 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1277 | 1291 |
1278 return service->CreateMonitor( | 1292 return service->CreateMonitor( |
1279 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1293 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
1280 } | 1294 } |
OLD | NEW |