| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 #if defined(OS_ANDROID) | 109 #if defined(OS_ANDROID) |
| 110 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 110 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
| 111 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" | 111 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" |
| 112 #endif // defined(OS_ANDROID) | 112 #endif // defined(OS_ANDROID) |
| 113 | 113 |
| 114 #if defined(ENABLE_CONFIGURATION_POLICY) | 114 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 115 #include "chrome/browser/policy/schema_registry_service.h" | 115 #include "chrome/browser/policy/schema_registry_service.h" |
| 116 #include "chrome/browser/policy/schema_registry_service_factory.h" | 116 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 117 #include "components/policy/core/browser/browser_policy_connector.h" | 117 #include "components/policy/core/browser/browser_policy_connector.h" |
| 118 #if defined(OS_CHROMEOS) | 118 #if defined(OS_CHROMEOS) |
| 119 #include "chrome/browser/chromeos/login/login_utils.h" |
| 119 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 120 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 120 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 121 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 121 #else | 122 #else |
| 122 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 123 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 123 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 124 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 124 #endif | 125 #endif |
| 125 #endif | 126 #endif |
| 126 | 127 |
| 127 #if defined(ENABLE_MANAGED_USERS) | 128 #if defined(ENABLE_MANAGED_USERS) |
| 128 #include "chrome/browser/managed_mode/managed_user_settings_service.h" | 129 #include "chrome/browser/managed_mode/managed_user_settings_service.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 lazy_service, chrome::kDomDistillerScheme)); | 272 lazy_service, chrome::kDomDistillerScheme)); |
| 272 } | 273 } |
| 273 } | 274 } |
| 274 | 275 |
| 275 } // namespace | 276 } // namespace |
| 276 | 277 |
| 277 // static | 278 // static |
| 278 Profile* Profile::CreateProfile(const base::FilePath& path, | 279 Profile* Profile::CreateProfile(const base::FilePath& path, |
| 279 Delegate* delegate, | 280 Delegate* delegate, |
| 280 CreateMode create_mode) { | 281 CreateMode create_mode) { |
| 281 TRACE_EVENT0("browser", "Profile::CreateProfile") | 282 TRACE_EVENT_BEGIN1( |
| 283 "browser", "Profile::CreateProfile", "profile_path", path.value()); |
| 284 |
| 282 // Get sequenced task runner for making sure that file operations of | 285 // Get sequenced task runner for making sure that file operations of |
| 283 // this profile (defined by |path|) are executed in expected order | 286 // this profile (defined by |path|) are executed in expected order |
| 284 // (what was previously assured by the FILE thread). | 287 // (what was previously assured by the FILE thread). |
| 285 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = | 288 scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
| 286 JsonPrefStore::GetTaskRunnerForFile(path, | 289 JsonPrefStore::GetTaskRunnerForFile(path, |
| 287 BrowserThread::GetBlockingPool()); | 290 BrowserThread::GetBlockingPool()); |
| 288 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { | 291 if (create_mode == CREATE_MODE_ASYNCHRONOUS) { |
| 289 DCHECK(delegate); | 292 DCHECK(delegate); |
| 290 CreateProfileDirectory(sequenced_task_runner.get(), path); | 293 CreateProfileDirectory(sequenced_task_runner.get(), path); |
| 291 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { | 294 } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 | 629 |
| 627 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); | 630 TRACE_EVENT0("browser", "ProfileImpl::SetSaveSessionStorageOnDisk"); |
| 628 content::BrowserContext::GetDefaultStoragePartition(this)-> | 631 content::BrowserContext::GetDefaultStoragePartition(this)-> |
| 629 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); | 632 GetDOMStorageContext()->SetSaveSessionStorageOnDisk(); |
| 630 | 633 |
| 631 // The DomDistillerViewerSource is not a normal WebUI so it must be registered | 634 // The DomDistillerViewerSource is not a normal WebUI so it must be registered |
| 632 // as a URLDataSource early. | 635 // as a URLDataSource early. |
| 633 RegisterDomDistillerViewerSource(this); | 636 RegisterDomDistillerViewerSource(this); |
| 634 | 637 |
| 635 // Creation has been finished. | 638 // Creation has been finished. |
| 639 TRACE_EVENT_END1( |
| 640 "browser", "Profile::CreateProfile", "profile_path", path_.value()); |
| 641 |
| 642 #if defined(OS_CHROMEOS) |
| 643 if (chromeos::LoginUtils::Get()->RestartToApplyPerSessionFlagsIfNeed(this)) |
| 644 return; |
| 645 #endif |
| 646 |
| 636 if (delegate_) { | 647 if (delegate_) { |
| 637 TRACE_EVENT0("browser", "ProfileImpl::DoFileInit:DelegateOnProfileCreated") | 648 TRACE_EVENT0("browser", "ProfileImpl::DoFileInit:DelegateOnProfileCreated") |
| 638 delegate_->OnProfileCreated(this, true, IsNewProfile()); | 649 delegate_->OnProfileCreated(this, true, IsNewProfile()); |
| 639 } | 650 } |
| 640 | 651 |
| 641 content::NotificationService::current()->Notify( | 652 content::NotificationService::current()->Notify( |
| 642 chrome::NOTIFICATION_PROFILE_CREATED, | 653 chrome::NOTIFICATION_PROFILE_CREATED, |
| 643 content::Source<Profile>(this), | 654 content::Source<Profile>(this), |
| 644 content::NotificationService::NoDetails()); | 655 content::NotificationService::NoDetails()); |
| 645 | 656 |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1370 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
| 1360 #if defined(OS_CHROMEOS) | 1371 #if defined(OS_CHROMEOS) |
| 1361 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1372 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 1362 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1373 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 1363 g_browser_process->local_state()); | 1374 g_browser_process->local_state()); |
| 1364 } | 1375 } |
| 1365 #endif // defined(OS_CHROMEOS) | 1376 #endif // defined(OS_CHROMEOS) |
| 1366 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1377 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 1367 GetPrefs(), g_browser_process->local_state()); | 1378 GetPrefs(), g_browser_process->local_state()); |
| 1368 } | 1379 } |
| OLD | NEW |