Commit 33c81849 authored by btapiz@gmail.com's avatar btapiz@gmail.com

Clean-up coding style

BUG=
R=shess@chromium.org

Review URL: https://codereview.chromium.org/313073002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275391 0039d316-1c4b-4281-b951-d872f2087c98
parent e290ecde
...@@ -151,6 +151,7 @@ Ion Rosca <rosca@adobe.com> ...@@ -151,6 +151,7 @@ Ion Rosca <rosca@adobe.com>
J. Ryan Stinnett <jryans@chromium.org> J. Ryan Stinnett <jryans@chromium.org>
Jacob Mandelson <jacob@mandelson.org> Jacob Mandelson <jacob@mandelson.org>
Jaehun Lim <ljaehun.lim@samsung.com> Jaehun Lim <ljaehun.lim@samsung.com>
Jaekyeom Kim <btapiz@gmail.com>
Jaime Soriano Pastor <jsorianopastor@gmail.com> Jaime Soriano Pastor <jsorianopastor@gmail.com>
Jake Helfert <jake@helfert.us> Jake Helfert <jake@helfert.us>
Jakob Weigert <jakob.j.w@googlemail.com> Jakob Weigert <jakob.j.w@googlemail.com>
......
...@@ -69,7 +69,7 @@ class MockClientSideDetectionHost : public ClientSideDetectionHost { ...@@ -69,7 +69,7 @@ class MockClientSideDetectionHost : public ClientSideDetectionHost {
set_safe_browsing_managers(NULL, database_manager); set_safe_browsing_managers(NULL, database_manager);
} }
virtual ~MockClientSideDetectionHost() {}; virtual ~MockClientSideDetectionHost() {}
MOCK_METHOD1(IsBadIpAddress, bool(const std::string&)); MOCK_METHOD1(IsBadIpAddress, bool(const std::string&));
}; };
......
...@@ -44,8 +44,8 @@ using content::WebContents; ...@@ -44,8 +44,8 @@ using content::WebContents;
namespace safe_browsing { namespace safe_browsing {
const int ClientSideDetectionHost::kMaxUrlsPerIP = 20; const size_t ClientSideDetectionHost::kMaxUrlsPerIP = 20;
const int ClientSideDetectionHost::kMaxIPsPerBrowse = 200; const size_t ClientSideDetectionHost::kMaxIPsPerBrowse = 200;
const char kSafeBrowsingMatchKey[] = "safe_browsing_match"; const char kSafeBrowsingMatchKey[] = "safe_browsing_match";
...@@ -688,12 +688,12 @@ void ClientSideDetectionHost::UpdateIPUrlMap( ...@@ -688,12 +688,12 @@ void ClientSideDetectionHost::UpdateIPUrlMap(
IPUrlMap::iterator it = browse_info_->ips.find(ip); IPUrlMap::iterator it = browse_info_->ips.find(ip);
if (it == browse_info_->ips.end()) { if (it == browse_info_->ips.end()) {
if (int(browse_info_->ips.size()) < kMaxIPsPerBrowse) { if (browse_info_->ips.size() < kMaxIPsPerBrowse) {
std::vector<IPUrlInfo> url_infos; std::vector<IPUrlInfo> url_infos;
url_infos.push_back(IPUrlInfo(url, method, referrer, resource_type)); url_infos.push_back(IPUrlInfo(url, method, referrer, resource_type));
browse_info_->ips.insert(make_pair(ip, url_infos)); browse_info_->ips.insert(make_pair(ip, url_infos));
} }
} else if (int(it->second.size()) < kMaxUrlsPerIP) { } else if (it->second.size() < kMaxUrlsPerIP) {
it->second.push_back(IPUrlInfo(url, method, referrer, resource_type)); it->second.push_back(IPUrlInfo(url, method, referrer, resource_type));
} }
} }
......
...@@ -163,9 +163,9 @@ class ClientSideDetectionHost : public content::WebContentsObserver, ...@@ -163,9 +163,9 @@ class ClientSideDetectionHost : public content::WebContentsObserver,
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
// Max number of ips we save for each browse // Max number of ips we save for each browse
static const int kMaxIPsPerBrowse; static const size_t kMaxIPsPerBrowse;
// Max number of urls we report for each malware IP. // Max number of urls we report for each malware IP.
static const int kMaxUrlsPerIP; static const size_t kMaxUrlsPerIP;
bool should_extract_malware_features_; bool should_extract_malware_features_;
bool should_classify_for_malware_; bool should_classify_for_malware_;
......
...@@ -111,7 +111,7 @@ void EmptyUrlCheckCallback(bool processed) { ...@@ -111,7 +111,7 @@ void EmptyUrlCheckCallback(bool processed) {
class MockClientSideDetectionService : public ClientSideDetectionService { class MockClientSideDetectionService : public ClientSideDetectionService {
public: public:
MockClientSideDetectionService() : ClientSideDetectionService(NULL) {} MockClientSideDetectionService() : ClientSideDetectionService(NULL) {}
virtual ~MockClientSideDetectionService() {}; virtual ~MockClientSideDetectionService() {}
MOCK_METHOD2(SendClientReportPhishingRequest, MOCK_METHOD2(SendClientReportPhishingRequest,
void(ClientPhishingRequest*, void(ClientPhishingRequest*,
...@@ -989,7 +989,7 @@ TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckMimeType) { ...@@ -989,7 +989,7 @@ TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckMimeType) {
GURL url("http://host2.com/image.jpg"); GURL url("http://host2.com/image.jpg");
rvh_tester()->SetContentsMimeType("image/jpeg"); rvh_tester()->SetContentsMimeType("image/jpeg");
ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse, ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse,
&kFalse, &kFalse,&kFalse, &kFalse); &kFalse, &kFalse, &kFalse, &kFalse);
NavigateAndCommit(url); NavigateAndCommit(url);
WaitAndCheckPreClassificationChecks(); WaitAndCheckPreClassificationChecks();
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/browser/safe_browsing/client_side_detection_service.h" #include "chrome/browser/safe_browsing/client_side_detection_service.h"
#include <algorithm>
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/browser/safe_browsing/download_feedback_service.h" #include "chrome/browser/safe_browsing/download_feedback_service.h"
#include <vector>
#include "base/file_util.h" #include "base/file_util.h"
#include "base/files/scoped_temp_dir.h" #include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h" #include "base/run_loop.h"
...@@ -163,6 +165,7 @@ class DownloadFeedbackServiceTest : public testing::Test { ...@@ -163,6 +165,7 @@ class DownloadFeedbackServiceTest : public testing::Test {
size_t num_feedbacks() const { size_t num_feedbacks() const {
return download_feedback_factory_.num_feedbacks(); return download_feedback_factory_.num_feedbacks();
} }
protected: protected:
base::ScopedTempDir temp_dir_; base::ScopedTempDir temp_dir_;
content::TestBrowserThreadBundle thread_bundle_; content::TestBrowserThreadBundle thread_bundle_;
...@@ -170,7 +173,6 @@ class DownloadFeedbackServiceTest : public testing::Test { ...@@ -170,7 +173,6 @@ class DownloadFeedbackServiceTest : public testing::Test {
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_;
FakeDownloadFeedbackFactory download_feedback_factory_; FakeDownloadFeedbackFactory download_feedback_factory_;
}; };
TEST_F(DownloadFeedbackServiceTest, MaybeStorePingsForDownload) { TEST_F(DownloadFeedbackServiceTest, MaybeStorePingsForDownload) {
......
...@@ -101,10 +101,10 @@ class FakeSafeBrowsingService : public SafeBrowsingService { ...@@ -101,10 +101,10 @@ class FakeSafeBrowsingService : public SafeBrowsingService {
class MockBinaryFeatureExtractor : public BinaryFeatureExtractor { class MockBinaryFeatureExtractor : public BinaryFeatureExtractor {
public: public:
MockBinaryFeatureExtractor() {} MockBinaryFeatureExtractor() {}
MOCK_METHOD2(CheckSignature, void (const base::FilePath&, MOCK_METHOD2(CheckSignature, void(const base::FilePath&,
ClientDownloadRequest_SignatureInfo*)); ClientDownloadRequest_SignatureInfo*));
MOCK_METHOD2(ExtractImageHeaders, void (const base::FilePath&, MOCK_METHOD2(ExtractImageHeaders, void(const base::FilePath&,
ClientDownloadRequest_ImageHeaders*)); ClientDownloadRequest_ImageHeaders*));
protected: protected:
virtual ~MockBinaryFeatureExtractor() {} virtual ~MockBinaryFeatureExtractor() {}
......
...@@ -67,7 +67,7 @@ void MalwareDetailsCacheCollector::OpenEntry() { ...@@ -67,7 +67,7 @@ void MalwareDetailsCacheCollector::OpenEntry() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DVLOG(1) << "OpenEntry"; DVLOG(1) << "OpenEntry";
if (resources_it_ == resources_->end()) { // We are done. if (resources_it_ == resources_->end()) {
AllDone(true); AllDone(true);
return; return;
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "chrome/browser/safe_browsing/prefix_set.h" #include "chrome/browser/safe_browsing/prefix_set.h"
#include <algorithm> #include <algorithm>
#include <math.h>
#include "base/file_util.h" #include "base/file_util.h"
#include "base/files/scoped_file.h" #include "base/files/scoped_file.h"
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#ifndef CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ #ifndef CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_
#define CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_ #define CHROME_BROWSER_SAFE_BROWSING_PREFIX_SET_H_
#include <utility>
#include <vector> #include <vector>
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
...@@ -103,7 +104,7 @@ class PrefixSet { ...@@ -103,7 +104,7 @@ class PrefixSet {
static const size_t kMaxRun = 100; static const size_t kMaxRun = 100;
// Helpers to make |index_| easier to deal with. // Helpers to make |index_| easier to deal with.
typedef std::pair<SBPrefix,uint32> IndexPair; typedef std::pair<SBPrefix, uint32> IndexPair;
typedef std::vector<IndexPair> IndexVector; typedef std::vector<IndexPair> IndexVector;
static bool PrefixLess(const IndexPair& a, const IndexPair& b); static bool PrefixLess(const IndexPair& a, const IndexPair& b);
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <set>
#include <string>
#include "base/file_util.h" #include "base/file_util.h"
#include "base/files/scoped_file.h" #include "base/files/scoped_file.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment