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

Unified Diff: chrome/browser/safe_browsing/database_manager.h

Issue 11615011: Small modifications to safebrowsing code to make it simpler to add the extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years 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/database_manager.h
diff --git a/chrome/browser/safe_browsing/database_manager.h b/chrome/browser/safe_browsing/database_manager.h
index add445d40567c6908d67cc14f2ca5ced0b48ba7e..4d45074a42e47edee68286ae03815912a4ad0d68 100644
--- a/chrome/browser/safe_browsing/database_manager.h
+++ b/chrome/browser/safe_browsing/database_manager.h
@@ -9,6 +9,7 @@
#define CHROME_BROWSER_SAFE_BROWSING_DATABASE_MANAGER_H_
#include <deque>
+#include <map>
#include <set>
#include <string>
#include <vector>
@@ -48,20 +49,29 @@ class SafeBrowsingDatabaseManager
public:
class Client;
- // Bundle of SafeBrowsing state for one URL or hash prefix check.
+ // Bundle of SafeBrowsing state while performing a URL or hash prefix check.
struct SafeBrowsingCheck {
- SafeBrowsingCheck();
+ // |check_type| should correspond to the type of item that is being checked,
+ // either a URL or a binary hash/URL. This is largely for accounting.
+ //
+ // NOTE: since we actually just query strings and are returned a threat
+ // type, this cannot be used to predict the response type (e.g. we can
+ // query the MALWARE list but may be given results for phishing).
+ explicit SafeBrowsingCheck(safe_browsing_util::ListType check_type);
~SafeBrowsingCheck();
- // Either |urls| or |prefix| is used to lookup database.
+ // Either |urls| or |full_hashes| is used to lookup database.
std::vector<GURL> urls;
- scoped_ptr<SBFullHash> full_hash;
+ std::vector<SBFullHash> full_hashes;
+
+ // Results from either |urls| or |full_hashes|.
+ std::map<GURL, SBThreatType> url_threats;
+ std::map<SBFullHash, SBThreatType> full_hash_threats;
not at google - send to devlin 2012/12/18 00:48:46 Needed because extensions will be checking multipl
Scott Hess - ex-Googler 2013/01/11 23:44:05 I haven't gotten far enough to see why this would
not at google - send to devlin 2013/01/14 23:00:55 Done.
Client* client;
bool need_get_hash;
base::TimeTicks start; // When check was sent to SB service.
- SBThreatType threat_type;
- bool is_download; // If this check for download url or hash.
+ safe_browsing_util::ListType check_type; // See comment in constructor.
not at google - send to devlin 2012/12/18 00:48:46 Needed because it's not just URL or download anymo
std::vector<SBPrefix> prefix_hits;
std::vector<SBFullHashResult> full_hits;
@@ -189,6 +199,7 @@ class SafeBrowsingDatabaseManager
// Clients that we've queued up for checking later once the database is ready.
struct QueuedCheck {
+ safe_browsing_util::ListType check_type;
Client* client;
GURL url;
base::TimeTicks start; // When check was queued.
@@ -296,12 +307,12 @@ class SafeBrowsingDatabaseManager
void SafeBrowsingCheckDone(SafeBrowsingCheck* check);
// Helper function to set |check| with default values and start a safe
- // browsing check with timeout of |timeout_ms|. |task| will be called upon
+ // browsing check with timeout of |timeout|. |task| will be called on
// success, otherwise TimeoutCallback will be called.
- void StartDownloadCheck(SafeBrowsingCheck* check,
- Client* client,
- const base::Closure& task,
- int64 timeout_ms);
+ void StartSafeBrowsingCheck(SafeBrowsingCheck* check,
+ Client* client,
+ const base::Closure& task,
+ const base::TimeDelta& timeout);
// SafeBrowsingProtocolManageDelegate override
virtual void ResetDatabase() OVERRIDE;
@@ -363,10 +374,13 @@ class SafeBrowsingDatabaseManager
// When download url check takes this long, client's callback will be called
// without waiting for the result.
- int64 download_urlcheck_timeout_ms_;
+ base::TimeDelta download_url_check_timeout_;
not at google - send to devlin 2012/12/18 00:48:46 Cleanup.
+
+ // Similar to |download_urlcheck_timeout_| but for download hash checks.
+ base::TimeDelta download_hash_check_timeout_;
- // Similar to |download_urlcheck_timeout_ms_|, but for download hash checks.
- int64 download_hashcheck_timeout_ms_;
+ // Similar to |download_urlcheck_timeout_| but for extension ID checks.
+ base::TimeDelta extension_id_check_timeout_;
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingDatabaseManager);
};

Powered by Google App Engine
This is Rietveld 408576698