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..53428e198758b9b0736d0fca4f8688bd5f3d4442 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,14 @@ 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. Returns whether the backup request was issued - |
+ // this may be false in cases where there is not a prefix specified. |
+ bool IssueBackupUpdateRequest(BackupUpdateReason reason); |
+ |
// Sends a request for a chunk to the SafeBrowsing servers. |
void IssueChunkRequest(); |
@@ -339,6 +361,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_; |