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

Unified Diff: sync/internal_api/public/attachments/attachment_downloader_impl.h

Issue 710073003: Store attachment crc in AttachmentStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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: sync/internal_api/public/attachments/attachment_downloader_impl.h
diff --git a/sync/internal_api/public/attachments/attachment_downloader_impl.h b/sync/internal_api/public/attachments/attachment_downloader_impl.h
index 363d805a9d226b94994fbd797076272ca0557255..954da706df33b572ca03f541c5848ace16384ab5 100644
--- a/sync/internal_api/public/attachments/attachment_downloader_impl.h
+++ b/sync/internal_api/public/attachments/attachment_downloader_impl.h
@@ -13,6 +13,10 @@
#include "sync/internal_api/public/attachments/attachment_downloader.h"
#include "url/gurl.h"
+namespace base {
+class RefCountedMemory;
+} // namespace base
+
namespace net {
class HttpResponseHeaders;
} // namespace net
@@ -59,7 +63,10 @@ class AttachmentDownloaderImpl : public AttachmentDownloader,
void OnURLFetchComplete(const net::URLFetcher* source) override;
private:
+ FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest,
+ ExtractCrc32c_NoHeaders);
FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_First);
+ FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_TooLong);
FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_None);
FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_Empty);
@@ -74,23 +81,17 @@ class AttachmentDownloaderImpl : public AttachmentDownloader,
void ReportResult(
const DownloadState& download_state,
const DownloadResult& result,
- const scoped_refptr<base::RefCountedString>& attachment_data);
-
- // Verify the integrity of |data| using the hash received in |fetcher|.
- //
- // Assumes that the request in |fetcher| has completed.
- //
- // Returns true if the hash of |data| matches the hash contained in |fetcher|
- // or if |fetcher| contains no hash (no hash, no problem).
- static bool VerifyHashIfPresent(const net::URLFetcher& fetcher,
- const std::string& data);
+ const scoped_refptr<base::RefCountedString>& attachment_data,
+ uint32_t attachment_crc);
// Extract the crc32c from an X-Goog-Hash header in |headers|.
//
- // Return true if a crc32c was found and set |crc32c|.
+ // Return true if a crc32c was found and useable for checking data integrity.
+ // This means headers are present, there is "x-goog-hash" header with "crc32c"
+ // hash in it, this hash is correctly base64 encoded 32 but value.
maniscalco 2014/11/11 00:44:54 I think this comment may have been mangled: "encod
pavely 2014/11/11 22:27:15 Done.
SYNC_EXPORT_PRIVATE static bool ExtractCrc32c(
- const net::HttpResponseHeaders& headers,
- std::string* crc32c);
+ const net::HttpResponseHeaders* headers,
+ uint32_t* crc32c);
GURL sync_service_url_;
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;

Powered by Google App Engine
This is Rietveld 408576698