summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/browser_feature_extractor.cc4
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host_unittest.cc6
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service_unittest.cc7
-rw-r--r--chrome/browser/safe_browsing/download_protection_service_unittest.cc2
-rw-r--r--chrome/browser/safe_browsing/malware_details.cc14
-rw-r--r--chrome/browser/safe_browsing/ping_manager.cc2
-rw-r--r--chrome/browser/safe_browsing/protocol_manager_unittest.cc26
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.cc15
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_util.cc15
-rw-r--r--chrome/browser/safe_browsing/two_phase_uploader.cc4
10 files changed, 46 insertions, 49 deletions
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc
index a40c66d..142f375 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc
@@ -208,8 +208,8 @@ void BrowserFeatureExtractor::ExtractFeatures(const BrowseInfo* info,
// 2) The first url on the same host as the candidate url (assuming that
// it's different from the candidate url).
if (url_index != -1) {
- AddNavigationFeatures(
- std::string(), controller, url_index, info->url_redirects, request);
+ AddNavigationFeatures("", controller, url_index, info->url_redirects,
+ request);
}
if (first_host_index != -1) {
AddNavigationFeatures(features::kHostPrefix,
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index ec8b4e3..74ec857 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -635,11 +635,11 @@ TEST_F(ClientSideDetectionHostTest, UpdateIPHostMap) {
BrowseInfo* browse_info = GetBrowseInfo();
// Empty IP or host are skipped
- UpdateIPHostMap("250.10.10.10", std::string());
+ UpdateIPHostMap("250.10.10.10", "");
ASSERT_EQ(0U, browse_info->ips.size());
- UpdateIPHostMap(std::string(), "google.com/");
+ UpdateIPHostMap("", "google.com/");
ASSERT_EQ(0U, browse_info->ips.size());
- UpdateIPHostMap(std::string(), std::string());
+ UpdateIPHostMap("", "");
ASSERT_EQ(0U, browse_info->ips.size());
std::set<std::string> expected_hosts;
diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
index ed533604..f5fd98b 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
@@ -252,8 +252,9 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
Mock::VerifyAndClearExpectations(&service);
// Empty model file.
- SetModelFetchResponse(std::string(), true /* success */);
- EXPECT_CALL(service, EndFetchModel(ClientSideDetectionService::MODEL_EMPTY))
+ SetModelFetchResponse("", true /* success */);
+ EXPECT_CALL(service, EndFetchModel(
+ ClientSideDetectionService::MODEL_EMPTY))
.WillOnce(QuitCurrentMessageLoop());
service.StartFetchModel();
msg_loop_.Run(); // EndFetchModel will quit the message loop.
@@ -575,7 +576,7 @@ TEST_F(ClientSideDetectionServiceTest, IsBadIpAddress) {
ClientSideDetectionService::SetBadSubnets(
model, &(csd_service_->bad_subnets_));
EXPECT_FALSE(csd_service_->IsBadIpAddress("blabla"));
- EXPECT_FALSE(csd_service_->IsBadIpAddress(std::string()));
+ EXPECT_FALSE(csd_service_->IsBadIpAddress(""));
EXPECT_TRUE(csd_service_->IsBadIpAddress(
"2620:0:1000:3103:21a:a0ff:fe10:786e"));
diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
index af98856..e8da2ee 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -390,7 +390,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) {
net::FakeURLFetcherFactory factory(NULL);
// HTTP request will fail.
factory.SetFakeResponse(
- DownloadProtectionService::GetDownloadRequestUrl(), std::string(), false);
+ DownloadProtectionService::GetDownloadRequestUrl(), "", false);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc
index 7eb336d..41cf690 100644
--- a/chrome/browser/safe_browsing/malware_details.cc
+++ b/chrome/browser/safe_browsing/malware_details.cc
@@ -178,16 +178,16 @@ void MalwareDetails::StartCollection() {
}
// Add the nodes, starting from the page url.
- AddUrl(page_url, GURL(), std::string(), NULL);
+ AddUrl(page_url, GURL(), "", NULL);
// Add the resource_url and its original url, if non-empty and different.
if (!resource_.original_url.is_empty() &&
resource_.url != resource_.original_url) {
// Add original_url, as the parent of resource_url.
- AddUrl(resource_.original_url, GURL(), std::string(), NULL);
- AddUrl(resource_.url, resource_.original_url, std::string(), NULL);
+ AddUrl(resource_.original_url, GURL(), "", NULL);
+ AddUrl(resource_.url, resource_.original_url, "", NULL);
} else {
- AddUrl(resource_.url, GURL(), std::string(), NULL);
+ AddUrl(resource_.url, GURL(), "", NULL);
}
// Add the redirect urls, if non-empty. The redirect urls do not include the
@@ -201,13 +201,13 @@ void MalwareDetails::StartCollection() {
}
// Set the previous redirect url as the parent of the next one
for (unsigned int i = 0; i < resource_.redirect_urls.size(); ++i) {
- AddUrl(resource_.redirect_urls[i], parent_url, std::string(), NULL);
+ AddUrl(resource_.redirect_urls[i], parent_url, "", NULL);
parent_url = resource_.redirect_urls[i];
}
// Add the referrer url.
if (nav_entry && !referrer_url.is_empty()) {
- AddUrl(referrer_url, GURL(), std::string(), NULL);
+ AddUrl(referrer_url, GURL(), "", NULL);
}
// Get URLs of frames, scripts etc from the DOM.
@@ -287,7 +287,7 @@ void MalwareDetails::OnRedirectionCollectionReady() {
void MalwareDetails::AddRedirectUrlList(const std::vector<GURL>& urls) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
for (size_t i = 0; i < urls.size()-1; ++i) {
- AddUrl(urls[i], urls[i + 1], std::string(), NULL);
+ AddUrl(urls[i], urls[i+1], "", NULL);
}
}
diff --git a/chrome/browser/safe_browsing/ping_manager.cc b/chrome/browser/safe_browsing/ping_manager.cc
index 56580d00..6e73985 100644
--- a/chrome/browser/safe_browsing/ping_manager.cc
+++ b/chrome/browser/safe_browsing/ping_manager.cc
@@ -113,7 +113,7 @@ GURL SafeBrowsingPingManager::SafeBrowsingHitUrl(
threat_type == SB_THREAT_TYPE_BINARY_MALWARE_HASH ||
threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL);
std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl(
- url_prefix_, "report", client_name_, version_, std::string());
+ url_prefix_, "report", client_name_, version_, "");
std::string threat_list = "none";
switch (threat_type) {
case SB_THREAT_TYPE_URL_MALWARE:
diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
index ca89ce5..0bd9c3a 100644
--- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
@@ -378,7 +378,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, ExistingDatabase) {
url_fetcher->set_status(net::URLRequestStatus());
url_fetcher->set_response_code(200);
- url_fetcher->SetResponseString(std::string());
+ url_fetcher->SetResponseString("");
url_fetcher->delegate()->OnURLFetchComplete(url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -424,7 +424,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseBadBodyBackupSuccess) {
// Respond to the backup successfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(200);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -460,7 +460,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupError) {
// Go ahead and respond to it.
url_fetcher->set_status(net::URLRequestStatus());
url_fetcher->set_response_code(404);
- url_fetcher->SetResponseString(std::string());
+ url_fetcher->SetResponseString("");
url_fetcher->delegate()->OnURLFetchComplete(url_fetcher);
// There should now be a backup request.
@@ -471,7 +471,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupError) {
// Respond to the backup unsuccessfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(404);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -507,7 +507,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupSuccess) {
// Go ahead and respond to it.
url_fetcher->set_status(net::URLRequestStatus());
url_fetcher->set_response_code(404);
- url_fetcher->SetResponseString(std::string());
+ url_fetcher->SetResponseString("");
url_fetcher->delegate()->OnURLFetchComplete(url_fetcher);
// There should now be a backup request.
@@ -519,7 +519,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupSuccess) {
// Respond to the backup successfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(200);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -555,7 +555,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupTimeout) {
// Go ahead and respond to it.
url_fetcher->set_status(net::URLRequestStatus());
url_fetcher->set_response_code(404);
- url_fetcher->SetResponseString(std::string());
+ url_fetcher->SetResponseString("");
url_fetcher->delegate()->OnURLFetchComplete(url_fetcher);
// There should now be a backup request.
@@ -617,7 +617,7 @@ TEST_F(SafeBrowsingProtocolManagerTest,
// Respond to the backup unsuccessfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(404);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -665,7 +665,7 @@ TEST_F(SafeBrowsingProtocolManagerTest,
// Respond to the backup unsuccessfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(200);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -713,7 +713,7 @@ TEST_F(SafeBrowsingProtocolManagerTest,
// Respond to the backup unsuccessfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(404);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -762,7 +762,7 @@ TEST_F(SafeBrowsingProtocolManagerTest,
// Respond to the backup unsuccessfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(200);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -807,7 +807,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseTimeoutBackupSuccess) {
// Respond to the backup unsuccessfully.
backup_url_fetcher->set_status(net::URLRequestStatus());
backup_url_fetcher->set_response_code(200);
- backup_url_fetcher->SetResponseString(std::string());
+ backup_url_fetcher->SetResponseString("");
backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
@@ -888,7 +888,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, EmptyRedirectResponse) {
chunk_url_fetcher, "https://redirect-server.example.com/path");
chunk_url_fetcher->set_status(net::URLRequestStatus());
chunk_url_fetcher->set_response_code(200);
- chunk_url_fetcher->SetResponseString(std::string());
+ chunk_url_fetcher->SetResponseString("");
chunk_url_fetcher->delegate()->OnURLFetchComplete(chunk_url_fetcher);
EXPECT_TRUE(pm->IsUpdateScheduled());
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index 032d5ec..3d0f2d9 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -1004,8 +1004,8 @@ void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary(
if (!CanShowMalwareDetailsOption()) {
strings->SetBoolean(kDisplayCheckBox, false);
- strings->SetString("confirm_text", std::string());
- strings->SetString(kBoxChecked, std::string());
+ strings->SetString("confirm_text", "");
+ strings->SetString(kBoxChecked, "");
} else {
// Show the checkbox for sending malware details.
strings->SetBoolean(kDisplayCheckBox, true);
@@ -1022,7 +1022,7 @@ void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary(
if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled))
strings->SetString(kBoxChecked, "yes");
else
- strings->SetString(kBoxChecked, std::string());
+ strings->SetString(kBoxChecked, "");
}
strings->SetString("report_error", string16());
@@ -1042,11 +1042,10 @@ void SafeBrowsingBlockingPageV2::PopulatePhishingStringDictionary(
string16(),
l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_DESCRIPTION2));
- strings->SetString("details", std::string());
- strings->SetString("confirm_text", std::string());
- strings->SetString(kBoxChecked, std::string());
- strings->SetString(
- "report_error",
+ strings->SetString("details", "");
+ strings->SetString("confirm_text", "");
+ strings->SetString(kBoxChecked, "");
+ strings->SetString("report_error",
l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR));
strings->SetBoolean(kDisplayCheckBox, false);
strings->SetString("learnMore",
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc
index 7e6710f..ef620a7 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util.cc
@@ -298,10 +298,8 @@ void CanonicalizeUrl(const GURL& url,
url_unescaped_str.length(), &parsed);
// 3. In hostname, remove all leading and trailing dots.
- const std::string host =
- (parsed.host.len > 0)
- ? url_unescaped_str.substr(parsed.host.begin, parsed.host.len)
- : std::string();
+ const std::string host = (parsed.host.len > 0) ? url_unescaped_str.substr(
+ parsed.host.begin, parsed.host.len) : "";
const char kCharsToTrim[] = ".";
std::string host_without_end_dots;
TrimString(host, kCharsToTrim, &host_without_end_dots);
@@ -311,11 +309,10 @@ void CanonicalizeUrl(const GURL& url,
host_without_end_dots, '.'));
// 5. In path, replace runs of consecutive slashes with a single slash.
- std::string path =
- (parsed.path.len > 0)
- ? url_unescaped_str.substr(parsed.path.begin, parsed.path.len)
- : std::string();
- std::string path_without_consecutive_slash(RemoveConsecutiveChars(path, '/'));
+ std::string path = (parsed.path.len > 0) ? url_unescaped_str.substr(
+ parsed.path.begin, parsed.path.len): "";
+ std::string path_without_consecutive_slash(RemoveConsecutiveChars(
+ path, '/'));
url_canon::Replacements<char> hp_replacements;
hp_replacements.SetHost(host_without_consecutive_dots.data(),
diff --git a/chrome/browser/safe_browsing/two_phase_uploader.cc b/chrome/browser/safe_browsing/two_phase_uploader.cc
index df58625..9b6165e 100644
--- a/chrome/browser/safe_browsing/two_phase_uploader.cc
+++ b/chrome/browser/safe_browsing/two_phase_uploader.cc
@@ -63,7 +63,7 @@ void TwoPhaseUploader::OnURLFetchComplete(const net::URLFetcher* source) {
if (!status.is_success()) {
LOG(ERROR) << "URLFetcher failed, status=" << status.status()
<< " err=" << status.error();
- Finish(status.error(), response_code, std::string());
+ Finish(status.error(), response_code, "");
return;
}
@@ -83,7 +83,7 @@ void TwoPhaseUploader::OnURLFetchComplete(const net::URLFetcher* source) {
if (!source->GetResponseHeaders()->EnumerateHeader(
NULL, kLocationHeader, &location)) {
LOG(ERROR) << "no location header";
- Finish(net::OK, response_code, std::string());
+ Finish(net::OK, response_code, "");
return;
}
DVLOG(1) << "upload location: " << location;