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); | |
93 | 92 |
94 // Extract the crc32c from an X-Goog-Hash header in |headers|. | 93 // Extract the crc32c from an X-Goog-Hash header in |headers|. |
95 // | 94 // |
96 // Return true if a crc32c was found and useable for checking data integrity. | 95 // Return true if a crc32c was found and useable for checking data integrity. |
97 // "Usable" means headers are present, there is "x-goog-hash" header with | 96 // "Usable" means headers are present, there is "x-goog-hash" header with |
98 // "crc32c" hash in it, this hash is correctly base64 encoded 32 bit integer. | 97 // "crc32c" hash in it, this hash is correctly base64 encoded 32 bit integer. |
99 SYNC_EXPORT_PRIVATE static bool ExtractCrc32c( | 98 SYNC_EXPORT_PRIVATE static bool ExtractCrc32c( |
100 const net::HttpResponseHeaders* headers, | 99 const net::HttpResponseHeaders* headers, |
101 uint32_t* crc32c); | 100 uint32_t* crc32c); |
102 | 101 |
(...skipping 14 matching lines...) Expand all Loading... |
117 StateList requests_waiting_for_access_token_; | 116 StateList requests_waiting_for_access_token_; |
118 | 117 |
119 ModelType model_type_; | 118 ModelType model_type_; |
120 | 119 |
121 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl); | 120 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl); |
122 }; | 121 }; |
123 | 122 |
124 } // namespace syncer | 123 } // namespace syncer |
125 | 124 |
126 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ | 125 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ |
OLD | NEW |