OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 start_time_(Time::Now()), | 381 start_time_(Time::Now()), |
382 #if defined(OS_CHROMEOS) | 382 #if defined(OS_CHROMEOS) |
383 is_login_profile_(false), | 383 is_login_profile_(false), |
384 #endif | 384 #endif |
385 delegate_(delegate), | 385 delegate_(delegate), |
386 predictor_(NULL) { | 386 predictor_(NULL) { |
387 TRACE_EVENT0("browser", "ProfileImpl::ctor") | 387 TRACE_EVENT0("browser", "ProfileImpl::ctor") |
388 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << | 388 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
389 "profile files to the root directory!"; | 389 "profile files to the root directory!"; |
390 | 390 |
391 #if defined(OS_CHROMEOS) | |
392 is_login_profile_ = chromeos::ProfileHelper::IsSigninProfile(this); | |
willchan no longer on Chromium
2013/10/29 01:21:09
Which code needs |is_login_profile_| to be set ear
pneubeck (no reviews)
2013/10/29 09:56:22
ProfilePolicyConnectorFactory::CreateForProfile(In
pneubeck (no reviews)
2013/10/30 08:32:03
Actually, my original plan was to inline ProfileHe
willchan no longer on Chromium
2013/10/30 17:20:48
If that's a short CL, can you do that first and re
pneubeck (no reviews)
2013/10/31 08:41:40
CL is in review: https://codereview.chromium.org/5
| |
393 #endif | |
394 | |
391 #if defined(ENABLE_SESSION_SERVICE) | 395 #if defined(ENABLE_SESSION_SERVICE) |
392 create_session_service_timer_.Start(FROM_HERE, | 396 create_session_service_timer_.Start(FROM_HERE, |
393 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 397 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
394 &ProfileImpl::EnsureSessionServiceCreated); | 398 &ProfileImpl::EnsureSessionServiceCreated); |
395 #endif | 399 #endif |
396 | 400 |
397 // Determine if prefetch is enabled for this profile. | 401 // Determine if prefetch is enabled for this profile. |
398 // If not profile_manager is present, it means we are in a unittest. | 402 // If not profile_manager is present, it means we are in a unittest. |
399 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 403 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
400 predictor_ = chrome_browser_net::Predictor::CreatePredictor( | 404 predictor_ = chrome_browser_net::Predictor::CreatePredictor( |
(...skipping 16 matching lines...) Expand all Loading... | |
417 #endif | 421 #endif |
418 profile_policy_connector_ = | 422 profile_policy_connector_ = |
419 policy::ProfilePolicyConnectorFactory::CreateForProfile( | 423 policy::ProfilePolicyConnectorFactory::CreateForProfile( |
420 this, force_immediate_policy_load); | 424 this, force_immediate_policy_load); |
421 | 425 |
422 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || | 426 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || |
423 create_mode == CREATE_MODE_SYNCHRONOUS); | 427 create_mode == CREATE_MODE_SYNCHRONOUS); |
424 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; | 428 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; |
425 | 429 |
426 #if defined(OS_CHROMEOS) | 430 #if defined(OS_CHROMEOS) |
427 is_login_profile_ = chromeos::ProfileHelper::IsSigninProfile(this); | |
428 if (is_login_profile_) | 431 if (is_login_profile_) |
429 chrome::RegisterLoginProfilePrefs(pref_registry_.get()); | 432 chrome::RegisterLoginProfilePrefs(pref_registry_.get()); |
430 else | 433 else |
431 #endif | 434 #endif |
432 chrome::RegisterUserProfilePrefs(pref_registry_.get()); | 435 chrome::RegisterUserProfilePrefs(pref_registry_.get()); |
433 | 436 |
434 ManagedUserSettingsService* managed_user_settings = NULL; | 437 ManagedUserSettingsService* managed_user_settings = NULL; |
435 #if defined(ENABLE_MANAGED_USERS) | 438 #if defined(ENABLE_MANAGED_USERS) |
436 managed_user_settings = | 439 managed_user_settings = |
437 ManagedUserSettingsServiceFactory::GetForProfile(this); | 440 ManagedUserSettingsServiceFactory::GetForProfile(this); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 #endif | 663 #endif |
661 | 664 |
662 // Remove pref observers | 665 // Remove pref observers |
663 pref_change_registrar_.RemoveAll(); | 666 pref_change_registrar_.RemoveAll(); |
664 | 667 |
665 #if defined(ENABLE_PLUGINS) | 668 #if defined(ENABLE_PLUGINS) |
666 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 669 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
667 io_data_.GetResourceContextNoInit()); | 670 io_data_.GetResourceContextNoInit()); |
668 #endif | 671 #endif |
669 | 672 |
673 io_data_.ReleaseFromBrowserContextServices(this); | |
willchan no longer on Chromium
2013/10/30 01:12:31
Would it work to let the ProfileImplIOData::Handle
pneubeck (no reviews)
2013/10/30 08:32:03
Yes, that will work. But again only, because every
willchan no longer on Chromium
2013/10/30 17:20:48
Great point! I personally mentally dismissed that
| |
674 | |
670 // Destroy OTR profile and its profile services first. | 675 // Destroy OTR profile and its profile services first. |
671 if (off_the_record_profile_) { | 676 if (off_the_record_profile_) { |
672 ProfileDestroyer::DestroyOffTheRecordProfileNow( | 677 ProfileDestroyer::DestroyOffTheRecordProfileNow( |
673 off_the_record_profile_.get()); | 678 off_the_record_profile_.get()); |
674 } else { | 679 } else { |
675 ExtensionPrefValueMapFactory::GetForProfile(this)-> | 680 ExtensionPrefValueMapFactory::GetForProfile(this)-> |
676 ClearAllIncognitoSessionOnlyPreferences(); | 681 ClearAllIncognitoSessionOnlyPreferences(); |
677 } | 682 } |
678 | 683 |
679 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( | 684 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1230 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
1226 #if defined(OS_CHROMEOS) | 1231 #if defined(OS_CHROMEOS) |
1227 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1232 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
1228 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1233 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
1229 g_browser_process->local_state()); | 1234 g_browser_process->local_state()); |
1230 } | 1235 } |
1231 #endif // defined(OS_CHROMEOS) | 1236 #endif // defined(OS_CHROMEOS) |
1232 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1237 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
1233 GetPrefs(), g_browser_process->local_state()); | 1238 GetPrefs(), g_browser_process->local_state()); |
1234 } | 1239 } |
OLD | NEW |