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