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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 SupervisedUserSettingsServiceFactory::GetForProfile(this); | 473 SupervisedUserSettingsServiceFactory::GetForProfile(this); |
474 supervised_user_settings->Init( | 474 supervised_user_settings->Init( |
475 path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS); | 475 path_, sequenced_task_runner, create_mode == CREATE_MODE_SYNCHRONOUS); |
476 #endif | 476 #endif |
477 | 477 |
478 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service( | 478 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service( |
479 g_browser_process->safe_browsing_service()); | 479 g_browser_process->safe_browsing_service()); |
480 if (safe_browsing_service.get()) { | 480 if (safe_browsing_service.get()) { |
481 pref_validation_delegate_ = | 481 pref_validation_delegate_ = |
482 safe_browsing_service->CreatePreferenceValidationDelegate(this); | 482 safe_browsing_service->CreatePreferenceValidationDelegate(this); |
| 483 if (pref_validation_delegate_) { |
| 484 pref_validation_delegate_weak_factory_ = base::MakeUnique< |
| 485 base::WeakPtrFactory<TrackedPreferenceValidationDelegate>>( |
| 486 pref_validation_delegate_.get()); |
| 487 } |
483 } | 488 } |
484 | 489 |
485 content::BrowserContext::Initialize(this, path_); | 490 content::BrowserContext::Initialize(this, path_); |
486 | 491 |
487 { | 492 { |
488 prefs_ = chrome_prefs::CreateProfilePrefs( | 493 prefs_ = chrome_prefs::CreateProfilePrefs( |
489 path_, sequenced_task_runner, pref_validation_delegate_.get(), | 494 path_, sequenced_task_runner, |
| 495 pref_validation_delegate_weak_factory_ |
| 496 ? pref_validation_delegate_weak_factory_->GetWeakPtr() |
| 497 : base::WeakPtr<TrackedPreferenceValidationDelegate>(), |
490 profile_policy_connector_->policy_service(), supervised_user_settings, | 498 profile_policy_connector_->policy_service(), supervised_user_settings, |
491 CreateExtensionPrefStore(this, false), pref_registry_, async_prefs); | 499 CreateExtensionPrefStore(this, false), pref_registry_, async_prefs); |
492 // Register on BrowserContext. | 500 // Register on BrowserContext. |
493 user_prefs::UserPrefs::Set(this, prefs_.get()); | 501 user_prefs::UserPrefs::Set(this, prefs_.get()); |
494 } | 502 } |
495 | 503 |
496 if (async_prefs) { | 504 if (async_prefs) { |
497 // Wait for the notification that prefs has been loaded | 505 // Wait for the notification that prefs has been loaded |
498 // (successfully or not). Note that we can use base::Unretained | 506 // (successfully or not). Note that we can use base::Unretained |
499 // because the PrefService is owned by this class and lives on | 507 // because the PrefService is owned by this class and lives on |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1297 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1290 domain_reliability::DomainReliabilityService* service = | 1298 domain_reliability::DomainReliabilityService* service = |
1291 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1299 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1292 GetForBrowserContext(this); | 1300 GetForBrowserContext(this); |
1293 if (!service) | 1301 if (!service) |
1294 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1302 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1295 | 1303 |
1296 return service->CreateMonitor( | 1304 return service->CreateMonitor( |
1297 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1305 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
1298 } | 1306 } |
OLD | NEW |