| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 bool incognito_pref_store) { | 275 bool incognito_pref_store) { |
| 276 #if defined(ENABLE_EXTENSIONS) | 276 #if defined(ENABLE_EXTENSIONS) |
| 277 return new ExtensionPrefStore( | 277 return new ExtensionPrefStore( |
| 278 ExtensionPrefValueMapFactory::GetForBrowserContext(profile), | 278 ExtensionPrefValueMapFactory::GetForBrowserContext(profile), |
| 279 incognito_pref_store); | 279 incognito_pref_store); |
| 280 #else | 280 #else |
| 281 return NULL; | 281 return NULL; |
| 282 #endif | 282 #endif |
| 283 } | 283 } |
| 284 | 284 |
| 285 #if !defined(OS_ANDROID) | |
| 286 // Deletes the file that was used by the AutomaticProfileResetter service, which | |
| 287 // has since been removed, to store that the prompt had already been shown. | |
| 288 // TODO(engedy): Remove this and caller in M42 or later. See crbug.com/398813. | |
| 289 void DeleteResetPromptMementoFile(const base::FilePath& profile_dir) { | |
| 290 base::FilePath memento_path = | |
| 291 profile_dir.Append(FILE_PATH_LITERAL("Reset Prompt Memento")); | |
| 292 base::DeleteFile(memento_path, false); | |
| 293 } | |
| 294 #endif | |
| 295 | |
| 296 } // namespace | 285 } // namespace |
| 297 | 286 |
| 298 // static | 287 // static |
| 299 Profile* Profile::CreateProfile(const base::FilePath& path, | 288 Profile* Profile::CreateProfile(const base::FilePath& path, |
| 300 Delegate* delegate, | 289 Delegate* delegate, |
| 301 CreateMode create_mode) { | 290 CreateMode create_mode) { |
| 302 TRACE_EVENT_BEGIN1("browser", | 291 TRACE_EVENT_BEGIN1("browser", |
| 303 "Profile::CreateProfile", | 292 "Profile::CreateProfile", |
| 304 "profile_path", | 293 "profile_path", |
| 305 path.value().c_str()); | 294 path.value().c_str()); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 base::TimeDelta::FromMilliseconds(create_readme_delay_ms)); | 706 base::TimeDelta::FromMilliseconds(create_readme_delay_ms)); |
| 718 | 707 |
| 719 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); | 708 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); |
| 720 content::BrowserContext::GetDefaultStoragePartition(this)-> | 709 content::BrowserContext::GetDefaultStoragePartition(this)-> |
| 721 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); | 710 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); |
| 722 | 711 |
| 723 // The DomDistillerViewerSource is not a normal WebUI so it must be registered | 712 // The DomDistillerViewerSource is not a normal WebUI so it must be registered |
| 724 // as a URLDataSource early. | 713 // as a URLDataSource early. |
| 725 RegisterDomDistillerViewerSource(this); | 714 RegisterDomDistillerViewerSource(this); |
| 726 | 715 |
| 727 #if !defined(OS_ANDROID) | |
| 728 BrowserThread::GetBlockingPool()->PostDelayedWorkerTask( | |
| 729 FROM_HERE, | |
| 730 base::Bind(&DeleteResetPromptMementoFile, GetPath()), | |
| 731 base::TimeDelta::FromMilliseconds(2 * create_readme_delay_ms)); | |
| 732 #endif | |
| 733 | |
| 734 // Creation has been finished. | 716 // Creation has been finished. |
| 735 TRACE_EVENT_END1("browser", | 717 TRACE_EVENT_END1("browser", |
| 736 "Profile::CreateProfile", | 718 "Profile::CreateProfile", |
| 737 "profile_path", | 719 "profile_path", |
| 738 path_.value().c_str()); | 720 path_.value().c_str()); |
| 739 | 721 |
| 740 #if defined(OS_CHROMEOS) | 722 #if defined(OS_CHROMEOS) |
| 741 if (chromeos::LoginUtils::Get()->RestartToApplyPerSessionFlagsIfNeed(this, | 723 if (chromeos::LoginUtils::Get()->RestartToApplyPerSessionFlagsIfNeed(this, |
| 742 true)) { | 724 true)) { |
| 743 return; | 725 return; |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1434 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1453 GetForBrowserContext(this); | 1435 GetForBrowserContext(this); |
| 1454 if (!service) | 1436 if (!service) |
| 1455 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1437 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1456 | 1438 |
| 1457 return service->CreateMonitor( | 1439 return service->CreateMonitor( |
| 1458 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 1440 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 1459 local_state, | 1441 local_state, |
| 1460 prefs::kMetricsReportingEnabled); | 1442 prefs::kMetricsReportingEnabled); |
| 1461 } | 1443 } |
| OLD | NEW |