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

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

Issue 1784433003: Track CTR of uncommon download warning. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move function inside FULL_SAFE_BROWSING macros Created 4 years, 9 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
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 #if defined(FULL_SAFE_BROWSING) 247 #if defined(FULL_SAFE_BROWSING)
248 #if defined(SAFE_BROWSING_CSD) 248 #if defined(SAFE_BROWSING_CSD)
249 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 249 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
250 switches::kDisableClientSidePhishingDetection)) { 250 switches::kDisableClientSidePhishingDetection)) {
251 csd_service_.reset(ClientSideDetectionService::Create( 251 csd_service_.reset(ClientSideDetectionService::Create(
252 url_request_context_getter_.get())); 252 url_request_context_getter_.get()));
253 } 253 }
254 #endif // defined(SAFE_BROWSING_CSD) 254 #endif // defined(SAFE_BROWSING_CSD)
255 255
256 download_service_.reset(new DownloadProtectionService( 256 download_service_.reset(CreateDownloadProtectionService(
257 this, url_request_context_getter_.get())); 257 url_request_context_getter_.get()));
258 258
259 incident_service_.reset(CreateIncidentReportingService()); 259 incident_service_.reset(CreateIncidentReportingService());
260 resource_request_detector_.reset(new ResourceRequestDetector( 260 resource_request_detector_.reset(new ResourceRequestDetector(
261 database_manager_, incident_service_->GetIncidentReceiver())); 261 database_manager_, incident_service_->GetIncidentReceiver()));
262 #endif // !defined(FULL_SAFE_BROWSING) 262 #endif // !defined(FULL_SAFE_BROWSING)
263 263
264 // Track the safe browsing preference of existing profiles. 264 // Track the safe browsing preference of existing profiles.
265 // The SafeBrowsingService will be started if any existing profile has the 265 // The SafeBrowsingService will be started if any existing profile has the
266 // preference enabled. It will also listen for updates to the preferences. 266 // preference enabled. It will also listen for updates to the preferences.
267 ProfileManager* profile_manager = g_browser_process->profile_manager(); 267 ProfileManager* profile_manager = g_browser_process->profile_manager();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 #if defined(SAFE_BROWSING_DB_LOCAL) 412 #if defined(SAFE_BROWSING_DB_LOCAL)
413 return new LocalSafeBrowsingDatabaseManager(this); 413 return new LocalSafeBrowsingDatabaseManager(this);
414 #elif defined(SAFE_BROWSING_DB_REMOTE) 414 #elif defined(SAFE_BROWSING_DB_REMOTE)
415 return new RemoteSafeBrowsingDatabaseManager(); 415 return new RemoteSafeBrowsingDatabaseManager();
416 #else 416 #else
417 return NULL; 417 return NULL;
418 #endif 418 #endif
419 } 419 }
420 420
421 #if defined(FULL_SAFE_BROWSING) 421 #if defined(FULL_SAFE_BROWSING)
422 DownloadProtectionService* SafeBrowsingService::CreateDownloadProtectionService(
423 net::URLRequestContextGetter* request_context_getter) {
424 return new DownloadProtectionService(this, request_context_getter);
425 }
426
422 IncidentReportingService* 427 IncidentReportingService*
423 SafeBrowsingService::CreateIncidentReportingService() { 428 SafeBrowsingService::CreateIncidentReportingService() {
424 return new IncidentReportingService( 429 return new IncidentReportingService(
425 this, url_request_context_getter_); 430 this, url_request_context_getter_);
426 } 431 }
427 #endif 432 #endif
428 433
429 void SafeBrowsingService::RegisterAllDelayedAnalysis() { 434 void SafeBrowsingService::RegisterAllDelayedAnalysis() {
430 #if defined(FULL_SAFE_BROWSING) 435 #if defined(FULL_SAFE_BROWSING)
431 RegisterBinaryIntegrityAnalysis(); 436 RegisterBinaryIntegrityAnalysis();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 state_callback_list_.Notify(); 661 state_callback_list_.Notify();
657 662
658 #if defined(FULL_SAFE_BROWSING) 663 #if defined(FULL_SAFE_BROWSING)
659 if (csd_service_) 664 if (csd_service_)
660 csd_service_->SetEnabledAndRefreshState(enable); 665 csd_service_->SetEnabledAndRefreshState(enable);
661 if (download_service_) 666 if (download_service_)
662 download_service_->SetEnabled(enable); 667 download_service_->SetEnabled(enable);
663 #endif 668 #endif
664 } 669 }
665 670
666 void SafeBrowsingService::SendDownloadRecoveryReport( 671 void SafeBrowsingService::SendSerializedDownloadReport(
667 const std::string& report) { 672 const std::string& report) {
668 DCHECK_CURRENTLY_ON(BrowserThread::UI); 673 DCHECK_CURRENTLY_ON(BrowserThread::UI);
669 BrowserThread::PostTask( 674 BrowserThread::PostTask(
670 BrowserThread::IO, FROM_HERE, 675 BrowserThread::IO, FROM_HERE,
671 base::Bind(&SafeBrowsingService::OnSendDownloadRecoveryReport, this, 676 base::Bind(&SafeBrowsingService::OnSendSerializedDownloadReport, this,
672 report)); 677 report));
673 } 678 }
674 679
675 void SafeBrowsingService::OnSendDownloadRecoveryReport( 680 void SafeBrowsingService::OnSendSerializedDownloadReport(
676 const std::string& report) { 681 const std::string& report) {
677 DCHECK_CURRENTLY_ON(BrowserThread::IO); 682 DCHECK_CURRENTLY_ON(BrowserThread::IO);
678 if (ping_manager()) 683 if (ping_manager())
679 ping_manager()->ReportThreatDetails(report); 684 ping_manager()->ReportThreatDetails(report);
680 } 685 }
681 686
682 } // namespace safe_browsing 687 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698