Chromium Code Reviews| 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/safe_browsing/safe_browsing_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 if (base::FeatureList::IsEnabled( | 327 if (base::FeatureList::IsEnabled( |
| 328 SafeBrowsingNavigationObserverManager::kDownloadAttribution)) { | 328 SafeBrowsingNavigationObserverManager::kDownloadAttribution)) { |
| 329 navigation_observer_manager_ = new SafeBrowsingNavigationObserverManager(); | 329 navigation_observer_manager_ = new SafeBrowsingNavigationObserverManager(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 services_delegate_->Initialize(v4_enabled_); | 332 services_delegate_->Initialize(v4_enabled_); |
| 333 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); | 333 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); |
| 334 | 334 |
| 335 // TODO(jialiul): When PasswordProtectionService does more than reporting UMA, | 335 // TODO(jialiul): When PasswordProtectionService does more than reporting UMA, |
| 336 // we need to add finch trial to gate its functionality. | 336 // we need to add finch trial to gate its functionality. |
| 337 password_protection_service_ = | 337 password_protection_service_ = base::MakeUnique<PasswordProtectionService>( |
| 338 base::MakeUnique<PasswordProtectionService>(database_manager()); | 338 database_manager(), url_request_context()); |
| 339 | 339 |
| 340 // Track the safe browsing preference of existing profiles. | 340 // Track the safe browsing preference of existing profiles. |
| 341 // The SafeBrowsingService will be started if any existing profile has the | 341 // The SafeBrowsingService will be started if any existing profile has the |
| 342 // preference enabled. It will also listen for updates to the preferences. | 342 // preference enabled. It will also listen for updates to the preferences. |
| 343 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 343 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 344 if (profile_manager) { | 344 if (profile_manager) { |
| 345 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); | 345 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); |
| 346 // TODO(felt): I believe this for-loop is dead code. Confirm this and | 346 // TODO(felt): I believe this for-loop is dead code. Confirm this and |
| 347 // remove in a future CL. See https://codereview.chromium.org/1341533002/ | 347 // remove in a future CL. See https://codereview.chromium.org/1341533002/ |
| 348 DCHECK_EQ(0u, profiles.size()); | 348 DCHECK_EQ(0u, profiles.size()); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 371 // observer of the preferences. | 371 // observer of the preferences. |
| 372 prefs_map_.clear(); | 372 prefs_map_.clear(); |
| 373 | 373 |
| 374 // Remove Profile creation/destruction observers. | 374 // Remove Profile creation/destruction observers. |
| 375 prefs_registrar_.RemoveAll(); | 375 prefs_registrar_.RemoveAll(); |
| 376 | 376 |
| 377 Stop(true); | 377 Stop(true); |
| 378 | 378 |
| 379 services_delegate_->ShutdownServices(); | 379 services_delegate_->ShutdownServices(); |
| 380 | 380 |
| 381 password_protection_service_.reset(); | |
|
Nathan Parker
2017/03/23 20:45:49
Maybe this should go before services_delegate sinc
Jialiu Lin
2017/03/23 22:42:58
Done.
| |
| 382 | |
| 381 // Since URLRequestContextGetters are refcounted, can't count on clearing | 383 // Since URLRequestContextGetters are refcounted, can't count on clearing |
| 382 // |url_request_context_getter_| to delete it, so need to shut it down first, | 384 // |url_request_context_getter_| to delete it, so need to shut it down first, |
| 383 // which will cancel any requests that are currently using it, and prevent | 385 // which will cancel any requests that are currently using it, and prevent |
| 384 // new requests from using it as well. | 386 // new requests from using it as well. |
| 385 BrowserThread::PostNonNestableTask( | 387 BrowserThread::PostNonNestableTask( |
| 386 BrowserThread::IO, FROM_HERE, | 388 BrowserThread::IO, FROM_HERE, |
| 387 base::Bind(&SafeBrowsingURLRequestContextGetter::ServiceShuttingDown, | 389 base::Bind(&SafeBrowsingURLRequestContextGetter::ServiceShuttingDown, |
| 388 url_request_context_getter_)); | 390 url_request_context_getter_)); |
| 389 | 391 |
| 390 // Release the URLRequestContextGetter after passing it to the IOThread. It | 392 // Release the URLRequestContextGetter after passing it to the IOThread. It |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 767 ping_manager()->ReportThreatDetails(report); | 769 ping_manager()->ReportThreatDetails(report); |
| 768 } | 770 } |
| 769 | 771 |
| 770 void SafeBrowsingService::ProcessResourceRequest( | 772 void SafeBrowsingService::ProcessResourceRequest( |
| 771 const ResourceRequestInfo& request) { | 773 const ResourceRequestInfo& request) { |
| 772 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 774 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 773 services_delegate_->ProcessResourceRequest(&request); | 775 services_delegate_->ProcessResourceRequest(&request); |
| 774 } | 776 } |
| 775 | 777 |
| 776 } // namespace safe_browsing | 778 } // namespace safe_browsing |
| OLD | NEW |