diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 02:52:59 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 02:52:59 +0000 |
commit | 7091808a3c67deefb60a5b76a5be33ee0e094f27 (patch) | |
tree | eddf7672ac2cabc0e462df93c8976f8f8e12e084 /chrome/browser/safe_browsing | |
parent | 957cfc92e1ffd45ffec3a33a664f6d94badf4ecd (diff) | |
download | chromium_src-7091808a3c67deefb60a5b76a5be33ee0e094f27.zip chromium_src-7091808a3c67deefb60a5b76a5be33ee0e094f27.tar.gz chromium_src-7091808a3c67deefb60a5b76a5be33ee0e094f27.tar.bz2 |
Rename SignatureUtil to BinaryFeatureExtractor in anticipation of it taking on more work.
BUG=None
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/209333010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r-- | chrome/browser/safe_browsing/binary_feature_extractor.h | 41 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/binary_feature_extractor_posix.cc (renamed from chrome/browser/safe_browsing/signature_util_posix.cc) | 10 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/binary_feature_extractor_win.cc (renamed from chrome/browser/safe_browsing/signature_util_win.cc) | 10 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/binary_feature_extractor_win_unittest.cc (renamed from chrome/browser/safe_browsing/signature_util_win_unittest.cc) | 26 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/download_protection_service.cc | 23 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/download_protection_service.h | 6 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/download_protection_service_unittest.cc | 46 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/signature_util.h | 40 |
8 files changed, 106 insertions, 96 deletions
diff --git a/chrome/browser/safe_browsing/binary_feature_extractor.h b/chrome/browser/safe_browsing/binary_feature_extractor.h new file mode 100644 index 0000000..bbf9b0d --- /dev/null +++ b/chrome/browser/safe_browsing/binary_feature_extractor.h @@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Utility functions to extract file features for malicious binary detection. +// Each platform has its own implementation of this class. + +#ifndef CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_ +#define CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_ + +#include "base/basictypes.h" +#include "base/memory/ref_counted.h" + +namespace base { +class FilePath; +} + +namespace safe_browsing { +class ClientDownloadRequest_SignatureInfo; + +class BinaryFeatureExtractor + : public base::RefCountedThreadSafe<BinaryFeatureExtractor> { + public: + BinaryFeatureExtractor(); + + // Fills in the DownloadRequest_SignatureInfo for the given file path. + // This method may be called on any thread. + virtual void CheckSignature( + const base::FilePath& file_path, + ClientDownloadRequest_SignatureInfo* signature_info); + + protected: + friend class base::RefCountedThreadSafe<BinaryFeatureExtractor>; + virtual ~BinaryFeatureExtractor(); + + private: + DISALLOW_COPY_AND_ASSIGN(BinaryFeatureExtractor); +}; +} // namespace safe_browsing + +#endif // CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_ diff --git a/chrome/browser/safe_browsing/signature_util_posix.cc b/chrome/browser/safe_browsing/binary_feature_extractor_posix.cc index 7a98a54..a1dafc5 100644 --- a/chrome/browser/safe_browsing/signature_util_posix.cc +++ b/chrome/browser/safe_browsing/binary_feature_extractor_posix.cc @@ -1,19 +1,19 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // This is a stub for the code signing utilities on Mac and Linux. // It should eventually be replaced with a real implementation. -#include "chrome/browser/safe_browsing/signature_util.h" +#include "chrome/browser/safe_browsing/binary_feature_extractor.h" namespace safe_browsing { -SignatureUtil::SignatureUtil() {} +BinaryFeatureExtractor::BinaryFeatureExtractor() {} -SignatureUtil::~SignatureUtil() {} +BinaryFeatureExtractor::~BinaryFeatureExtractor() {} -void SignatureUtil::CheckSignature( +void BinaryFeatureExtractor::CheckSignature( const base::FilePath& file_path, ClientDownloadRequest_SignatureInfo* signature_info) {} diff --git a/chrome/browser/safe_browsing/signature_util_win.cc b/chrome/browser/safe_browsing/binary_feature_extractor_win.cc index b512fca..243b497 100644 --- a/chrome/browser/safe_browsing/signature_util_win.cc +++ b/chrome/browser/safe_browsing/binary_feature_extractor_win.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/safe_browsing/signature_util.h" +#include "chrome/browser/safe_browsing/binary_feature_extractor.h" #include <windows.h> #include <softpub.h> @@ -16,11 +16,11 @@ namespace safe_browsing { -SignatureUtil::SignatureUtil() {} +BinaryFeatureExtractor::BinaryFeatureExtractor() {} -SignatureUtil::~SignatureUtil() {} +BinaryFeatureExtractor::~BinaryFeatureExtractor() {} -void SignatureUtil::CheckSignature( +void BinaryFeatureExtractor::CheckSignature( const base::FilePath& file_path, ClientDownloadRequest_SignatureInfo* signature_info) { VLOG(2) << "Checking signature for " << file_path.value(); diff --git a/chrome/browser/safe_browsing/signature_util_win_unittest.cc b/chrome/browser/safe_browsing/binary_feature_extractor_win_unittest.cc index 294a8e9..31a4b41 100644 --- a/chrome/browser/safe_browsing/signature_util_win_unittest.cc +++ b/chrome/browser/safe_browsing/binary_feature_extractor_win_unittest.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/safe_browsing/signature_util.h" +#include "chrome/browser/safe_browsing/binary_feature_extractor.h" #include <string> #include <vector> @@ -18,7 +18,7 @@ namespace safe_browsing { -class SignatureUtilWinTest : public testing::Test { +class BinaryFeatureExtractorWinTest : public testing::Test { protected: virtual void SetUp() { base::FilePath source_path; @@ -46,9 +46,10 @@ class SignatureUtilWinTest : public testing::Test { base::FilePath testdata_path_; }; -TEST_F(SignatureUtilWinTest, UntrustedSignedBinary) { +TEST_F(BinaryFeatureExtractorWinTest, UntrustedSignedBinary) { // signed.exe is signed by an untrusted root CA. - scoped_refptr<SignatureUtil> signature_util(new SignatureUtil()); + scoped_refptr<BinaryFeatureExtractor> signature_util( + new BinaryFeatureExtractor()); ClientDownloadRequest_SignatureInfo signature_info; signature_util->CheckSignature(testdata_path_.Append(L"signed.exe"), &signature_info); @@ -63,9 +64,10 @@ TEST_F(SignatureUtilWinTest, UntrustedSignedBinary) { EXPECT_FALSE(signature_info.trusted()); } -TEST_F(SignatureUtilWinTest, TrustedBinary) { +TEST_F(BinaryFeatureExtractorWinTest, TrustedBinary) { // wow_helper.exe is signed using Google's signing certifiacte. - scoped_refptr<SignatureUtil> signature_util(new SignatureUtil()); + scoped_refptr<BinaryFeatureExtractor> signature_util( + new BinaryFeatureExtractor()); ClientDownloadRequest_SignatureInfo signature_info; signature_util->CheckSignature(testdata_path_.Append(L"wow_helper.exe"), &signature_info); @@ -83,9 +85,10 @@ TEST_F(SignatureUtilWinTest, TrustedBinary) { EXPECT_TRUE(signature_info.trusted()); } -TEST_F(SignatureUtilWinTest, UnsignedBinary) { +TEST_F(BinaryFeatureExtractorWinTest, UnsignedBinary) { // unsigned.exe has no signature information. - scoped_refptr<SignatureUtil> signature_util(new SignatureUtil()); + scoped_refptr<BinaryFeatureExtractor> signature_util( + new BinaryFeatureExtractor()); ClientDownloadRequest_SignatureInfo signature_info; signature_util->CheckSignature(testdata_path_.Append(L"unsigned.exe"), &signature_info); @@ -93,9 +96,10 @@ TEST_F(SignatureUtilWinTest, UnsignedBinary) { EXPECT_FALSE(signature_info.has_trusted()); } -TEST_F(SignatureUtilWinTest, NonExistentBinary) { +TEST_F(BinaryFeatureExtractorWinTest, NonExistentBinary) { // Test a file that doesn't exist. - scoped_refptr<SignatureUtil> signature_util(new SignatureUtil()); + scoped_refptr<BinaryFeatureExtractor> signature_util( + new BinaryFeatureExtractor()); ClientDownloadRequest_SignatureInfo signature_info; signature_util->CheckSignature(testdata_path_.Append(L"doesnotexist.exe"), &signature_info); diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc index 8a9f6e1..26d79f5 100644 --- a/chrome/browser/safe_browsing/download_protection_service.cc +++ b/chrome/browser/safe_browsing/download_protection_service.cc @@ -18,10 +18,10 @@ #include "base/strings/stringprintf.h" #include "base/threading/sequenced_worker_pool.h" #include "base/time/time.h" +#include "chrome/browser/safe_browsing/binary_feature_extractor.h" #include "chrome/browser/safe_browsing/download_feedback_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/safe_browsing/sandboxed_zip_analyzer.h" -#include "chrome/browser/safe_browsing/signature_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/common/safe_browsing/csd.pb.h" @@ -280,14 +280,14 @@ class DownloadProtectionService::CheckClientDownloadRequest const CheckDownloadCallback& callback, DownloadProtectionService* service, const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, - SignatureUtil* signature_util) + BinaryFeatureExtractor* binary_feature_extractor) : item_(item), url_chain_(item->GetUrlChain()), referrer_url_(item->GetReferrerUrl()), zipped_executable_(false), callback_(callback), service_(service), - signature_util_(signature_util), + binary_feature_extractor_(binary_feature_extractor), database_manager_(database_manager), pingback_enabled_(service_->enabled()), finished_(false), @@ -335,7 +335,7 @@ class DownloadProtectionService::CheckClientDownloadRequest } else { DCHECK(!download_protection_util::IsArchiveFile( item_->GetTargetFilePath())); - StartExtractSignatureFeatures(); + StartExtractFileFeatures(); } } @@ -496,21 +496,21 @@ class DownloadProtectionService::CheckClientDownloadRequest base::Bind(&CheckClientDownloadRequest::StartTimeout, this)); } - void StartExtractSignatureFeatures() { + void StartExtractFileFeatures() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(item_); // Called directly from Start(), item should still exist. // Since we do blocking I/O, offload this to a worker thread. // The task does not need to block shutdown. BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior( FROM_HERE, - base::Bind(&CheckClientDownloadRequest::ExtractSignatureFeatures, + base::Bind(&CheckClientDownloadRequest::ExtractFileFeatures, this, item_->GetFullPath()), base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); } - void ExtractSignatureFeatures(const base::FilePath& file_path) { + void ExtractFileFeatures(const base::FilePath& file_path) { base::TimeTicks start_time = base::TimeTicks::Now(); - signature_util_->CheckSignature(file_path, &signature_info_); + binary_feature_extractor_->CheckSignature(file_path, &signature_info_); bool is_signed = (signature_info_.certificate_chain_size() > 0); if (is_signed) { VLOG(2) << "Downloaded a signed binary: " << file_path.value(); @@ -753,7 +753,7 @@ class DownloadProtectionService::CheckClientDownloadRequest CheckDownloadCallback callback_; // Will be NULL if the request has been canceled. DownloadProtectionService* service_; - scoped_refptr<SignatureUtil> signature_util_; + scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor_; scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; const bool pingback_enabled_; scoped_ptr<net::URLFetcher> fetcher_; @@ -773,7 +773,7 @@ DownloadProtectionService::DownloadProtectionService( net::URLRequestContextGetter* request_context_getter) : request_context_getter_(request_context_getter), enabled_(false), - signature_util_(new SignatureUtil()), + binary_feature_extractor_(new BinaryFeatureExtractor()), download_request_timeout_ms_(kDownloadRequestTimeoutMs), feedback_service_(new DownloadFeedbackService( request_context_getter, BrowserThread::GetBlockingPool())) { @@ -805,7 +805,8 @@ void DownloadProtectionService::CheckClientDownload( const CheckDownloadCallback& callback) { scoped_refptr<CheckClientDownloadRequest> request( new CheckClientDownloadRequest(item, callback, this, - database_manager_, signature_util_.get())); + database_manager_, + binary_feature_extractor_.get())); download_requests_.insert(request); request->Start(); } diff --git a/chrome/browser/safe_browsing/download_protection_service.h b/chrome/browser/safe_browsing/download_protection_service.h index 609fdcf..0b5f69f 100644 --- a/chrome/browser/safe_browsing/download_protection_service.h +++ b/chrome/browser/safe_browsing/download_protection_service.h @@ -34,7 +34,7 @@ class X509Certificate; namespace safe_browsing { class DownloadFeedbackService; -class SignatureUtil; +class BinaryFeatureExtractor; // This class provides an asynchronous API to check whether a particular // client download is malicious or not. @@ -190,8 +190,8 @@ class DownloadProtectionService { // Keeps track of the state of the service. bool enabled_; - // SignatureUtil object, may be overridden for testing. - scoped_refptr<SignatureUtil> signature_util_; + // BinaryFeatureExtractor object, may be overridden for testing. + scoped_refptr<BinaryFeatureExtractor> binary_feature_extractor_; int64 download_request_timeout_ms_; diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index ee82e27..bfd903e 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -20,10 +20,10 @@ #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/threading/sequenced_worker_pool.h" +#include "chrome/browser/safe_browsing/binary_feature_extractor.h" #include "chrome/browser/safe_browsing/database_manager.h" #include "chrome/browser/safe_browsing/download_feedback_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" -#include "chrome/browser/safe_browsing/signature_util.h" #include "chrome/common/safe_browsing/csd.pb.h" #include "content/public/test/mock_download_item.h" #include "content/public/test/test_browser_thread_bundle.h" @@ -95,17 +95,17 @@ class FakeSafeBrowsingService : public SafeBrowsingService { DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingService); }; -class MockSignatureUtil : public SignatureUtil { +class MockBinaryFeatureExtractor : public BinaryFeatureExtractor { public: - MockSignatureUtil() {} + MockBinaryFeatureExtractor() {} MOCK_METHOD2(CheckSignature, void (const base::FilePath&, ClientDownloadRequest_SignatureInfo*)); protected: - virtual ~MockSignatureUtil() {} + virtual ~MockBinaryFeatureExtractor() {} private: - DISALLOW_COPY_AND_ASSIGN(MockSignatureUtil); + DISALLOW_COPY_AND_ASSIGN(MockBinaryFeatureExtractor); }; } // namespace @@ -161,9 +161,9 @@ class DownloadProtectionServiceTest : public testing::Test { // to test that we're on the correct thread work. sb_service_ = new StrictMock<FakeSafeBrowsingService>(); sb_service_->Initialize(); - signature_util_ = new StrictMock<MockSignatureUtil>(); + binary_feature_extractor_ = new StrictMock<MockBinaryFeatureExtractor>(); download_service_ = sb_service_->download_protection_service(); - download_service_->signature_util_ = signature_util_; + download_service_->binary_feature_extractor_ = binary_feature_extractor_; download_service_->SetEnabled(true); base::RunLoop().RunUntilIdle(); has_result_ = false; @@ -311,7 +311,7 @@ class DownloadProtectionServiceTest : public testing::Test { protected: scoped_refptr<FakeSafeBrowsingService> sb_service_; - scoped_refptr<MockSignatureUtil> signature_util_; + scoped_refptr<MockBinaryFeatureExtractor> binary_feature_extractor_; DownloadProtectionService* download_service_; DownloadProtectionService::DownloadCheckResult result_; bool has_result_; @@ -383,7 +383,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadWhitelistedUrl) { EXPECT_CALL(item, GetReceivedBytes()).WillRepeatedly(Return(100)); EXPECT_CALL(item, HasUserGesture()).WillRepeatedly(Return(true)); EXPECT_CALL(item, GetRemoteAddress()).WillRepeatedly(Return("")); - EXPECT_CALL(*signature_util_.get(), CheckSignature(a_tmp, _)).Times(4); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(a_tmp, _)) + .Times(4); // We should not get whilelist checks for other URLs than specified below. EXPECT_CALL(*sb_service_->mock_database_manager(), @@ -473,7 +474,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(a_tmp, _)); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(a_tmp, _)); download_service_->CheckClientDownload( &item, @@ -515,7 +516,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) { EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(a_tmp, _)).Times(6); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(a_tmp, _)) + .Times(6); download_service_->CheckClientDownload( &item, @@ -659,7 +661,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadHTTPS) { EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(a_tmp, _)).Times(1); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(a_tmp, _)) + .Times(1); download_service_->CheckClientDownload( &item, @@ -722,7 +725,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { MessageLoop::current()->Run(); EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); Mock::VerifyAndClearExpectations(sb_service_.get()); - Mock::VerifyAndClearExpectations(signature_util_.get()); + Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); // Now check with an executable in the zip file as well. ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile( @@ -740,7 +743,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { base::Unretained(this))); MessageLoop::current()->Run(); EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); - Mock::VerifyAndClearExpectations(signature_util_.get()); + Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); // If the response is dangerous the result should also be marked as // dangerous. @@ -760,7 +763,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { #else EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); #endif - Mock::VerifyAndClearExpectations(signature_util_.get()); + Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); } TEST_F(DownloadProtectionServiceTest, CheckClientDownloadCorruptZip) { @@ -797,7 +800,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadCorruptZip) { MessageLoop::current()->Run(); EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); Mock::VerifyAndClearExpectations(sb_service_.get()); - Mock::VerifyAndClearExpectations(signature_util_.get()); + Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); } TEST_F(DownloadProtectionServiceTest, CheckClientCrxDownloadSuccess) { @@ -835,7 +838,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientCrxDownloadSuccess) { EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(a_tmp, _)).Times(1); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(a_tmp, _)) + .Times(1); EXPECT_FALSE(download_service_->IsSupportedDownload(item, a_crx)); download_service_->CheckClientDownload( @@ -873,7 +877,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadValidateRequest) { EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(tmp_path, _)) + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)) .WillOnce(SetCertificateContents("dummy cert data")); download_service_->CheckClientDownload( &item, @@ -950,7 +954,7 @@ TEST_F(DownloadProtectionServiceTest, EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(tmp_path, _)); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)); download_service_->CheckClientDownload( &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, @@ -1082,7 +1086,7 @@ TEST_F(DownloadProtectionServiceTest, TestDownloadRequestTimeout) { EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(tmp_path, _)); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)); download_service_->download_request_timeout_ms_ = 10; download_service_->CheckClientDownload( @@ -1123,7 +1127,7 @@ TEST_F(DownloadProtectionServiceTest, TestDownloadItemDestroyed) { EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) .WillRepeatedly(Return(false)); - EXPECT_CALL(*signature_util_.get(), CheckSignature(tmp_path, _)); + EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)); download_service_->CheckClientDownload( &item, diff --git a/chrome/browser/safe_browsing/signature_util.h b/chrome/browser/safe_browsing/signature_util.h deleted file mode 100644 index 00aef61..0000000 --- a/chrome/browser/safe_browsing/signature_util.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Utility functions to check executable signatures for malicious binary -// detection. Each platform has its own implementation of this class. - -#ifndef CHROME_BROWSER_SAFE_BROWSING_SIGNATURE_UTIL_H_ -#define CHROME_BROWSER_SAFE_BROWSING_SIGNATURE_UTIL_H_ - -#include "base/basictypes.h" -#include "base/memory/ref_counted.h" - -namespace base { -class FilePath; -} - -namespace safe_browsing { -class ClientDownloadRequest_SignatureInfo; - -class SignatureUtil : public base::RefCountedThreadSafe<SignatureUtil> { - public: - SignatureUtil(); - - // Fills in the DownloadRequest_SignatureInfo for the given file path. - // This method may be called on any thread. - virtual void CheckSignature( - const base::FilePath& file_path, - ClientDownloadRequest_SignatureInfo* signature_info); - - protected: - friend class base::RefCountedThreadSafe<SignatureUtil>; - virtual ~SignatureUtil(); - - private: - DISALLOW_COPY_AND_ASSIGN(SignatureUtil); -}; -} // namespace safe_browsing - -#endif // CHROME_BROWSER_SAFE_BROWSING_SIGNATURE_UTIL_H_ |