Index: chrome/browser/safe_browsing/services_delegate_impl.cc |
diff --git a/chrome/browser/safe_browsing/services_delegate_impl.cc b/chrome/browser/safe_browsing/services_delegate_impl.cc |
index 89997f8fab4010bbd74dfed957ca9e53a69ec9fd..e50cb929758bd3c8ceb69c720b8d0947dcbc8783 100644 |
--- a/chrome/browser/safe_browsing/services_delegate_impl.cc |
+++ b/chrome/browser/safe_browsing/services_delegate_impl.cc |
@@ -102,6 +102,9 @@ void ServicesDelegateImpl::ShutdownServices() { |
resource_request_detector_.reset(); |
incident_service_.reset(); |
+ // Delete the ChromePasswordProtectionService instances. |
+ password_protection_service_map_.clear(); |
+ |
// Must shut down last. |
download_service_.reset(); |
} |
@@ -179,4 +182,31 @@ void ServicesDelegateImpl::StopOnIOThread(bool shutdown) { |
} |
} |
+void ServicesDelegateImpl::CreatePasswordProtectionService(Profile* profile) { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
+ DCHECK(profile); |
+ auto it = password_protection_service_map_.find(profile); |
+ DCHECK(it == password_protection_service_map_.end()); |
+ std::unique_ptr<ChromePasswordProtectionService> service = |
+ base::MakeUnique<ChromePasswordProtectionService>(safe_browsing_service_, |
+ profile); |
+ password_protection_service_map_[profile] = std::move(service); |
+} |
+ |
+void ServicesDelegateImpl::RemovePasswordProtectionService(Profile* profile) { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
+ DCHECK(profile); |
+ auto it = password_protection_service_map_.find(profile); |
+ if (it != password_protection_service_map_.end()) |
+ password_protection_service_map_.erase(it); |
+} |
+ |
+PasswordProtectionService* ServicesDelegateImpl::GetPasswordProtectionService( |
+ Profile* profile) const { |
+ DCHECK(profile); |
+ auto it = password_protection_service_map_.find(profile); |
+ DCHECK(it != password_protection_service_map_.end()); |
+ return it->second.get(); |
+} |
+ |
} // namespace safe_browsing |