| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 #include "chrome/browser/chromeos/login/users/user_manager.h" | 117 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 118 #include "chrome/browser/chromeos/preferences.h" | 118 #include "chrome/browser/chromeos/preferences.h" |
| 119 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 119 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 120 #endif | 120 #endif |
| 121 | 121 |
| 122 #if defined(ENABLE_CONFIGURATION_POLICY) | 122 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 123 #include "chrome/browser/policy/schema_registry_service.h" | 123 #include "chrome/browser/policy/schema_registry_service.h" |
| 124 #include "chrome/browser/policy/schema_registry_service_factory.h" | 124 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 125 #include "components/policy/core/browser/browser_policy_connector.h" | 125 #include "components/policy/core/browser/browser_policy_connector.h" |
| 126 #if defined(OS_CHROMEOS) | 126 #if defined(OS_CHROMEOS) |
| 127 #include "chrome/browser/chromeos/login/login_utils.h" |
| 127 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 128 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 128 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 129 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 129 #else | 130 #else |
| 130 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 131 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 131 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 132 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 132 #endif | 133 #endif |
| 133 #endif | 134 #endif |
| 134 | 135 |
| 135 #if defined(ENABLE_EXTENSIONS) | 136 #if defined(ENABLE_EXTENSIONS) |
| 136 #include "chrome/browser/guest_view/guest_view_manager.h" | 137 #include "chrome/browser/guest_view/guest_view_manager.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 lazy_service, chrome::kDomDistillerScheme)); | 277 lazy_service, chrome::kDomDistillerScheme)); |
| 277 } | 278 } |
| 278 } | 279 } |
| 279 | 280 |
| 280 } // namespace | 281 } // namespace |
| 281 | 282 |
| 282 // static | 283 // static |
| 283 Profile* Profile::CreateProfile(const base::FilePath& path, | 284 Profile* Profile::CreateProfile(const base::FilePath& path, |
| 284 Delegate* delegate, | 285 Delegate* delegate, |
| 285 CreateMode create_mode) { | 286 CreateMode create_mode) { |
| 286 TRACE_EVENT0("browser", "Profile::CreateProfile") | 287 TRACE_EVENT_BEGIN1( |
| 288 "browser", "Profile::CreateProfile", "profile_path", path.value()); |
| 289 |
| 287 // Get sequenced task runner for making sure that file operations of | 290 // Get sequenced task runner for making sure that file operations of |
| 288 // this profile (defined by |path|) are executed in expected order | 291 // this profile (defined by |path|) are executed in expected order |
| 289 // (what was previously assured by the FILE thread). | 292 // (what was previously assured by the FILE thread). |
| 290 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = | 293 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
| 291 JsonPrefStore::GetTaskRunnerForFile(path, | 294 JsonPrefStore::GetTaskRunnerForFile(path, |
| 292 BrowserThread::GetBlockingPool()); | 295 BrowserThread::GetBlockingPool()); |
| 293 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { | 296 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { |
| 294 DCHECK(delegate); | 297 DCHECK(delegate); |
| 295 CreateProfileDirectory(sequenced_task_runner.get(), path); | 298 CreateProfileDirectory(sequenced_task_runner.get(), path); |
| 296 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { | 299 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 640 |
| 638 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); | 641 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); |
| 639 content::BrowserContext::GetDefaultStoragePartition(this)-> | 642 content::BrowserContext::GetDefaultStoragePartition(this)-> |
| 640 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); | 643 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); |
| 641 | 644 |
| 642 // The DomDistillerViewerSource is not a normal WebUI so it must be registered | 645 // The DomDistillerViewerSource is not a normal WebUI so it must be registered |
| 643 // as a URLDataSource early. | 646 // as a URLDataSource early. |
| 644 RegisterDomDistillerViewerSource(this); | 647 RegisterDomDistillerViewerSource(this); |
| 645 | 648 |
| 646 // Creation has been finished. | 649 // Creation has been finished. |
| 650 TRACE_EVENT_END1( |
| 651 "browser", "Profile::CreateProfile", "profile_path", path_.value()); |
| 652 |
| 653 #if defined(OS_CHROMEOS) |
| 654 if (chromeos::LoginUtils::Get()->RestartToApplyPerSessionFlagsIfNeed(this, |
| 655 true)) { |
| 656 return; |
| 657 } |
| 658 #endif |
| 659 |
| 647 if (delegate_) { | 660 if (delegate_) { |
| 648 TRACE_EVENT0("browser", "ProfileImpl::DoFileInit:DelegateOnProfileCreated") | 661 TRACE_EVENT0("browser", "ProfileImpl::DoFileInit:DelegateOnProfileCreated") |
| 649 delegate_->OnProfileCreated(this, true, IsNewProfile()); | 662 delegate_->OnProfileCreated(this, true, IsNewProfile()); |
| 650 } | 663 } |
| 651 | 664 |
| 652 content::NotificationService::current()->Notify( | 665 content::NotificationService::current()->Notify( |
| 653 chrome::NOTIFICATION_PROFILE_CREATED, | 666 chrome::NOTIFICATION_PROFILE_CREATED, |
| 654 content::Source<Profile>(this), | 667 content::Source<Profile>(this), |
| 655 content::NotificationService::NoDetails()); | 668 content::NotificationService::NoDetails()); |
| 656 | 669 |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1335 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
| 1323 #if defined(OS_CHROMEOS) | 1336 #if defined(OS_CHROMEOS) |
| 1324 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1337 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 1325 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1338 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 1326 g_browser_process->local_state()); | 1339 g_browser_process->local_state()); |
| 1327 } | 1340 } |
| 1328 #endif // defined(OS_CHROMEOS) | 1341 #endif // defined(OS_CHROMEOS) |
| 1329 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1342 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 1330 GetPrefs(), g_browser_process->local_state()); | 1343 GetPrefs(), g_browser_process->local_state()); |
| 1331 } | 1344 } |
| OLD | NEW |