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

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 2901563003: PDF: Add UMA to track embedded PDF triggered drive-by downloads. (Closed)
Patch Set: Created 3 years, 7 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/download/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #endif 71 #endif
72 72
73 #if BUILDFLAG(ENABLE_EXTENSIONS) 73 #if BUILDFLAG(ENABLE_EXTENSIONS)
74 #include "chrome/browser/extensions/api/downloads/downloads_api.h" 74 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
75 #include "chrome/browser/extensions/crx_installer.h" 75 #include "chrome/browser/extensions/crx_installer.h"
76 #include "chrome/browser/extensions/webstore_installer.h" 76 #include "chrome/browser/extensions/webstore_installer.h"
77 #include "extensions/browser/notification_types.h" 77 #include "extensions/browser/notification_types.h"
78 #include "extensions/common/constants.h" 78 #include "extensions/common/constants.h"
79 #endif 79 #endif
80 80
81 #if BUILDFLAG(ENABLE_PLUGINS)
82 #include "chrome/common/pdf_uma.h"
83 #endif
84
81 using content::BrowserThread; 85 using content::BrowserThread;
82 using content::DownloadItem; 86 using content::DownloadItem;
83 using content::DownloadManager; 87 using content::DownloadManager;
84 using safe_browsing::DownloadFileType; 88 using safe_browsing::DownloadFileType;
85 using safe_browsing::DownloadProtectionService; 89 using safe_browsing::DownloadProtectionService;
86 90
87 namespace { 91 namespace {
88 92
89 #if defined(FULL_SAFE_BROWSING) 93 #if defined(FULL_SAFE_BROWSING)
90 94
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 } 729 }
726 730
727 void ChromeDownloadManagerDelegate::GetFileMimeType( 731 void ChromeDownloadManagerDelegate::GetFileMimeType(
728 const base::FilePath& path, 732 const base::FilePath& path,
729 const GetFileMimeTypeCallback& callback) { 733 const GetFileMimeTypeCallback& callback) {
730 DCHECK_CURRENTLY_ON(BrowserThread::UI); 734 DCHECK_CURRENTLY_ON(BrowserThread::UI);
731 base::PostTaskWithTraitsAndReplyWithResult( 735 base::PostTaskWithTraitsAndReplyWithResult(
732 FROM_HERE, {base::MayBlock()}, base::Bind(&GetMimeType, path), callback); 736 FROM_HERE, {base::MayBlock()}, base::Bind(&GetMimeType, path), callback);
733 } 737 }
734 738
739 void ChromeDownloadManagerDelegate::RecordDriveByPDFDownload() const {
740 #if BUILDFLAG(ENABLE_PLUGINS)
741 ReportPDFLoadStatus(TRIGGERED_DRIVE_BY_DOWNLOAD);
742 #endif
743 }
744
735 #if defined(FULL_SAFE_BROWSING) 745 #if defined(FULL_SAFE_BROWSING)
736 void ChromeDownloadManagerDelegate::CheckClientDownloadDone( 746 void ChromeDownloadManagerDelegate::CheckClientDownloadDone(
737 uint32_t download_id, 747 uint32_t download_id,
738 DownloadProtectionService::DownloadCheckResult result) { 748 DownloadProtectionService::DownloadCheckResult result) {
739 DownloadItem* item = download_manager_->GetDownload(download_id); 749 DownloadItem* item = download_manager_->GetDownload(download_id);
740 if (!item || (item->GetState() != DownloadItem::IN_PROGRESS)) 750 if (!item || (item->GetState() != DownloadItem::IN_PROGRESS))
741 return; 751 return;
742 752
743 DVLOG(2) << __func__ << "() download = " << item->DebugString(false) 753 DVLOG(2) << __func__ << "() download = " << item->DebugString(false)
744 << " verdict = " << result; 754 << " verdict = " << result;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || 872 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) ||
863 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || 873 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) ||
864 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || 874 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) ||
865 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || 875 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) ||
866 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { 876 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) {
867 return true; 877 return true;
868 } 878 }
869 #endif 879 #endif
870 return false; 880 return false;
871 } 881 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698