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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database_bloom.cc

Issue 16595: Ignore GetHash results for lists that we don't support. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_database_bloom.cc (revision 7554)
+++ chrome/browser/safe_browsing/safe_browsing_database_bloom.cc (working copy)
@@ -361,7 +361,7 @@
base::Time insert_start = base::Time::Now();
- int list_id = GetListId(list_name);
+ int list_id = safe_browsing_util::GetListId(list_name);
ChunkType chunk_type = chunks->front().is_add ? ADD_CHUNK : SUB_CHUNK;
while (!chunks->empty()) {
@@ -637,7 +637,7 @@
if (chunk_deletes->empty())
return;
- int list_id = GetListId(chunk_deletes->front().list_name);
+ int list_id = safe_browsing_util::GetListId(chunk_deletes->front().list_name);
for (size_t i = 0; i < chunk_deletes->size(); ++i) {
const SBChunkDelete& chunk = (*chunk_deletes)[i];
@@ -703,40 +703,16 @@
ReadChunkNumbers();
lists->push_back(SBListChunkRanges(safe_browsing_util::kMalwareList));
- GetChunkIds(MALWARE, ADD_CHUNK, &lists->back().adds);
- GetChunkIds(MALWARE, SUB_CHUNK, &lists->back().subs);
+ GetChunkIds(safe_browsing_util::MALWARE, ADD_CHUNK, &lists->back().adds);
+ GetChunkIds(safe_browsing_util::MALWARE, SUB_CHUNK, &lists->back().subs);
lists->push_back(SBListChunkRanges(safe_browsing_util::kPhishingList));
- GetChunkIds(PHISH, ADD_CHUNK, &lists->back().adds);
- GetChunkIds(PHISH, SUB_CHUNK, &lists->back().subs);
+ GetChunkIds(safe_browsing_util::PHISH, ADD_CHUNK, &lists->back().adds);
+ GetChunkIds(safe_browsing_util::PHISH, SUB_CHUNK, &lists->back().subs);
return;
}
-/* static */
-int SafeBrowsingDatabaseBloom::GetListId(const std::string& name) {
- if (name == safe_browsing_util::kMalwareList)
- return MALWARE;
- else if (name == safe_browsing_util::kPhishingList)
- return PHISH;
-
- NOTREACHED();
- return -1;
-}
-
-/* static */
-std::string SafeBrowsingDatabaseBloom::GetListName(int list_id) {
- switch (list_id) {
- case MALWARE:
- return safe_browsing_util::kMalwareList;
- case PHISH:
- return safe_browsing_util::kPhishingList;
- default:
- NOTREACHED();
- return "";
- }
-}
-
void SafeBrowsingDatabaseBloom::ReadChunkNumbers() {
add_chunk_cache_.clear();
sub_chunk_cache_.clear();
@@ -1413,7 +1389,7 @@
memcpy(&full_hash.hash.full_hash,
&eit->full_hash.full_hash,
sizeof(SBFullHash));
- full_hash.list_name = GetListName(eit->list_id);
+ full_hash.list_name = safe_browsing_util::GetListName(eit->list_id);
full_hash.add_chunk_id = eit->add_chunk_id;
full_hits->push_back(full_hash);
}
@@ -1449,7 +1425,7 @@
HashList& entries = (*hash_cache_)[prefix];
HashCacheEntry entry;
entry.received = now;
- entry.list_id = GetListId(it->list_name);
+ entry.list_id = safe_browsing_util::GetListId(it->list_name);
entry.add_chunk_id = EncodeChunkId(it->add_chunk_id, entry.list_id);
memcpy(&entry.full_hash, &it->hash.full_hash, sizeof(SBFullHash));
entries.push_back(entry);
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database_bloom.h ('k') | chrome/browser/safe_browsing/safe_browsing_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698