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

Unified Diff: components/safe_browsing_db/database_manager.cc

Issue 1895743002: Revert of Safe Browsing: CheckApiBlacklist request implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/database_manager.cc
diff --git a/components/safe_browsing_db/database_manager.cc b/components/safe_browsing_db/database_manager.cc
index c8d7aa30afa2ae750bd85757b4927043b5e5bae0..b8998b4431fcdde86dadd3b664dde8504c2f1b05 100644
--- a/components/safe_browsing_db/database_manager.cc
+++ b/components/safe_browsing_db/database_manager.cc
@@ -25,9 +25,11 @@
net::URLRequestContextGetter* request_context_getter,
const V4ProtocolConfig& config) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
- v4_get_hash_protocol_manager_ = V4GetHashProtocolManager::Create(
- request_context_getter, config);
+ if (request_context_getter) {
+ // Instantiate a V4GetHashProtocolManager.
+ v4_get_hash_protocol_manager_ = V4GetHashProtocolManager::Create(
+ request_context_getter, config);
+ }
}
// |shutdown| not used. Destroys the v4 protocol managers. This may be called
@@ -40,61 +42,11 @@
delete v4_get_hash_protocol_manager_;
v4_get_hash_protocol_manager_ = NULL;
}
- // TODO(kcarattini): Call back clients with pending requests.
}
-bool SafeBrowsingDatabaseManager::CheckApiBlacklistUrl(const GURL& url,
+void SafeBrowsingDatabaseManager::CheckApiBlacklistUrl(const GURL& url,
Client* client) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- DCHECK(v4_get_hash_protocol_manager_);
-
- // Make sure we can check this url.
- if (!(url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme))) {
- return true;
- }
-
- // Compute a list of hashes for this url.
- std::vector<SBFullHash> full_hashes;
- UrlToFullHashes(url, false, &full_hashes);
- if (full_hashes.empty())
- return true;
-
- // Copy to prefixes.
- std::vector<SBPrefix> prefixes;
- for (const SBFullHash& full_hash : full_hashes) {
- prefixes.push_back(full_hash.prefix);
- }
- // Multiple full hashes could share a prefix, remove duplicates.
- std::sort(prefixes.begin(), prefixes.end());
- prefixes.erase(std::unique(prefixes.begin(), prefixes.end()), prefixes.end());
- DCHECK(!prefixes.empty());
-
- // TODO(kcarattini): Track checks in a map.
- std::shared_ptr<SafeBrowsingApiCheck> check(
- new SafeBrowsingApiCheck(url, full_hashes, client));
-
- // TODO(kcarattini): Implement cache compliance.
- v4_get_hash_protocol_manager_->GetFullHashesWithApis(prefixes,
- base::Bind(&SafeBrowsingDatabaseManager::HandleGetHashesWithApisResults,
- base::Unretained(this), check));
-
- return false;
-}
-
-void SafeBrowsingDatabaseManager::HandleGetHashesWithApisResults(
- std::shared_ptr<SafeBrowsingApiCheck> check,
- const std::vector<SBFullHashResult>& full_hash_results,
- const base::TimeDelta& negative_cache_duration) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- // TODO(kcarattini): Implement response handler.
-}
-
-SafeBrowsingDatabaseManager::SafeBrowsingApiCheck::SafeBrowsingApiCheck(
- const GURL& url, const std::vector<SBFullHash>& full_hashes, Client* client)
- : url_(url), full_hashes_(full_hashes), client_(client) {
-}
-
-SafeBrowsingDatabaseManager::SafeBrowsingApiCheck::~SafeBrowsingApiCheck() {
+ // TODO(kcarattini): Implement this.
}
} // namespace safe_browsing
« no previous file with comments | « components/safe_browsing_db/database_manager.h ('k') | components/safe_browsing_db/database_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698