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

Unified Diff: components/safe_browsing_db/v4_local_database_manager.cc

Issue 2675063002: Browser tests for using the new SafeBrowsing protocol (v4) (Closed)
Patch Set: Simplify V4DB creation in product code and tests Created 3 years, 10 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: components/safe_browsing_db/v4_local_database_manager.cc
diff --git a/components/safe_browsing_db/v4_local_database_manager.cc b/components/safe_browsing_db/v4_local_database_manager.cc
index 224525982461fdc8790a48b51f45464a3f536294..1144b674cc7497f3a3886de5dab9a1cf144a0893 100644
--- a/components/safe_browsing_db/v4_local_database_manager.cc
+++ b/components/safe_browsing_db/v4_local_database_manager.cc
@@ -130,10 +130,6 @@ V4LocalDatabaseManager::PendingCheck::~PendingCheck() {}
scoped_refptr<V4LocalDatabaseManager> V4LocalDatabaseManager::Create(
const base::FilePath& base_path,
ExtendedReportingLevelCallback extended_reporting_level_callback) {
- if (!V4FeatureList::IsLocalDatabaseManagerEnabled()) {
- return nullptr;
- }
-
return make_scoped_refptr(
new V4LocalDatabaseManager(base_path, extended_reporting_level_callback));
}
@@ -199,10 +195,13 @@ bool V4LocalDatabaseManager::ChecksAreAlwaysAsync() const {
bool V4LocalDatabaseManager::CheckBrowseUrl(const GURL& url, Client* client) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ LOG(ERROR) << "V4LocalDatabaseManager::CheckBrowseUrl: url: " << url.spec();
Scott Hess - ex-Googler 2017/02/06 22:46:36 Does everyone need to see these logs?
vakh (use Gerrit instead) 2017/02/06 23:30:13 No, got uploaded by mistake. Removed.
+
if (!enabled_ || !CanCheckUrl(url)) {
return true;
}
+ LOG(ERROR) << "V4LocalDatabaseManager::CheckBrowseUrl: url: " << url.spec();
std::unique_ptr<PendingCheck> check = base::MakeUnique<PendingCheck>(
client, ClientCallbackType::CHECK_BROWSE_URL,
StoresToCheck({GetUrlMalwareId(), GetUrlSocEngId(), GetUrlUwsId()}),
@@ -469,6 +468,8 @@ bool V4LocalDatabaseManager::GetPrefixMatches(
StoreAndHashPrefixes matched_store_and_hash_prefixes;
v4_database_->GetStoresMatchingFullHash(full_hash, check->stores_to_check,
&matched_store_and_hash_prefixes);
+ LOG(ERROR) << "V4LocalDatabaseManager::GetPrefixMatches: matched: "
+ << !matched_store_and_hash_prefixes.empty();
if (!matched_store_and_hash_prefixes.empty()) {
(*full_hash_to_store_and_hash_prefixes)[full_hash] =
matched_store_and_hash_prefixes;
@@ -533,6 +534,8 @@ SBThreatType V4LocalDatabaseManager::GetSBThreatTypeForList(
}
bool V4LocalDatabaseManager::HandleCheck(std::unique_ptr<PendingCheck> check) {
+ LOG(ERROR) << "V4LocalDatabaseManager::HandleCheck: v4_database_: "
+ << v4_database_.get();
if (!v4_database_) {
queued_checks_.push_back(std::move(check));
return false;
@@ -540,9 +543,11 @@ bool V4LocalDatabaseManager::HandleCheck(std::unique_ptr<PendingCheck> check) {
FullHashToStoreAndHashPrefixesMap full_hash_to_store_and_hash_prefixes;
if (!GetPrefixMatches(check, &full_hash_to_store_and_hash_prefixes)) {
+ LOG(ERROR) << "V4LocalDatabaseManager::HandleCheck: No prefix match!";
return true;
}
+ LOG(ERROR) << "V4LocalDatabaseManager::HandleCheck: Prefix(es) matched!";
// Add check to pending_checks_ before scheduling PerformFullHashCheck so that
// even if the client calls CancelCheck before PerformFullHashCheck gets
// called, the check can be found in pending_checks_.
@@ -589,6 +594,12 @@ void V4LocalDatabaseManager::OnFullHashResponse(
const std::vector<FullHashInfo>& full_hash_infos) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ LOG(ERROR)
+ << "V4LocalDatabaseManager::OnFullHashResponse: full_hash_infos.size(): "
+ << full_hash_infos.size();
+ LOG(ERROR) << "V4LocalDatabaseManager::OnFullHashResponse: enabled_: "
+ << enabled_;
+
if (!enabled_) {
DCHECK(pending_checks_.empty());
return;
@@ -604,6 +615,9 @@ void V4LocalDatabaseManager::OnFullHashResponse(
GetSeverestThreatTypeAndMetadata(&check->result_threat_type,
&check->url_metadata,
&check->matching_full_hash, full_hash_infos);
+ LOG(ERROR) << "V4LocalDatabaseManager::OnFullHashResponse: "
+ "check->result_threat_type: "
+ << check->result_threat_type;
pending_checks_.erase(it);
RespondToClient(std::move(check));
}

Powered by Google App Engine
This is Rietveld 408576698