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

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

Issue 11784038: Add backup URL support for SafeBrowsing data requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bad response case Created 7 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/protocol_manager.h
diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h
index 7104be4aaf8dbcbe970c67a8ca9cfad5bc4f9227..5397ac118ac06ceb790a0fb002c415a3a517db96 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -180,11 +180,25 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
enum SafeBrowsingRequestType {
NO_REQUEST = 0, // No requests in progress
UPDATE_REQUEST, // Request for redirect URLs
+ BACKUP_UPDATE_REQUEST, // Request for redirect URLs to a backup URL.
CHUNK_REQUEST, // Request for a specific chunk
};
+ // Which type of backup update request is being used.
+ enum BackupUpdateReason {
+ BACKUP_UPDATE_REASON_CONNECT,
+ BACKUP_UPDATE_REASON_HTTP,
+ BACKUP_UPDATE_REASON_NETWORK,
+ BACKUP_UPDATE_REASON_MAX,
+ };
+
// Generates Update URL for querying about the latest set of chunk updates.
GURL UpdateUrl() const;
+
+ // Generates backup Update URL for querying about the latest set of chunk
+ // updates. |url_prefix| is the base prefix to use.
+ GURL BackupUpdateUrl(BackupUpdateReason reason) const;
+
// Generates GetHash request URL for retrieving full hashes.
GURL GetHashUrl() const;
// Generates URL for reporting safe browsing hits for UMA users.
@@ -217,6 +231,13 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
// is sent upon completion of that query in OnGetChunksComplete.
void IssueUpdateRequest();
+ // Sends a backup request for a list of chunks to download, when the primary
+ // update request failed. |reason| specifies why the backup is needed. Unlike
+ // the primary IssueUpdateRequest, this does not need to hit the local
+ // SafeBrowsing database since the existing chunk numbers are remembered from
+ // the primary update request.
+ void IssueBackupUpdateRequest(BackupUpdateReason reason);
+
// Sends a request for a chunk to the SafeBrowsing servers.
void IssueChunkRequest();
@@ -339,6 +360,15 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate,
// URL prefix where browser fetches safebrowsing chunk updates, and hashes.
std::string url_prefix_;
+ // Backup URL prefixes for updates.
+ std::string backup_url_prefixes_[BACKUP_UPDATE_REASON_MAX];
+
+ // The current reason why the backup update request is happening.
+ BackupUpdateReason backup_update_reason_;
+
+ // Data to POST when doing an update.
+ std::string update_list_data_;
+
// When true, protocol manager will not start an update unless
// ForceScheduleNextUpdate() is called. This is set for testing purpose.
bool disable_auto_update_;
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/protocol_manager.cc » ('j') | chrome/browser/safe_browsing/protocol_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698