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