Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1191)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, 338 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
339 content::NotificationService::AllSources()); 339 content::NotificationService::AllSources());
340 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, 340 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
341 content::NotificationService::AllSources()); 341 content::NotificationService::AllSources());
342 342
343 // Register all the delayed analysis to the incident reporting service. 343 // Register all the delayed analysis to the incident reporting service.
344 RegisterAllDelayedAnalysis(); 344 RegisterAllDelayedAnalysis();
345 } 345 }
346 346
347 void SafeBrowsingService::ShutDown() { 347 void SafeBrowsingService::ShutDown() {
348 DCHECK_CURRENTLY_ON(BrowserThread::UI);
349 shutdown_callback_list_.Notify();
350
348 // Delete the PrefChangeRegistrars, whose dtors also unregister |this| as an 351 // Delete the PrefChangeRegistrars, whose dtors also unregister |this| as an
349 // observer of the preferences. 352 // observer of the preferences.
350 prefs_map_.clear(); 353 prefs_map_.clear();
351 354
352 // Remove Profile creation/destruction observers. 355 // Remove Profile creation/destruction observers.
353 prefs_registrar_.RemoveAll(); 356 prefs_registrar_.RemoveAll();
354 357
355 Stop(true); 358 Stop(true);
356 359
357 services_delegate_->ShutdownServices(); 360 services_delegate_->ShutdownServices();
(...skipping 19 matching lines...) Expand all
377 380
378 #if defined(FULL_SAFE_BROWSING) 381 #if defined(FULL_SAFE_BROWSING)
379 return database_manager()->IsDownloadProtectionEnabled() || 382 return database_manager()->IsDownloadProtectionEnabled() ||
380 (download_protection_service() && 383 (download_protection_service() &&
381 download_protection_service()->enabled()); 384 download_protection_service()->enabled());
382 #else 385 #else
383 return false; 386 return false;
384 #endif 387 #endif
385 } 388 }
386 389
387 net::URLRequestContextGetter* SafeBrowsingService::url_request_context() { 390 scoped_refptr<net::URLRequestContextGetter>
391 SafeBrowsingService::url_request_context() {
388 DCHECK_CURRENTLY_ON(BrowserThread::UI); 392 DCHECK_CURRENTLY_ON(BrowserThread::UI);
389 return url_request_context_getter_.get(); 393 return url_request_context_getter_;
390 } 394 }
391 395
392 const scoped_refptr<SafeBrowsingUIManager>& 396 const scoped_refptr<SafeBrowsingUIManager>&
393 SafeBrowsingService::ui_manager() const { 397 SafeBrowsingService::ui_manager() const {
394 return ui_manager_; 398 return ui_manager_;
395 } 399 }
396 400
397 const scoped_refptr<SafeBrowsingDatabaseManager>& 401 const scoped_refptr<SafeBrowsingDatabaseManager>&
398 SafeBrowsingService::database_manager() const { 402 SafeBrowsingService::database_manager() const {
399 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_; 403 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 } 687 }
684 } 688 }
685 689
686 std::unique_ptr<SafeBrowsingService::StateSubscription> 690 std::unique_ptr<SafeBrowsingService::StateSubscription>
687 SafeBrowsingService::RegisterStateCallback( 691 SafeBrowsingService::RegisterStateCallback(
688 const base::Callback<void(void)>& callback) { 692 const base::Callback<void(void)>& callback) {
689 DCHECK_CURRENTLY_ON(BrowserThread::UI); 693 DCHECK_CURRENTLY_ON(BrowserThread::UI);
690 return state_callback_list_.Add(callback); 694 return state_callback_list_.Add(callback);
691 } 695 }
692 696
697 std::unique_ptr<SafeBrowsingService::ShutdownSubscription>
698 SafeBrowsingService::RegisterShutdownCallback(
699 const base::Callback<void(void)>& callback) {
700 DCHECK_CURRENTLY_ON(BrowserThread::UI);
701 return shutdown_callback_list_.Add(callback);
702 }
703
693 void SafeBrowsingService::RefreshState() { 704 void SafeBrowsingService::RefreshState() {
694 DCHECK_CURRENTLY_ON(BrowserThread::UI); 705 DCHECK_CURRENTLY_ON(BrowserThread::UI);
695 // Check if any profile requires the service to be active. 706 // Check if any profile requires the service to be active.
696 bool enable = false; 707 bool enable = false;
697 for (const auto& pref : prefs_map_) { 708 for (const auto& pref : prefs_map_) {
698 if (pref.first->GetBoolean(prefs::kSafeBrowsingEnabled)) { 709 if (pref.first->GetBoolean(prefs::kSafeBrowsingEnabled)) {
699 enable = true; 710 enable = true;
700 break; 711 break;
701 } 712 }
702 } 713 }
(...skipping 26 matching lines...) Expand all
729 ping_manager()->ReportThreatDetails(report); 740 ping_manager()->ReportThreatDetails(report);
730 } 741 }
731 742
732 void SafeBrowsingService::ProcessResourceRequest( 743 void SafeBrowsingService::ProcessResourceRequest(
733 const ResourceRequestInfo& request) { 744 const ResourceRequestInfo& request) {
734 DCHECK_CURRENTLY_ON(BrowserThread::UI); 745 DCHECK_CURRENTLY_ON(BrowserThread::UI);
735 services_delegate_->ProcessResourceRequest(&request); 746 services_delegate_->ProcessResourceRequest(&request);
736 } 747 }
737 748
738 } // namespace safe_browsing 749 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698