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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/browser/history/top_sites.h" | 42 #include "chrome/browser/history/top_sites.h" |
43 #include "chrome/browser/instant/instant_controller.h" | 43 #include "chrome/browser/instant/instant_controller.h" |
44 #include "chrome/browser/metrics/metrics_service.h" | 44 #include "chrome/browser/metrics/metrics_service.h" |
45 #include "chrome/browser/net/chrome_url_request_context.h" | 45 #include "chrome/browser/net/chrome_url_request_context.h" |
46 #include "chrome/browser/net/gaia/token_service.h" | 46 #include "chrome/browser/net/gaia/token_service.h" |
47 #include "chrome/browser/net/net_pref_observer.h" | 47 #include "chrome/browser/net/net_pref_observer.h" |
48 #include "chrome/browser/net/pref_proxy_config_service.h" | 48 #include "chrome/browser/net/pref_proxy_config_service.h" |
49 #include "chrome/browser/net/ssl_config_service_manager.h" | 49 #include "chrome/browser/net/ssl_config_service_manager.h" |
50 #include "chrome/browser/password_manager/password_store_default.h" | 50 #include "chrome/browser/password_manager/password_store_default.h" |
51 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 51 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
52 #include "chrome/browser/policy/configuration_policy_provider.h" | |
53 #include "chrome/browser/policy/profile_policy_connector.h" | |
54 #include "chrome/browser/policy/profile_policy_connector_factory.h" | |
55 #include "chrome/browser/prefs/browser_prefs.h" | 52 #include "chrome/browser/prefs/browser_prefs.h" |
56 #include "chrome/browser/prefs/pref_value_store.h" | 53 #include "chrome/browser/prefs/pref_value_store.h" |
57 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 54 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
58 #include "chrome/browser/prerender/prerender_manager.h" | 55 #include "chrome/browser/prerender/prerender_manager.h" |
59 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 56 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
60 #include "chrome/browser/profiles/profile_dependency_manager.h" | 57 #include "chrome/browser/profiles/profile_dependency_manager.h" |
61 #include "chrome/browser/profiles/profile_manager.h" | 58 #include "chrome/browser/profiles/profile_manager.h" |
62 #include "chrome/browser/search_engines/template_url_fetcher.h" | 59 #include "chrome/browser/search_engines/template_url_fetcher.h" |
63 #include "chrome/browser/search_engines/template_url_service.h" | 60 #include "chrome/browser/search_engines/template_url_service.h" |
64 #include "chrome/browser/sessions/session_service_factory.h" | 61 #include "chrome/browser/sessions/session_service_factory.h" |
(...skipping 236 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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1636 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
1646 return NULL; | 1637 return NULL; |
1647 if (!prerender_manager_.get()) { | 1638 if (!prerender_manager_.get()) { |
1648 CHECK(g_browser_process->prerender_tracker()); | 1639 CHECK(g_browser_process->prerender_tracker()); |
1649 prerender_manager_.reset( | 1640 prerender_manager_.reset( |
1650 new prerender::PrerenderManager( | 1641 new prerender::PrerenderManager( |
1651 this, g_browser_process->prerender_tracker())); | 1642 this, g_browser_process->prerender_tracker())); |
1652 } | 1643 } |
1653 return prerender_manager_.get(); | 1644 return prerender_manager_.get(); |
1654 } | 1645 } |
OLD | NEW |