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

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

Issue 1819503002: Separate SBClientDownload.SignedOrWhitelistedDownload metric into two buckets, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add another bucket 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/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } else { 662 } else {
663 PostFinishTask(UNKNOWN, REASON_ARCHIVE_WITHOUT_BINARIES); 663 PostFinishTask(UNKNOWN, REASON_ARCHIVE_WITHOUT_BINARIES);
664 return; 664 return;
665 } 665 }
666 } 666 }
667 667
668 OnFileFeatureExtractionDone(); 668 OnFileFeatureExtractionDone();
669 } 669 }
670 #endif // defined(OS_MACOSX) 670 #endif // defined(OS_MACOSX)
671 671
672 static void RecordCountOfSignedOrWhitelistedDownload() { 672 enum WhitelistType {
673 UMA_HISTOGRAM_COUNTS("SBClientDownload.SignedOrWhitelistedDownload", 1); 673 NO_WHITELIST_MATCH,
674 URL_WHITELIST,
675 SIGNATURE_WHITELIST,
676 WHITELIST_TYPE_MAX
677 };
678
679 static void RecordCountOfWhitelistedDownload(WhitelistType type) {
680 UMA_HISTOGRAM_ENUMERATION("SBClientDownload.WhitelistedDownload",
681 type,
682 WHITELIST_TYPE_MAX);
674 } 683 }
675 684
676 void CheckWhitelists() { 685 void CheckWhitelists() {
677 DCHECK_CURRENTLY_ON(BrowserThread::IO); 686 DCHECK_CURRENTLY_ON(BrowserThread::IO);
678 687
679 if (!database_manager_.get()) { 688 if (!database_manager_.get()) {
680 PostFinishTask(UNKNOWN, REASON_SB_DISABLED); 689 PostFinishTask(UNKNOWN, REASON_SB_DISABLED);
681 return; 690 return;
682 } 691 }
683 692
684 const GURL& url = url_chain_.back(); 693 const GURL& url = url_chain_.back();
685 // TODO(asanka): This may acquire a lock on the SB DB on the IO thread. 694 // TODO(asanka): This may acquire a lock on the SB DB on the IO thread.
686 if (url.is_valid() && database_manager_->MatchDownloadWhitelistUrl(url)) { 695 if (url.is_valid() && database_manager_->MatchDownloadWhitelistUrl(url)) {
687 DVLOG(2) << url << " is on the download whitelist."; 696 DVLOG(2) << url << " is on the download whitelist.";
688 RecordCountOfSignedOrWhitelistedDownload(); 697 RecordCountOfWhitelistedDownload(URL_WHITELIST);
689 // TODO(grt): Continue processing without uploading so that 698 // TODO(grt): Continue processing without uploading so that
690 // ClientDownloadRequest callbacks can be run even for this type of safe 699 // ClientDownloadRequest callbacks can be run even for this type of safe
691 // download. 700 // download.
692 PostFinishTask(SAFE, REASON_WHITELISTED_URL); 701 PostFinishTask(SAFE, REASON_WHITELISTED_URL);
693 return; 702 return;
694 } 703 }
695 704
696 if (signature_info_.trusted()) { 705 if (signature_info_.trusted()) {
697 RecordCountOfSignedOrWhitelistedDownload();
698 for (int i = 0; i < signature_info_.certificate_chain_size(); ++i) { 706 for (int i = 0; i < signature_info_.certificate_chain_size(); ++i) {
699 if (CertificateChainIsWhitelisted( 707 if (CertificateChainIsWhitelisted(
700 signature_info_.certificate_chain(i))) { 708 signature_info_.certificate_chain(i))) {
709 RecordCountOfWhitelistedDownload(SIGNATURE_WHITELIST);
701 // TODO(grt): Continue processing without uploading so that 710 // TODO(grt): Continue processing without uploading so that
702 // ClientDownloadRequest callbacks can be run even for this type of 711 // ClientDownloadRequest callbacks can be run even for this type of
703 // safe download. 712 // safe download.
704 PostFinishTask(SAFE, REASON_TRUSTED_EXECUTABLE); 713 PostFinishTask(SAFE, REASON_TRUSTED_EXECUTABLE);
705 return; 714 return;
706 } 715 }
707 } 716 }
708 } 717 }
709 718
719 RecordCountOfWhitelistedDownload(NO_WHITELIST_MATCH);
mattm 2016/03/21 20:57:19 I think this is a little unclear. There are downlo
Jialiu Lin 2016/03/21 21:26:48 metrics description updated.
720
710 if (!pingback_enabled_) { 721 if (!pingback_enabled_) {
711 PostFinishTask(UNKNOWN, REASON_PING_DISABLED); 722 PostFinishTask(UNKNOWN, REASON_PING_DISABLED);
712 return; 723 return;
713 } 724 }
714 725
715 // The URLFetcher is owned by the UI thread, so post a message to 726 // The URLFetcher is owned by the UI thread, so post a message to
716 // start the pingback. 727 // start the pingback.
717 BrowserThread::PostTask( 728 BrowserThread::PostTask(
718 BrowserThread::UI, 729 BrowserThread::UI,
719 FROM_HERE, 730 FROM_HERE,
720 base::Bind(&CheckClientDownloadRequest::GetTabRedirects, this)); 731 base::Bind(&CheckClientDownloadRequest::GetTabRedirects, this));
721 } 732 }
722 733
723 void GetTabRedirects() { 734 void GetTabRedirects() {
724 DCHECK_CURRENTLY_ON(BrowserThread::UI); 735 DCHECK_CURRENTLY_ON(BrowserThread::UI);
725 if (!service_) 736 if (!service_)
726 return; 737 return;
727 738
728 if (!tab_url_.is_valid()) { 739 if (!tab_url_.is_valid()) {
729 SendRequest(); 740 SendRequest();
730 return; 741 return;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 GURL DownloadProtectionService::GetDownloadRequestUrl() { 1253 GURL DownloadProtectionService::GetDownloadRequestUrl() {
1243 GURL url(kDownloadRequestUrl); 1254 GURL url(kDownloadRequestUrl);
1244 std::string api_key = google_apis::GetAPIKey(); 1255 std::string api_key = google_apis::GetAPIKey();
1245 if (!api_key.empty()) 1256 if (!api_key.empty())
1246 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); 1257 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
1247 1258
1248 return url; 1259 return url;
1249 } 1260 }
1250 1261
1251 } // namespace safe_browsing 1262 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698