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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #include "content/public/browser/host_zoom_map.h" | 90 #include "content/public/browser/host_zoom_map.h" |
91 #include "content/public/browser/notification_service.h" | 91 #include "content/public/browser/notification_service.h" |
92 #include "content/public/browser/render_process_host.h" | 92 #include "content/public/browser/render_process_host.h" |
93 #include "content/public/browser/storage_partition.h" | 93 #include "content/public/browser/storage_partition.h" |
94 #include "content/public/browser/user_metrics.h" | 94 #include "content/public/browser/user_metrics.h" |
95 #include "content/public/common/content_constants.h" | 95 #include "content/public/common/content_constants.h" |
96 #include "grit/chromium_strings.h" | 96 #include "grit/chromium_strings.h" |
97 #include "grit/generated_resources.h" | 97 #include "grit/generated_resources.h" |
98 #include "ui/base/l10n/l10n_util.h" | 98 #include "ui/base/l10n/l10n_util.h" |
99 | 99 |
| 100 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 101 #if defined(OS_CHROMEOS) |
| 102 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 103 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 104 #else |
| 105 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
| 106 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 107 #endif |
| 108 #endif |
| 109 |
| 110 #if defined(ENABLE_MANAGED_USERS) |
| 111 #include "chrome/browser/managed_mode/managed_user_settings_sync_service.h" |
| 112 #include "chrome/browser/managed_mode/managed_user_settings_sync_service_factory
.h" |
| 113 #endif |
| 114 |
100 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
101 #include "chrome/installer/util/install_util.h" | 116 #include "chrome/installer/util/install_util.h" |
102 #endif | 117 #endif |
103 | 118 |
104 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
105 #include "chrome/browser/chromeos/enterprise_extension_observer.h" | 120 #include "chrome/browser/chromeos/enterprise_extension_observer.h" |
106 #include "chrome/browser/chromeos/locale_change_guard.h" | 121 #include "chrome/browser/chromeos/locale_change_guard.h" |
107 #include "chrome/browser/chromeos/login/user_manager.h" | 122 #include "chrome/browser/chromeos/login/user_manager.h" |
108 #include "chrome/browser/chromeos/preferences.h" | 123 #include "chrome/browser/chromeos/preferences.h" |
109 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 124 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
110 #endif | 125 #endif |
111 | 126 |
112 #if defined(ENABLE_CONFIGURATION_POLICY) | |
113 #if defined(OS_CHROMEOS) | |
114 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | |
115 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | |
116 #else | |
117 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | |
118 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | |
119 #endif | |
120 #endif | |
121 | |
122 using base::Time; | 127 using base::Time; |
123 using base::TimeDelta; | 128 using base::TimeDelta; |
124 using content::BrowserThread; | 129 using content::BrowserThread; |
125 using content::DownloadManagerDelegate; | 130 using content::DownloadManagerDelegate; |
126 using content::HostZoomMap; | 131 using content::HostZoomMap; |
127 using content::UserMetricsAction; | 132 using content::UserMetricsAction; |
128 | 133 |
129 namespace { | 134 namespace { |
130 | 135 |
131 // Constrict us to a very specific platform and architecture to make sure | 136 // Constrict us to a very specific platform and architecture to make sure |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 405 |
401 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || | 406 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || |
402 create_mode == CREATE_MODE_SYNCHRONOUS); | 407 create_mode == CREATE_MODE_SYNCHRONOUS); |
403 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; | 408 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; |
404 | 409 |
405 #if defined(OS_CHROMEOS) | 410 #if defined(OS_CHROMEOS) |
406 if (chromeos::ProfileHelper::IsSigninProfile(this)) | 411 if (chromeos::ProfileHelper::IsSigninProfile(this)) |
407 chrome::RegisterLoginProfilePrefs(pref_registry_.get()); | 412 chrome::RegisterLoginProfilePrefs(pref_registry_.get()); |
408 else | 413 else |
409 #endif | 414 #endif |
410 chrome::RegisterUserProfilePrefs(pref_registry_.get()); | 415 chrome::RegisterUserProfilePrefs(pref_registry_.get()); |
| 416 |
| 417 ManagedUserSettingsService* managed_user_settings = NULL; |
| 418 #if defined(ENABLE_MANAGED_USERS) |
| 419 managed_user_settings = |
| 420 ManagedUserSettingsServiceFactory::GetForProfile(this); |
| 421 managed_user_settings->Init( |
| 422 path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS); |
| 423 #endif |
411 | 424 |
412 { | 425 { |
413 // On startup, preference loading is always synchronous so a scoped timer | 426 // On startup, preference loading is always synchronous so a scoped timer |
414 // will work here. | 427 // will work here. |
415 startup_metric_utils::ScopedSlowStartupUMA | 428 startup_metric_utils::ScopedSlowStartupUMA |
416 scoped_timer("Startup.SlowStartupPreferenceLoading"); | 429 scoped_timer("Startup.SlowStartupPreferenceLoading"); |
417 prefs_.reset(chrome_prefs::CreateProfilePrefs( | 430 prefs_.reset(chrome_prefs::CreateProfilePrefs( |
418 GetPrefFilePath(), | 431 GetPrefFilePath(), |
419 sequenced_task_runner, | 432 sequenced_task_runner, |
420 profile_policy_connector_->policy_service(), | 433 profile_policy_connector_->policy_service(), |
| 434 managed_user_settings, |
421 new ExtensionPrefStore( | 435 new ExtensionPrefStore( |
422 ExtensionPrefValueMapFactory::GetForProfile(this), false), | 436 ExtensionPrefValueMapFactory::GetForProfile(this), false), |
423 pref_registry_, | 437 pref_registry_, |
424 async_prefs)); | 438 async_prefs)); |
425 // Register on BrowserContext. | 439 // Register on BrowserContext. |
426 user_prefs::UserPrefs::Set(this, prefs_.get()); | 440 user_prefs::UserPrefs::Set(this, prefs_.get()); |
427 } | 441 } |
428 | 442 |
429 startup_metric_utils::ScopedSlowStartupUMA | 443 startup_metric_utils::ScopedSlowStartupUMA |
430 scoped_timer("Startup.SlowStartupFinalProfileInit"); | 444 scoped_timer("Startup.SlowStartupFinalProfileInit"); |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1187 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
1174 #if defined(OS_CHROMEOS) | 1188 #if defined(OS_CHROMEOS) |
1175 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1189 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
1176 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1190 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
1177 g_browser_process->local_state()); | 1191 g_browser_process->local_state()); |
1178 } | 1192 } |
1179 #endif // defined(OS_CHROMEOS) | 1193 #endif // defined(OS_CHROMEOS) |
1180 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1194 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
1181 GetPrefs(), g_browser_process->local_state()); | 1195 GetPrefs(), g_browser_process->local_state()); |
1182 } | 1196 } |
OLD | NEW |