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

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 onto crrev/2543523002 Created 4 years 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, 326 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
327 content::NotificationService::AllSources()); 327 content::NotificationService::AllSources());
328 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, 328 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
329 content::NotificationService::AllSources()); 329 content::NotificationService::AllSources());
330 330
331 // Register all the delayed analysis to the incident reporting service. 331 // Register all the delayed analysis to the incident reporting service.
332 RegisterAllDelayedAnalysis(); 332 RegisterAllDelayedAnalysis();
333 } 333 }
334 334
335 void SafeBrowsingService::ShutDown() { 335 void SafeBrowsingService::ShutDown() {
336 shutdown_callback_list_.Notify();
337
336 // Delete the PrefChangeRegistrars, whose dtors also unregister |this| as an 338 // Delete the PrefChangeRegistrars, whose dtors also unregister |this| as an
337 // observer of the preferences. 339 // observer of the preferences.
338 prefs_map_.clear(); 340 prefs_map_.clear();
339 341
340 // Remove Profile creation/destruction observers. 342 // Remove Profile creation/destruction observers.
341 prefs_registrar_.RemoveAll(); 343 prefs_registrar_.RemoveAll();
342 344
343 Stop(true); 345 Stop(true);
344 346
345 services_delegate_->ShutdownServices(); 347 services_delegate_->ShutdownServices();
(...skipping 19 matching lines...) Expand all
365 367
366 #if defined(FULL_SAFE_BROWSING) 368 #if defined(FULL_SAFE_BROWSING)
367 return database_manager_->IsDownloadProtectionEnabled() || 369 return database_manager_->IsDownloadProtectionEnabled() ||
368 (download_protection_service() && 370 (download_protection_service() &&
369 download_protection_service()->enabled()); 371 download_protection_service()->enabled());
370 #else 372 #else
371 return false; 373 return false;
372 #endif 374 #endif
373 } 375 }
374 376
375 net::URLRequestContextGetter* SafeBrowsingService::url_request_context() { 377 scoped_refptr<net::URLRequestContextGetter>
378 SafeBrowsingService::url_request_context() {
376 DCHECK_CURRENTLY_ON(BrowserThread::UI); 379 DCHECK_CURRENTLY_ON(BrowserThread::UI);
377 return url_request_context_getter_.get(); 380 return url_request_context_getter_;
378 } 381 }
379 382
380 const scoped_refptr<SafeBrowsingUIManager>& 383 const scoped_refptr<SafeBrowsingUIManager>&
381 SafeBrowsingService::ui_manager() const { 384 SafeBrowsingService::ui_manager() const {
382 return ui_manager_; 385 return ui_manager_;
383 } 386 }
384 387
385 const scoped_refptr<SafeBrowsingDatabaseManager>& 388 const scoped_refptr<SafeBrowsingDatabaseManager>&
386 SafeBrowsingService::database_manager() const { 389 SafeBrowsingService::database_manager() const {
387 return database_manager_; 390 return database_manager_;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 661 }
659 } 662 }
660 663
661 std::unique_ptr<SafeBrowsingService::StateSubscription> 664 std::unique_ptr<SafeBrowsingService::StateSubscription>
662 SafeBrowsingService::RegisterStateCallback( 665 SafeBrowsingService::RegisterStateCallback(
663 const base::Callback<void(void)>& callback) { 666 const base::Callback<void(void)>& callback) {
664 DCHECK_CURRENTLY_ON(BrowserThread::UI); 667 DCHECK_CURRENTLY_ON(BrowserThread::UI);
665 return state_callback_list_.Add(callback); 668 return state_callback_list_.Add(callback);
666 } 669 }
667 670
671 std::unique_ptr<SafeBrowsingService::ShutdownSubscription>
672 SafeBrowsingService::RegisterShutdownCallback(
673 const base::Callback<void(void)>& callback) {
674 DCHECK_CURRENTLY_ON(BrowserThread::UI);
675 return shutdown_callback_list_.Add(callback);
676 }
677
668 void SafeBrowsingService::RefreshState() { 678 void SafeBrowsingService::RefreshState() {
669 DCHECK_CURRENTLY_ON(BrowserThread::UI); 679 DCHECK_CURRENTLY_ON(BrowserThread::UI);
670 // Check if any profile requires the service to be active. 680 // Check if any profile requires the service to be active.
671 bool enable = false; 681 bool enable = false;
672 for (const auto& pref : prefs_map_) { 682 for (const auto& pref : prefs_map_) {
673 if (pref.first->GetBoolean(prefs::kSafeBrowsingEnabled)) { 683 if (pref.first->GetBoolean(prefs::kSafeBrowsingEnabled)) {
674 enable = true; 684 enable = true;
675 break; 685 break;
676 } 686 }
677 } 687 }
(...skipping 26 matching lines...) Expand all
704 ping_manager()->ReportThreatDetails(report); 714 ping_manager()->ReportThreatDetails(report);
705 } 715 }
706 716
707 void SafeBrowsingService::ProcessResourceRequest( 717 void SafeBrowsingService::ProcessResourceRequest(
708 const ResourceRequestInfo& request) { 718 const ResourceRequestInfo& request) {
709 DCHECK_CURRENTLY_ON(BrowserThread::UI); 719 DCHECK_CURRENTLY_ON(BrowserThread::UI);
710 services_delegate_->ProcessResourceRequest(&request); 720 services_delegate_->ProcessResourceRequest(&request);
711 } 721 }
712 722
713 } // namespace safe_browsing 723 } // 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