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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 #endif | 300 #endif |
304 | 301 |
305 create_session_service_timer_.Start( | 302 create_session_service_timer_.Start( |
306 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 303 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
307 &ProfileImpl::EnsureSessionServiceCreated); | 304 &ProfileImpl::EnsureSessionServiceCreated); |
308 | 305 |
309 if (delegate_) { | 306 if (delegate_) { |
310 prefs_.reset(PrefService::CreatePrefService( | 307 prefs_.reset(PrefService::CreatePrefService( |
311 GetPrefFilePath(), | 308 GetPrefFilePath(), |
312 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), | 309 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), |
313 GetOriginalProfile(), | |
314 true)); | 310 true)); |
315 // Wait for the notifcation that prefs has been loaded (successfully or | 311 // Wait for the notifcation that prefs has been loaded (successfully or |
316 // not). | 312 // not). |
317 registrar_.Add(this, NotificationType::PREF_INITIALIZATION_COMPLETED, | 313 registrar_.Add(this, NotificationType::PREF_INITIALIZATION_COMPLETED, |
318 Source<PrefService>(prefs_.get())); | 314 Source<PrefService>(prefs_.get())); |
319 } else { | 315 } else { |
320 // Load prefs synchronously. | 316 // Load prefs synchronously. |
321 prefs_.reset(PrefService::CreatePrefService( | 317 prefs_.reset(PrefService::CreatePrefService( |
322 GetPrefFilePath(), | 318 GetPrefFilePath(), |
323 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), | 319 new ExtensionPrefStore(GetExtensionPrefValueMap(), false), |
324 GetOriginalProfile(), | |
325 false)); | 320 false)); |
326 OnPrefsLoaded(true); | 321 OnPrefsLoaded(true); |
327 } | 322 } |
328 } | 323 } |
329 | 324 |
330 void ProfileImpl::DoFinalInit() { | 325 void ProfileImpl::DoFinalInit() { |
331 PrefService* prefs = GetPrefs(); | 326 PrefService* prefs = GetPrefs(); |
332 pref_change_registrar_.Init(prefs); | 327 pref_change_registrar_.Init(prefs); |
333 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); | 328 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
334 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); | 329 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); | 417 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); |
423 | 418 |
424 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); | 419 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); |
425 | 420 |
426 // Make sure we initialize the ProfileIOData after everything else has been | 421 // Make sure we initialize the ProfileIOData after everything else has been |
427 // initialized that we might be reading from the IO thread. | 422 // initialized that we might be reading from the IO thread. |
428 io_data_.Init(cookie_path, cache_path, cache_max_size, | 423 io_data_.Init(cookie_path, cache_path, cache_max_size, |
429 media_cache_path, media_cache_max_size, extensions_cookie_path, | 424 media_cache_path, media_cache_max_size, extensions_cookie_path, |
430 app_path); | 425 app_path); |
431 | 426 |
432 policy::ProfilePolicyConnector* policy_connector = | |
433 policy::ProfilePolicyConnectorFactory::GetForProfile(this); | |
434 policy_connector->Initialize(); | |
435 | |
436 // Creation has been finished. | 427 // Creation has been finished. |
437 if (delegate_) | 428 if (delegate_) |
438 delegate_->OnProfileCreated(this, true); | 429 delegate_->OnProfileCreated(this, true); |
439 } | 430 } |
440 | 431 |
441 void ProfileImpl::InitExtensions(bool extensions_enabled) { | 432 void ProfileImpl::InitExtensions(bool extensions_enabled) { |
442 if (user_script_master_ || extension_service_.get()) | 433 if (user_script_master_ || extension_service_.get()) |
443 return; // Already initialized. | 434 return; // Already initialized. |
444 | 435 |
445 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 436 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 if (!prerender::PrerenderManager::IsPrerenderingPossible()) | 1642 if (!prerender::PrerenderManager::IsPrerenderingPossible()) |
1652 return NULL; | 1643 return NULL; |
1653 if (!prerender_manager_.get()) { | 1644 if (!prerender_manager_.get()) { |
1654 CHECK(g_browser_process->prerender_tracker()); | 1645 CHECK(g_browser_process->prerender_tracker()); |
1655 prerender_manager_.reset( | 1646 prerender_manager_.reset( |
1656 new prerender::PrerenderManager( | 1647 new prerender::PrerenderManager( |
1657 this, g_browser_process->prerender_tracker())); | 1648 this, g_browser_process->prerender_tracker())); |
1658 } | 1649 } |
1659 return prerender_manager_.get(); | 1650 return prerender_manager_.get(); |
1660 } | 1651 } |
OLD | NEW |