| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "chrome/browser/history/top_sites.h" | 43 #include "chrome/browser/history/top_sites.h" |
| 44 #include "chrome/browser/instant/instant_controller.h" | 44 #include "chrome/browser/instant/instant_controller.h" |
| 45 #include "chrome/browser/metrics/metrics_service.h" | 45 #include "chrome/browser/metrics/metrics_service.h" |
| 46 #include "chrome/browser/net/chrome_url_request_context.h" | 46 #include "chrome/browser/net/chrome_url_request_context.h" |
| 47 #include "chrome/browser/net/gaia/token_service.h" | 47 #include "chrome/browser/net/gaia/token_service.h" |
| 48 #include "chrome/browser/net/net_pref_observer.h" | 48 #include "chrome/browser/net/net_pref_observer.h" |
| 49 #include "chrome/browser/net/pref_proxy_config_service.h" | 49 #include "chrome/browser/net/pref_proxy_config_service.h" |
| 50 #include "chrome/browser/net/ssl_config_service_manager.h" | 50 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 51 #include "chrome/browser/password_manager/password_store_default.h" | 51 #include "chrome/browser/password_manager/password_store_default.h" |
| 52 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 52 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 53 #include "chrome/browser/policy/configuration_policy_provider.h" | |
| 54 #include "chrome/browser/policy/profile_policy_connector.h" | |
| 55 #include "chrome/browser/policy/profile_policy_connector_factory.h" | |
| 56 #include "chrome/browser/prefs/browser_prefs.h" | 53 #include "chrome/browser/prefs/browser_prefs.h" |
| 57 #include "chrome/browser/prefs/pref_value_store.h" | 54 #include "chrome/browser/prefs/pref_value_store.h" |
| 58 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 55 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 59 #include "chrome/browser/prerender/prerender_manager.h" | 56 #include "chrome/browser/prerender/prerender_manager.h" |
| 60 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 57 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 61 #include "chrome/browser/profiles/profile_dependency_manager.h" | 58 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 62 #include "chrome/browser/profiles/profile_manager.h" | 59 #include "chrome/browser/profiles/profile_manager.h" |
| 63 #include "chrome/browser/search_engines/template_url_fetcher.h" | 60 #include "chrome/browser/search_engines/template_url_fetcher.h" |
| 64 #include "chrome/browser/search_engines/template_url_service.h" | 61 #include "chrome/browser/search_engines/template_url_service.h" |
| 65 #include "chrome/browser/sessions/session_service_factory.h" | 62 #include "chrome/browser/sessions/session_service_factory.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 #endif | 298 #endif |
| 302 | 299 |
| 303 create_session_service_timer_.Start( | 300 create_session_service_timer_.Start( |
| 304 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 301 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
| 305 &ProfileImpl::EnsureSessionServiceCreated); | 302 &ProfileImpl::EnsureSessionServiceCreated); |
| 306 | 303 |
| 307 if (delegate_) { | 304 if (delegate_) { |
| 308 prefs_.reset(PrefService::CreatePrefService( | 305 prefs_.reset(PrefService::CreatePrefService( |
| 309 GetPrefFilePath(), | 306 GetPrefFilePath(), |
| 310 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), | 307 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), |
| 311 GetOriginalProfile(), | |
| 312 true)); | 308 true)); |
| 313 // Wait for the notifcation that prefs has been loaded (successfully or | 309 // Wait for the notifcation that prefs has been loaded (successfully or |
| 314 // not). | 310 // not). |
| 315 registrar_.Add(this, NotificationType::PREF_INITIALIZATION_COMPLETED, | 311 registrar_.Add(this, NotificationType::PREF_INITIALIZATION_COMPLETED, |
| 316 Source<PrefService>(prefs_.get())); | 312 Source<PrefService>(prefs_.get())); |
| 317 } else { | 313 } else { |
| 318 // Load prefs synchronously. | 314 // Load prefs synchronously. |
| 319 prefs_.reset(PrefService::CreatePrefService( | 315 prefs_.reset(PrefService::CreatePrefService( |
| 320 GetPrefFilePath(), | 316 GetPrefFilePath(), |
| 321 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), | 317 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), |
| 322 GetOriginalProfile(), | |
| 323 false)); | 318 false)); |
| 324 OnPrefsLoaded(true); | 319 OnPrefsLoaded(true); |
| 325 } | 320 } |
| 326 } | 321 } |
| 327 | 322 |
| 328 void ProfileImpl::DoFinalInit() { | 323 void ProfileImpl::DoFinalInit() { |
| 329 PrefService* prefs = GetPrefs(); | 324 PrefService* prefs = GetPrefs(); |
| 330 pref_change_registrar_.Init(prefs); | 325 pref_change_registrar_.Init(prefs); |
| 331 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); | 326 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
| 332 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); | 327 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); | 413 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); |
| 419 | 414 |
| 420 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); | 415 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); |
| 421 | 416 |
| 422 // Make sure we initialize the ProfileIOData after everything else has been | 417 // Make sure we initialize the ProfileIOData after everything else has been |
| 423 // initialized that we might be reading from the IO thread. | 418 // initialized that we might be reading from the IO thread. |
| 424 io_data_.Init(cookie_path, cache_path, cache_max_size, | 419 io_data_.Init(cookie_path, cache_path, cache_max_size, |
| 425 media_cache_path, media_cache_max_size, extensions_cookie_path, | 420 media_cache_path, media_cache_max_size, extensions_cookie_path, |
| 426 app_path); | 421 app_path); |
| 427 | 422 |
| 428 policy::ProfilePolicyConnector* policy_connector = | |
| 429 policy::ProfilePolicyConnectorFactory::GetForProfile(this); | |
| 430 policy_connector->Initialize(); | |
| 431 | |
| 432 // Creation has been finished. | 423 // Creation has been finished. |
| 433 if (delegate_) | 424 if (delegate_) |
| 434 delegate_->OnProfileCreated(this, true); | 425 delegate_->OnProfileCreated(this, true); |
| 435 } | 426 } |
| 436 | 427 |
| 437 void ProfileImpl::InitExtensions(bool extensions_enabled) { | 428 void ProfileImpl::InitExtensions(bool extensions_enabled) { |
| 438 if (user_script_master_ || extension_service_.get()) | 429 if (user_script_master_ || extension_service_.get()) |
| 439 return; // Already initialized. | 430 return; // Already initialized. |
| 440 | 431 |
| 441 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 432 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1637 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
| 1647 return NULL; | 1638 return NULL; |
| 1648 if (!prerender_manager_.get()) { | 1639 if (!prerender_manager_.get()) { |
| 1649 CHECK(g_browser_process->prerender_tracker()); | 1640 CHECK(g_browser_process->prerender_tracker()); |
| 1650 prerender_manager_.reset( | 1641 prerender_manager_.reset( |
| 1651 new prerender::PrerenderManager( | 1642 new prerender::PrerenderManager( |
| 1652 this, g_browser_process->prerender_tracker())); | 1643 this, g_browser_process->prerender_tracker())); |
| 1653 } | 1644 } |
| 1654 return prerender_manager_.get(); | 1645 return prerender_manager_.get(); |
| 1655 } | 1646 } |
| OLD | NEW |