| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "chrome/browser/net/predictor.h" | 53 #include "chrome/browser/net/predictor.h" |
| 54 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 54 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 55 #include "chrome/browser/net/proxy_service_factory.h" | 55 #include "chrome/browser/net/proxy_service_factory.h" |
| 56 #include "chrome/browser/net/ssl_config_service_manager.h" | 56 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 57 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 57 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 58 #include "chrome/browser/plugins/plugin_prefs.h" | 58 #include "chrome/browser/plugins/plugin_prefs.h" |
| 59 #include "chrome/browser/policy/profile_policy_connector.h" | 59 #include "chrome/browser/policy/profile_policy_connector.h" |
| 60 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 60 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 61 #include "chrome/browser/prefs/browser_prefs.h" | 61 #include "chrome/browser/prefs/browser_prefs.h" |
| 62 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 62 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 63 #include "chrome/browser/prefs/pref_hash_store_impl.h" |
| 63 #include "chrome/browser/prefs/pref_service_syncable.h" | 64 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 64 #include "chrome/browser/prerender/prerender_manager_factory.h" | 65 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 65 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 66 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
| 66 #include "chrome/browser/profiles/chrome_version_service.h" | 67 #include "chrome/browser/profiles/chrome_version_service.h" |
| 67 #include "chrome/browser/profiles/gaia_info_update_service_factory.h" | 68 #include "chrome/browser/profiles/gaia_info_update_service_factory.h" |
| 68 #include "chrome/browser/profiles/profile_destroyer.h" | 69 #include "chrome/browser/profiles/profile_destroyer.h" |
| 69 #include "chrome/browser/profiles/profile_info_cache.h" | 70 #include "chrome/browser/profiles/profile_info_cache.h" |
| 70 #include "chrome/browser/profiles/profile_manager.h" | 71 #include "chrome/browser/profiles/profile_manager.h" |
| 71 #include "chrome/browser/search_engines/template_url_fetcher.h" | 72 #include "chrome/browser/search_engines/template_url_fetcher.h" |
| 72 #include "chrome/browser/sessions/session_service_factory.h" | 73 #include "chrome/browser/sessions/session_service_factory.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 #include "components/user_prefs/pref_registry_syncable.h" | 86 #include "components/user_prefs/pref_registry_syncable.h" |
| 86 #include "components/user_prefs/user_prefs.h" | 87 #include "components/user_prefs/user_prefs.h" |
| 87 #include "content/public/browser/browser_thread.h" | 88 #include "content/public/browser/browser_thread.h" |
| 88 #include "content/public/browser/dom_storage_context.h" | 89 #include "content/public/browser/dom_storage_context.h" |
| 89 #include "content/public/browser/host_zoom_map.h" | 90 #include "content/public/browser/host_zoom_map.h" |
| 90 #include "content/public/browser/notification_service.h" | 91 #include "content/public/browser/notification_service.h" |
| 91 #include "content/public/browser/render_process_host.h" | 92 #include "content/public/browser/render_process_host.h" |
| 92 #include "content/public/browser/storage_partition.h" | 93 #include "content/public/browser/storage_partition.h" |
| 93 #include "content/public/browser/user_metrics.h" | 94 #include "content/public/browser/user_metrics.h" |
| 94 #include "content/public/common/content_constants.h" | 95 #include "content/public/common/content_constants.h" |
| 96 #include "grit/browser_resources.h" |
| 95 #include "grit/chromium_strings.h" | 97 #include "grit/chromium_strings.h" |
| 96 #include "grit/generated_resources.h" | 98 #include "grit/generated_resources.h" |
| 97 #include "ui/base/l10n/l10n_util.h" | 99 #include "ui/base/l10n/l10n_util.h" |
| 98 | 100 |
| 99 #if defined(ENABLE_CONFIGURATION_POLICY) | 101 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 100 #include "chrome/browser/policy/browser_policy_connector.h" | 102 #include "chrome/browser/policy/browser_policy_connector.h" |
| 101 #include "chrome/browser/policy/schema_registry_service.h" | 103 #include "chrome/browser/policy/schema_registry_service.h" |
| 102 #include "chrome/browser/policy/schema_registry_service_factory.h" | 104 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 103 #if defined(OS_CHROMEOS) | 105 #if defined(OS_CHROMEOS) |
| 104 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 106 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 105 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 107 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 106 #else | 108 #else |
| 107 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 109 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
| 108 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 110 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 109 #endif | 111 #endif |
| 110 #endif | 112 #endif |
| 111 | 113 |
| 112 #if defined(ENABLE_MANAGED_USERS) | 114 #if defined(ENABLE_MANAGED_USERS) |
| 113 #include "chrome/browser/managed_mode/managed_user_settings_service.h" | 115 #include "chrome/browser/managed_mode/managed_user_settings_service.h" |
| 114 #include "chrome/browser/managed_mode/managed_user_settings_service_factory.h" | 116 #include "chrome/browser/managed_mode/managed_user_settings_service_factory.h" |
| 115 #endif | 117 #endif |
| 116 | 118 |
| 117 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
| 118 #include "chrome/browser/profiles/file_path_verifier_win.h" | 120 #include "chrome/browser/profiles/file_path_verifier_win.h" |
| 119 #include "chrome/installer/util/install_util.h" | 121 #include "chrome/installer/util/install_util.h" |
| 122 #if defined(ENABLE_RLZ) |
| 123 #include "rlz/lib/machine_id.h" |
| 124 #endif |
| 120 #endif | 125 #endif |
| 121 | 126 |
| 122 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
| 123 #include "chrome/browser/chromeos/locale_change_guard.h" | 128 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 124 #include "chrome/browser/chromeos/login/user_manager.h" | 129 #include "chrome/browser/chromeos/login/user_manager.h" |
| 125 #include "chrome/browser/chromeos/preferences.h" | 130 #include "chrome/browser/chromeos/preferences.h" |
| 126 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 131 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 127 #endif | 132 #endif |
| 128 | 133 |
| 129 using base::Time; | 134 using base::Time; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 #if defined(OS_WIN) | 254 #if defined(OS_WIN) |
| 250 // Only do prefs file verification on Windows. | 255 // Only do prefs file verification on Windows. |
| 251 const int kVerifyPrefsFileDelaySeconds = 60; | 256 const int kVerifyPrefsFileDelaySeconds = 60; |
| 252 BrowserThread::GetBlockingPool()->PostDelayedTask( | 257 BrowserThread::GetBlockingPool()->PostDelayedTask( |
| 253 FROM_HERE, | 258 FROM_HERE, |
| 254 base::Bind(&VerifyPreferencesFile, prefs_file), | 259 base::Bind(&VerifyPreferencesFile, prefs_file), |
| 255 base::TimeDelta::FromSeconds(kVerifyPrefsFileDelaySeconds)); | 260 base::TimeDelta::FromSeconds(kVerifyPrefsFileDelaySeconds)); |
| 256 #endif | 261 #endif |
| 257 } | 262 } |
| 258 | 263 |
| 264 scoped_ptr<PrefHashStore> GetPrefHashStore(Profile* profile) { |
| 265 std::string seed = ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 266 IDR_PREF_HASH_SEED_BIN).as_string(); |
| 267 std::string device_id; |
| 268 |
| 269 #if defined(OS_WIN) && defined(ENABLE_RLZ) |
| 270 // This is used by |
| 271 // chrome/browser/extensions/api/music_manager_private/device_id_win.cc |
| 272 // but that API is private (http://crbug.com/276485) and other platforms are |
| 273 // not available synchronously. |
| 274 // As part of improving pref metrics on other platforms we may want to find |
| 275 // ways to defer preference loading until the device ID can be used. |
| 276 rlz_lib::GetMachineId(&device_id); |
| 277 #endif |
| 278 |
| 279 return scoped_ptr<PrefHashStore>(new PrefHashStoreImpl( |
| 280 profile->GetPath().AsUTF8Unsafe(), |
| 281 seed, |
| 282 device_id, |
| 283 g_browser_process->local_state())); |
| 284 } |
| 285 |
| 259 } // namespace | 286 } // namespace |
| 260 | 287 |
| 261 // static | 288 // static |
| 262 Profile* Profile::CreateProfile(const base::FilePath& path, | 289 Profile* Profile::CreateProfile(const base::FilePath& path, |
| 263 Delegate* delegate, | 290 Delegate* delegate, |
| 264 CreateMode create_mode) { | 291 CreateMode create_mode) { |
| 265 TRACE_EVENT0("browser", "Profile::CreateProfile") | 292 TRACE_EVENT0("browser", "Profile::CreateProfile") |
| 266 // Get sequenced task runner for making sure that file operations of | 293 // Get sequenced task runner for making sure that file operations of |
| 267 // this profile (defined by |path|) are executed in expected order | 294 // this profile (defined by |path|) are executed in expected order |
| 268 // (what was previously assured by the FILE thread). | 295 // (what was previously assured by the FILE thread). |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 { | 472 { |
| 446 // On startup, preference loading is always synchronous so a scoped timer | 473 // On startup, preference loading is always synchronous so a scoped timer |
| 447 // will work here. | 474 // will work here. |
| 448 startup_metric_utils::ScopedSlowStartupUMA | 475 startup_metric_utils::ScopedSlowStartupUMA |
| 449 scoped_timer("Startup.SlowStartupPreferenceLoading"); | 476 scoped_timer("Startup.SlowStartupPreferenceLoading"); |
| 450 prefs_.reset(chrome_prefs::CreateProfilePrefs( | 477 prefs_.reset(chrome_prefs::CreateProfilePrefs( |
| 451 GetPrefFilePath(), | 478 GetPrefFilePath(), |
| 452 sequenced_task_runner, | 479 sequenced_task_runner, |
| 453 profile_policy_connector_->policy_service(), | 480 profile_policy_connector_->policy_service(), |
| 454 managed_user_settings, | 481 managed_user_settings, |
| 482 GetPrefHashStore(this), |
| 455 new ExtensionPrefStore( | 483 new ExtensionPrefStore( |
| 456 ExtensionPrefValueMapFactory::GetForBrowserContext(this), false), | 484 ExtensionPrefValueMapFactory::GetForBrowserContext(this), false), |
| 457 pref_registry_, | 485 pref_registry_, |
| 458 async_prefs)); | 486 async_prefs)); |
| 459 // Register on BrowserContext. | 487 // Register on BrowserContext. |
| 460 user_prefs::UserPrefs::Set(this, prefs_.get()); | 488 user_prefs::UserPrefs::Set(this, prefs_.get()); |
| 461 } | 489 } |
| 462 | 490 |
| 463 startup_metric_utils::ScopedSlowStartupUMA | 491 startup_metric_utils::ScopedSlowStartupUMA |
| 464 scoped_timer("Startup.SlowStartupFinalProfileInit"); | 492 scoped_timer("Startup.SlowStartupFinalProfileInit"); |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1269 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
| 1242 #if defined(OS_CHROMEOS) | 1270 #if defined(OS_CHROMEOS) |
| 1243 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1271 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 1244 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1272 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 1245 g_browser_process->local_state()); | 1273 g_browser_process->local_state()); |
| 1246 } | 1274 } |
| 1247 #endif // defined(OS_CHROMEOS) | 1275 #endif // defined(OS_CHROMEOS) |
| 1248 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1276 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 1249 GetPrefs(), g_browser_process->local_state()); | 1277 GetPrefs(), g_browser_process->local_state()); |
| 1250 } | 1278 } |
| OLD | NEW |