| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 #include "chrome/browser/chromeos/login/users/user_manager.h" | 121 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 122 #include "chrome/browser/chromeos/preferences.h" | 122 #include "chrome/browser/chromeos/preferences.h" |
| 123 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 123 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 124 #endif | 124 #endif |
| 125 | 125 |
| 126 #if defined(ENABLE_CONFIGURATION_POLICY) | 126 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 127 #include "chrome/browser/policy/schema_registry_service.h" | 127 #include "chrome/browser/policy/schema_registry_service.h" |
| 128 #include "chrome/browser/policy/schema_registry_service_factory.h" | 128 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 129 #include "components/policy/core/browser/browser_policy_connector.h" | 129 #include "components/policy/core/browser/browser_policy_connector.h" |
| 130 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
| 131 #include "chrome/browser/chromeos/login/login_utils.h" |
| 131 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 132 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 132 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 133 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 133 #else | 134 #else |
| 134 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 135 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 135 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 136 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 136 #endif | 137 #endif |
| 137 #endif | 138 #endif |
| 138 | 139 |
| 139 #if defined(ENABLE_EXTENSIONS) | 140 #if defined(ENABLE_EXTENSIONS) |
| 140 #include "chrome/browser/guest_view/guest_view_manager.h" | 141 #include "chrome/browser/guest_view/guest_view_manager.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 lazy_service, chrome::kDomDistillerScheme)); | 264 lazy_service, chrome::kDomDistillerScheme)); |
| 264 } | 265 } |
| 265 } | 266 } |
| 266 | 267 |
| 267 } // namespace | 268 } // namespace |
| 268 | 269 |
| 269 // static | 270 // static |
| 270 Profile* Profile::CreateProfile(const base::FilePath& path, | 271 Profile* Profile::CreateProfile(const base::FilePath& path, |
| 271 Delegate* delegate, | 272 Delegate* delegate, |
| 272 CreateMode create_mode) { | 273 CreateMode create_mode) { |
| 273 TRACE_EVENT0("browser", "Profile::CreateProfile") | 274 TRACE_EVENT_BEGIN1("browser", |
| 275 "Profile::CreateProfile", |
| 276 "profile_path", |
| 277 path.value().c_str()); |
| 278 |
| 274 // Get sequenced task runner for making sure that file operations of | 279 // Get sequenced task runner for making sure that file operations of |
| 275 // this profile (defined by |path|) are executed in expected order | 280 // this profile (defined by |path|) are executed in expected order |
| 276 // (what was previously assured by the FILE thread). | 281 // (what was previously assured by the FILE thread). |
| 277 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = | 282 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
| 278 JsonPrefStore::GetTaskRunnerForFile(path, | 283 JsonPrefStore::GetTaskRunnerForFile(path, |
| 279 BrowserThread::GetBlockingPool()); | 284 BrowserThread::GetBlockingPool()); |
| 280 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { | 285 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { |
| 281 DCHECK(delegate); | 286 DCHECK(delegate); |
| 282 CreateProfileDirectory(sequenced_task_runner.get(), path); | 287 CreateProfileDirectory(sequenced_task_runner.get(), path); |
| 283 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { | 288 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 628 |
| 624 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); | 629 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); |
| 625 content::BrowserContext::GetDefaultStoragePartition(this)-> | 630 content::BrowserContext::GetDefaultStoragePartition(this)-> |
| 626 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); | 631 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); |
| 627 | 632 |
| 628 // The DomDistillerViewerSource is not a normal WebUI so it must be registered | 633 // The DomDistillerViewerSource is not a normal WebUI so it must be registered |
| 629 // as a URLDataSource early. | 634 // as a URLDataSource early. |
| 630 RegisterDomDistillerViewerSource(this); | 635 RegisterDomDistillerViewerSource(this); |
| 631 | 636 |
| 632 // Creation has been finished. | 637 // Creation has been finished. |
| 638 TRACE_EVENT_END1("browser", |
| 639 "Profile::CreateProfile", |
| 640 "profile_path", |
| 641 path_.value().c_str()); |
| 642 |
| 643 #if defined(OS_CHROMEOS) |
| 644 if (chromeos::LoginUtils::Get()->RestartToApplyPerSessionFlagsIfNeed(this, |
| 645 true)) { |
| 646 return; |
| 647 } |
| 648 #endif |
| 649 |
| 633 if (delegate_) { | 650 if (delegate_) { |
| 634 TRACE_EVENT0("browser", "ProfileImpl::DoFileInit:DelegateOnProfileCreated") | 651 TRACE_EVENT0("browser", "ProfileImpl::DoFileInit:DelegateOnProfileCreated") |
| 635 delegate_->OnProfileCreated(this, true, IsNewProfile()); | 652 delegate_->OnProfileCreated(this, true, IsNewProfile()); |
| 636 } | 653 } |
| 637 | 654 |
| 638 content::NotificationService::current()->Notify( | 655 content::NotificationService::current()->Notify( |
| 639 chrome::NOTIFICATION_PROFILE_CREATED, | 656 chrome::NOTIFICATION_PROFILE_CREATED, |
| 640 content::Source<Profile>(this), | 657 content::Source<Profile>(this), |
| 641 content::NotificationService::NoDetails()); | 658 content::NotificationService::NoDetails()); |
| 642 | 659 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 ProfileImpl::CreateDomainReliabilityMonitor() { | 1333 ProfileImpl::CreateDomainReliabilityMonitor() { |
| 1317 domain_reliability::DomainReliabilityService* service = | 1334 domain_reliability::DomainReliabilityService* service = |
| 1318 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1335 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1319 GetForBrowserContext(this); | 1336 GetForBrowserContext(this); |
| 1320 if (!service) | 1337 if (!service) |
| 1321 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1338 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1322 | 1339 |
| 1323 return service->CreateMonitor( | 1340 return service->CreateMonitor( |
| 1324 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1341 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1325 } | 1342 } |
| OLD | NEW |