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

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

Issue 2900803002: Renaming zip_analyzer_results to archive_analyzer_results (Closed)
Patch Set: minor fixups 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.h » ('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/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 <memory> 9 #include <memory>
10 10
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" 38 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
39 #include "chrome/browser/profiles/profile.h" 39 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/profiles/profile_manager.h" 40 #include "chrome/browser/profiles/profile_manager.h"
41 #include "chrome/browser/safe_browsing/download_feedback_service.h" 41 #include "chrome/browser/safe_browsing/download_feedback_service.h"
42 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 42 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
43 #include "chrome/browser/safe_browsing/sandboxed_zip_analyzer.h" 43 #include "chrome/browser/safe_browsing/sandboxed_zip_analyzer.h"
44 #include "chrome/browser/sessions/session_tab_helper.h" 44 #include "chrome/browser/sessions/session_tab_helper.h"
45 #include "chrome/browser/ui/browser.h" 45 #include "chrome/browser/ui/browser.h"
46 #include "chrome/browser/ui/browser_list.h" 46 #include "chrome/browser/ui/browser_list.h"
47 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
48 #include "chrome/common/safe_browsing/archive_analyzer_results.h"
48 #include "chrome/common/safe_browsing/binary_feature_extractor.h" 49 #include "chrome/common/safe_browsing/binary_feature_extractor.h"
49 #include "chrome/common/safe_browsing/download_protection_util.h" 50 #include "chrome/common/safe_browsing/download_protection_util.h"
50 #include "chrome/common/safe_browsing/file_type_policies.h" 51 #include "chrome/common/safe_browsing/file_type_policies.h"
51 #include "chrome/common/safe_browsing/zip_analyzer_results.h"
52 #include "chrome/common/url_constants.h" 52 #include "chrome/common/url_constants.h"
53 #include "components/data_use_measurement/core/data_use_user_data.h" 53 #include "components/data_use_measurement/core/data_use_user_data.h"
54 #include "components/google/core/browser/google_util.h" 54 #include "components/google/core/browser/google_util.h"
55 #include "components/history/core/browser/history_service.h" 55 #include "components/history/core/browser/history_service.h"
56 #include "components/prefs/pref_service.h" 56 #include "components/prefs/pref_service.h"
57 #include "components/safe_browsing/common/safe_browsing_prefs.h" 57 #include "components/safe_browsing/common/safe_browsing_prefs.h"
58 #include "components/safe_browsing/common/safebrowsing_switches.h" 58 #include "components/safe_browsing/common/safebrowsing_switches.h"
59 #include "components/safe_browsing/csd.pb.h" 59 #include "components/safe_browsing/csd.pb.h"
60 #include "content/public/browser/browser_thread.h" 60 #include "content/public/browser/browser_thread.h"
61 #include "content/public/browser/download_item.h" 61 #include "content/public/browser/download_item.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 zip_analysis_start_time_ = base::TimeTicks::Now(); 713 zip_analysis_start_time_ = base::TimeTicks::Now();
714 // We give the zip analyzer a weak pointer to this object. Since the 714 // We give the zip analyzer a weak pointer to this object. Since the
715 // analyzer is refcounted, it might outlive the request. 715 // analyzer is refcounted, it might outlive the request.
716 analyzer_ = new SandboxedZipAnalyzer( 716 analyzer_ = new SandboxedZipAnalyzer(
717 item_->GetFullPath(), 717 item_->GetFullPath(),
718 base::Bind(&CheckClientDownloadRequest::OnZipAnalysisFinished, 718 base::Bind(&CheckClientDownloadRequest::OnZipAnalysisFinished,
719 weakptr_factory_.GetWeakPtr())); 719 weakptr_factory_.GetWeakPtr()));
720 analyzer_->Start(); 720 analyzer_->Start();
721 } 721 }
722 722
723 void OnZipAnalysisFinished(const zip_analyzer::Results& results) { 723 void OnZipAnalysisFinished(const ArchiveAnalyzerResults& results) {
724 DCHECK_CURRENTLY_ON(BrowserThread::UI); 724 DCHECK_CURRENTLY_ON(BrowserThread::UI);
725 DCHECK_EQ(ClientDownloadRequest::ZIPPED_EXECUTABLE, type_); 725 DCHECK_EQ(ClientDownloadRequest::ZIPPED_EXECUTABLE, type_);
726 if (!service_) 726 if (!service_)
727 return; 727 return;
728 728
729 // Even if !results.success, some of the zip may have been parsed. 729 // Even if !results.success, some of the zip may have been parsed.
730 // Some unzippers will successfully unpack archives that we cannot, 730 // Some unzippers will successfully unpack archives that we cannot,
731 // so we're lenient here. 731 // so we're lenient here.
732 archive_is_valid_ = 732 archive_is_valid_ =
733 (results.success ? ArchiveValid::VALID : ArchiveValid::INVALID); 733 (results.success ? ArchiveValid::VALID : ArchiveValid::INVALID);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 DCHECK_CURRENTLY_ON(BrowserThread::UI); 772 DCHECK_CURRENTLY_ON(BrowserThread::UI);
773 DCHECK(item_); 773 DCHECK(item_);
774 dmg_analyzer_ = new SandboxedDMGAnalyzer( 774 dmg_analyzer_ = new SandboxedDMGAnalyzer(
775 item_->GetFullPath(), 775 item_->GetFullPath(),
776 base::Bind(&CheckClientDownloadRequest::OnDmgAnalysisFinished, 776 base::Bind(&CheckClientDownloadRequest::OnDmgAnalysisFinished,
777 weakptr_factory_.GetWeakPtr())); 777 weakptr_factory_.GetWeakPtr()));
778 dmg_analyzer_->Start(); 778 dmg_analyzer_->Start();
779 dmg_analysis_start_time_ = base::TimeTicks::Now(); 779 dmg_analysis_start_time_ = base::TimeTicks::Now();
780 } 780 }
781 781
782 void OnDmgAnalysisFinished(const zip_analyzer::Results& results) { 782 void OnDmgAnalysisFinished(const ArchiveAnalyzerResults& results) {
783 DCHECK_CURRENTLY_ON(BrowserThread::UI); 783 DCHECK_CURRENTLY_ON(BrowserThread::UI);
784 DCHECK_EQ(ClientDownloadRequest::MAC_EXECUTABLE, type_); 784 DCHECK_EQ(ClientDownloadRequest::MAC_EXECUTABLE, type_);
785 if (!service_) 785 if (!service_)
786 return; 786 return;
787 787
788 // Even if !results.success, some of the DMG may have been parsed. 788 // Even if !results.success, some of the DMG may have been parsed.
789 archive_is_valid_ = 789 archive_is_valid_ =
790 (results.success ? ArchiveValid::VALID : ArchiveValid::INVALID); 790 (results.success ? ArchiveValid::VALID : ArchiveValid::INVALID);
791 archived_executable_ = results.has_executable; 791 archived_executable_ = results.has_executable;
792 archived_binary_.CopyFrom(results.archived_binary); 792 archived_binary_.CopyFrom(results.archived_binary);
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 out_request->mutable_referrer_chain()); 1991 out_request->mutable_referrer_chain());
1992 UMA_HISTOGRAM_COUNTS_100( 1992 UMA_HISTOGRAM_COUNTS_100(
1993 "SafeBrowsing.ReferrerURLChainSize.PPAPIDownloadAttribution", 1993 "SafeBrowsing.ReferrerURLChainSize.PPAPIDownloadAttribution",
1994 out_request->referrer_chain_size()); 1994 out_request->referrer_chain_size());
1995 UMA_HISTOGRAM_ENUMERATION( 1995 UMA_HISTOGRAM_ENUMERATION(
1996 "SafeBrowsing.ReferrerAttributionResult.PPAPIDownloadAttribution", result, 1996 "SafeBrowsing.ReferrerAttributionResult.PPAPIDownloadAttribution", result,
1997 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX); 1997 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX);
1998 } 1998 }
1999 1999
2000 } // namespace safe_browsing 2000 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698