OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ |
7 | 7 |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "google_apis/gaia/oauth2_token_service_request.h" | 10 #include "google_apis/gaia/oauth2_token_service_request.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 typedef std::string AttachmentUrl; | 81 typedef std::string AttachmentUrl; |
82 typedef base::ScopedPtrHashMap<AttachmentUrl, DownloadState> StateMap; | 82 typedef base::ScopedPtrHashMap<AttachmentUrl, DownloadState> StateMap; |
83 typedef std::vector<DownloadState*> StateList; | 83 typedef std::vector<DownloadState*> StateList; |
84 | 84 |
85 scoped_ptr<net::URLFetcher> CreateFetcher(const AttachmentUrl& url, | 85 scoped_ptr<net::URLFetcher> CreateFetcher(const AttachmentUrl& url, |
86 const std::string& access_token); | 86 const std::string& access_token); |
87 void RequestAccessToken(DownloadState* download_state); | 87 void RequestAccessToken(DownloadState* download_state); |
88 void ReportResult( | 88 void ReportResult( |
89 const DownloadState& download_state, | 89 const DownloadState& download_state, |
90 const DownloadResult& result, | 90 const DownloadResult& result, |
91 const scoped_refptr<base::RefCountedString>& attachment_data); | 91 const scoped_refptr<base::RefCountedString>& attachment_data, |
| 92 uint32_t attachment_crc32c); |
92 | 93 |
93 // Extract the crc32c from an X-Goog-Hash header in |headers|. | 94 // Extract the crc32c from an X-Goog-Hash header in |headers|. |
94 // | 95 // |
95 // Return true if a crc32c was found and useable for checking data integrity. | 96 // Return true if a crc32c was found and useable for checking data integrity. |
96 // "Usable" means headers are present, there is "x-goog-hash" header with | 97 // "Usable" means headers are present, there is "x-goog-hash" header with |
97 // "crc32c" hash in it, this hash is correctly base64 encoded 32 bit integer. | 98 // "crc32c" hash in it, this hash is correctly base64 encoded 32 bit integer. |
98 SYNC_EXPORT_PRIVATE static bool ExtractCrc32c( | 99 SYNC_EXPORT_PRIVATE static bool ExtractCrc32c( |
99 const net::HttpResponseHeaders* headers, | 100 const net::HttpResponseHeaders* headers, |
100 uint32_t* crc32c); | 101 uint32_t* crc32c); |
101 | 102 |
(...skipping 14 matching lines...) Expand all Loading... |
116 StateList requests_waiting_for_access_token_; | 117 StateList requests_waiting_for_access_token_; |
117 | 118 |
118 ModelType model_type_; | 119 ModelType model_type_; |
119 | 120 |
120 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl); | 121 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl); |
121 }; | 122 }; |
122 | 123 |
123 } // namespace syncer | 124 } // namespace syncer |
124 | 125 |
125 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ | 126 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ |
OLD | NEW |