| 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/profiles/profile_metrics.h" | 72 #include "chrome/browser/profiles/profile_metrics.h" |
| 72 #include "chrome/browser/search_engines/template_url_fetcher.h" | 73 #include "chrome/browser/search_engines/template_url_fetcher.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 86 #include "components/user_prefs/pref_registry_syncable.h" | 87 #include "components/user_prefs/pref_registry_syncable.h" |
| 87 #include "components/user_prefs/user_prefs.h" | 88 #include "components/user_prefs/user_prefs.h" |
| 88 #include "content/public/browser/browser_thread.h" | 89 #include "content/public/browser/browser_thread.h" |
| 89 #include "content/public/browser/dom_storage_context.h" | 90 #include "content/public/browser/dom_storage_context.h" |
| 90 #include "content/public/browser/host_zoom_map.h" | 91 #include "content/public/browser/host_zoom_map.h" |
| 91 #include "content/public/browser/notification_service.h" | 92 #include "content/public/browser/notification_service.h" |
| 92 #include "content/public/browser/render_process_host.h" | 93 #include "content/public/browser/render_process_host.h" |
| 93 #include "content/public/browser/storage_partition.h" | 94 #include "content/public/browser/storage_partition.h" |
| 94 #include "content/public/browser/user_metrics.h" | 95 #include "content/public/browser/user_metrics.h" |
| 95 #include "content/public/common/content_constants.h" | 96 #include "content/public/common/content_constants.h" |
| 97 #include "grit/browser_resources.h" |
| 96 #include "grit/chromium_strings.h" | 98 #include "grit/chromium_strings.h" |
| 97 #include "grit/generated_resources.h" | 99 #include "grit/generated_resources.h" |
| 98 #include "ui/base/l10n/l10n_util.h" | 100 #include "ui/base/l10n/l10n_util.h" |
| 99 | 101 |
| 100 #if defined(ENABLE_CONFIGURATION_POLICY) | 102 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 101 #include "chrome/browser/policy/browser_policy_connector.h" | 103 #include "chrome/browser/policy/browser_policy_connector.h" |
| 102 #include "chrome/browser/policy/schema_registry_service.h" | 104 #include "chrome/browser/policy/schema_registry_service.h" |
| 103 #include "chrome/browser/policy/schema_registry_service_factory.h" | 105 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 104 #if defined(OS_CHROMEOS) | 106 #if defined(OS_CHROMEOS) |
| 105 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 107 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 106 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 108 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 107 #else | 109 #else |
| 108 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 110 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
| 109 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 111 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 110 #endif | 112 #endif |
| 111 #endif | 113 #endif |
| 112 | 114 |
| 113 #if defined(ENABLE_MANAGED_USERS) | 115 #if defined(ENABLE_MANAGED_USERS) |
| 114 #include "chrome/browser/managed_mode/managed_user_settings_service.h" | 116 #include "chrome/browser/managed_mode/managed_user_settings_service.h" |
| 115 #include "chrome/browser/managed_mode/managed_user_settings_service_factory.h" | 117 #include "chrome/browser/managed_mode/managed_user_settings_service_factory.h" |
| 116 #endif | 118 #endif |
| 117 | 119 |
| 118 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
| 119 #include "chrome/browser/profiles/file_path_verifier_win.h" | 121 #include "chrome/browser/profiles/file_path_verifier_win.h" |
| 120 #include "chrome/installer/util/install_util.h" | 122 #include "chrome/installer/util/install_util.h" |
| 123 #if defined(ENABLE_RLZ) |
| 124 #include "rlz/lib/machine_id.h" |
| 125 #endif |
| 121 #endif | 126 #endif |
| 122 | 127 |
| 123 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
| 124 #include "chrome/browser/chromeos/locale_change_guard.h" | 129 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 125 #include "chrome/browser/chromeos/login/user_manager.h" | 130 #include "chrome/browser/chromeos/login/user_manager.h" |
| 126 #include "chrome/browser/chromeos/preferences.h" | 131 #include "chrome/browser/chromeos/preferences.h" |
| 127 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 132 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 128 #endif | 133 #endif |
| 129 | 134 |
| 130 using base::Time; | 135 using base::Time; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 #if defined(OS_WIN) | 255 #if defined(OS_WIN) |
| 251 // Only do prefs file verification on Windows. | 256 // Only do prefs file verification on Windows. |
| 252 const int kVerifyPrefsFileDelaySeconds = 60; | 257 const int kVerifyPrefsFileDelaySeconds = 60; |
| 253 BrowserThread::GetBlockingPool()->PostDelayedTask( | 258 BrowserThread::GetBlockingPool()->PostDelayedTask( |
| 254 FROM_HERE, | 259 FROM_HERE, |
| 255 base::Bind(&VerifyPreferencesFile, prefs_file), | 260 base::Bind(&VerifyPreferencesFile, prefs_file), |
| 256 base::TimeDelta::FromSeconds(kVerifyPrefsFileDelaySeconds)); | 261 base::TimeDelta::FromSeconds(kVerifyPrefsFileDelaySeconds)); |
| 257 #endif | 262 #endif |
| 258 } | 263 } |
| 259 | 264 |
| 265 scoped_ptr<PrefHashStore> GetPrefHashStore(Profile* profile) { |
| 266 std::string seed = ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 267 IDR_PREF_HASH_SEED_BIN).as_string(); |
| 268 std::string device_id; |
| 269 |
| 270 #if defined(OS_WIN) && defined(ENABLE_RLZ) |
| 271 // This is used by |
| 272 // chrome/browser/extensions/api/music_manager_private/device_id_win.cc |
| 273 // but that API is private (http://crbug.com/276485) and other platforms are |
| 274 // not available synchronously. |
| 275 // As part of improving pref metrics on other platforms we may want to find |
| 276 // ways to defer preference loading until the device ID can be used. |
| 277 rlz_lib::GetMachineId(&device_id); |
| 278 #endif |
| 279 |
| 280 return scoped_ptr<PrefHashStore>(new PrefHashStoreImpl( |
| 281 profile->GetPath().AsUTF8Unsafe(), |
| 282 seed, |
| 283 device_id, |
| 284 g_browser_process->local_state())); |
| 285 } |
| 286 |
| 260 } // namespace | 287 } // namespace |
| 261 | 288 |
| 262 // static | 289 // static |
| 263 Profile* Profile::CreateProfile(const base::FilePath& path, | 290 Profile* Profile::CreateProfile(const base::FilePath& path, |
| 264 Delegate* delegate, | 291 Delegate* delegate, |
| 265 CreateMode create_mode) { | 292 CreateMode create_mode) { |
| 266 TRACE_EVENT0("browser", "Profile::CreateProfile") | 293 TRACE_EVENT0("browser", "Profile::CreateProfile") |
| 267 // Get sequenced task runner for making sure that file operations of | 294 // Get sequenced task runner for making sure that file operations of |
| 268 // this profile (defined by |path|) are executed in expected order | 295 // this profile (defined by |path|) are executed in expected order |
| 269 // (what was previously assured by the FILE thread). | 296 // (what was previously assured by the FILE thread). |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 { | 480 { |
| 454 // On startup, preference loading is always synchronous so a scoped timer | 481 // On startup, preference loading is always synchronous so a scoped timer |
| 455 // will work here. | 482 // will work here. |
| 456 startup_metric_utils::ScopedSlowStartupUMA | 483 startup_metric_utils::ScopedSlowStartupUMA |
| 457 scoped_timer("Startup.SlowStartupPreferenceLoading"); | 484 scoped_timer("Startup.SlowStartupPreferenceLoading"); |
| 458 prefs_ = chrome_prefs::CreateProfilePrefs( | 485 prefs_ = chrome_prefs::CreateProfilePrefs( |
| 459 GetPrefFilePath(), | 486 GetPrefFilePath(), |
| 460 sequenced_task_runner, | 487 sequenced_task_runner, |
| 461 profile_policy_connector_->policy_service(), | 488 profile_policy_connector_->policy_service(), |
| 462 managed_user_settings, | 489 managed_user_settings, |
| 490 GetPrefHashStore(this), |
| 463 new ExtensionPrefStore( | 491 new ExtensionPrefStore( |
| 464 ExtensionPrefValueMapFactory::GetForBrowserContext(this), false), | 492 ExtensionPrefValueMapFactory::GetForBrowserContext(this), false), |
| 465 pref_registry_, | 493 pref_registry_, |
| 466 async_prefs).Pass(); | 494 async_prefs).Pass(); |
| 467 // Register on BrowserContext. | 495 // Register on BrowserContext. |
| 468 user_prefs::UserPrefs::Set(this, prefs_.get()); | 496 user_prefs::UserPrefs::Set(this, prefs_.get()); |
| 469 } | 497 } |
| 470 | 498 |
| 471 startup_metric_utils::ScopedSlowStartupUMA | 499 startup_metric_utils::ScopedSlowStartupUMA |
| 472 scoped_timer("Startup.SlowStartupFinalProfileInit"); | 500 scoped_timer("Startup.SlowStartupFinalProfileInit"); |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1278 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
| 1251 #if defined(OS_CHROMEOS) | 1279 #if defined(OS_CHROMEOS) |
| 1252 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1280 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
| 1253 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1281 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 1254 g_browser_process->local_state()); | 1282 g_browser_process->local_state()); |
| 1255 } | 1283 } |
| 1256 #endif // defined(OS_CHROMEOS) | 1284 #endif // defined(OS_CHROMEOS) |
| 1257 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1285 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 1258 GetPrefs(), g_browser_process->local_state()); | 1286 GetPrefs(), g_browser_process->local_state()); |
| 1259 } | 1287 } |
| OLD | NEW |