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

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 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
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, 332 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
333 content::NotificationService::AllSources()); 333 content::NotificationService::AllSources());
334 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, 334 prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
335 content::NotificationService::AllSources()); 335 content::NotificationService::AllSources());
336 336
337 // Register all the delayed analysis to the incident reporting service. 337 // Register all the delayed analysis to the incident reporting service.
338 RegisterAllDelayedAnalysis(); 338 RegisterAllDelayedAnalysis();
339 } 339 }
340 340
341 void SafeBrowsingService::ShutDown() { 341 void SafeBrowsingService::ShutDown() {
342 shutdown_callback_list_.Notify();
343
342 // Delete the PrefChangeRegistrars, whose dtors also unregister |this| as an 344 // Delete the PrefChangeRegistrars, whose dtors also unregister |this| as an
343 // observer of the preferences. 345 // observer of the preferences.
344 prefs_map_.clear(); 346 prefs_map_.clear();
345 347
346 // Remove Profile creation/destruction observers. 348 // Remove Profile creation/destruction observers.
347 prefs_registrar_.RemoveAll(); 349 prefs_registrar_.RemoveAll();
348 350
349 Stop(true); 351 Stop(true);
350 352
351 services_delegate_->ShutdownServices(); 353 services_delegate_->ShutdownServices();
(...skipping 19 matching lines...) Expand all
371 373
372 #if defined(FULL_SAFE_BROWSING) 374 #if defined(FULL_SAFE_BROWSING)
373 return database_manager()->IsDownloadProtectionEnabled() || 375 return database_manager()->IsDownloadProtectionEnabled() ||
374 (download_protection_service() && 376 (download_protection_service() &&
375 download_protection_service()->enabled()); 377 download_protection_service()->enabled());
376 #else 378 #else
377 return false; 379 return false;
378 #endif 380 #endif
379 } 381 }
380 382
381 net::URLRequestContextGetter* SafeBrowsingService::url_request_context() { 383 scoped_refptr<net::URLRequestContextGetter>
384 SafeBrowsingService::url_request_context() {
382 DCHECK_CURRENTLY_ON(BrowserThread::UI); 385 DCHECK_CURRENTLY_ON(BrowserThread::UI);
383 return url_request_context_getter_.get(); 386 return url_request_context_getter_;
384 } 387 }
385 388
386 const scoped_refptr<SafeBrowsingUIManager>& 389 const scoped_refptr<SafeBrowsingUIManager>&
387 SafeBrowsingService::ui_manager() const { 390 SafeBrowsingService::ui_manager() const {
388 return ui_manager_; 391 return ui_manager_;
389 } 392 }
390 393
391 const scoped_refptr<SafeBrowsingDatabaseManager>& 394 const scoped_refptr<SafeBrowsingDatabaseManager>&
392 SafeBrowsingService::database_manager() const { 395 SafeBrowsingService::database_manager() const {
393 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_; 396 return enabled_v4_only_ ? v4_local_database_manager() : database_manager_;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 } 675 }
673 } 676 }
674 677
675 std::unique_ptr<SafeBrowsingService::StateSubscription> 678 std::unique_ptr<SafeBrowsingService::StateSubscription>
676 SafeBrowsingService::RegisterStateCallback( 679 SafeBrowsingService::RegisterStateCallback(
677 const base::Callback<void(void)>& callback) { 680 const base::Callback<void(void)>& callback) {
678 DCHECK_CURRENTLY_ON(BrowserThread::UI); 681 DCHECK_CURRENTLY_ON(BrowserThread::UI);
679 return state_callback_list_.Add(callback); 682 return state_callback_list_.Add(callback);
680 } 683 }
681 684
685 std::unique_ptr<SafeBrowsingService::ShutdownSubscription>
686 SafeBrowsingService::RegisterShutdownCallback(
687 const base::Callback<void(void)>& callback) {
688 DCHECK_CURRENTLY_ON(BrowserThread::UI);
689 return shutdown_callback_list_.Add(callback);
690 }
691
682 void SafeBrowsingService::RefreshState() { 692 void SafeBrowsingService::RefreshState() {
683 DCHECK_CURRENTLY_ON(BrowserThread::UI); 693 DCHECK_CURRENTLY_ON(BrowserThread::UI);
684 // Check if any profile requires the service to be active. 694 // Check if any profile requires the service to be active.
685 bool enable = false; 695 bool enable = false;
686 for (const auto& pref : prefs_map_) { 696 for (const auto& pref : prefs_map_) {
687 if (pref.first->GetBoolean(prefs::kSafeBrowsingEnabled)) { 697 if (pref.first->GetBoolean(prefs::kSafeBrowsingEnabled)) {
688 enable = true; 698 enable = true;
689 break; 699 break;
690 } 700 }
691 } 701 }
(...skipping 26 matching lines...) Expand all
718 ping_manager()->ReportThreatDetails(report); 728 ping_manager()->ReportThreatDetails(report);
719 } 729 }
720 730
721 void SafeBrowsingService::ProcessResourceRequest( 731 void SafeBrowsingService::ProcessResourceRequest(
722 const ResourceRequestInfo& request) { 732 const ResourceRequestInfo& request) {
723 DCHECK_CURRENTLY_ON(BrowserThread::UI); 733 DCHECK_CURRENTLY_ON(BrowserThread::UI);
724 services_delegate_->ProcessResourceRequest(&request); 734 services_delegate_->ProcessResourceRequest(&request);
725 } 735 }
726 736
727 } // namespace safe_browsing 737 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698