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

Side by Side Diff: sync/internal_api/public/attachments/attachment_downloader_impl.h

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 private: 79 private:
80 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, 80 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest,
81 ExtractCrc32c_NoHeaders); 81 ExtractCrc32c_NoHeaders);
82 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_First); 82 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_First);
83 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_TooLong); 83 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_TooLong);
84 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_None); 84 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_None);
85 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_Empty); 85 FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_Empty);
86 86
87 struct DownloadState; 87 struct DownloadState;
88 typedef std::string AttachmentUrl; 88 typedef std::string AttachmentUrl;
89 typedef base::ScopedPtrHashMap<AttachmentUrl, scoped_ptr<DownloadState>> 89 typedef base::ScopedPtrHashMap<AttachmentUrl, std::unique_ptr<DownloadState>>
90 StateMap; 90 StateMap;
91 typedef std::vector<DownloadState*> StateList; 91 typedef std::vector<DownloadState*> StateList;
92 92
93 scoped_ptr<net::URLFetcher> CreateFetcher(const AttachmentUrl& url, 93 std::unique_ptr<net::URLFetcher> CreateFetcher(
94 const std::string& access_token); 94 const AttachmentUrl& url,
95 const std::string& access_token);
95 void RequestAccessToken(DownloadState* download_state); 96 void RequestAccessToken(DownloadState* download_state);
96 void ReportResult( 97 void ReportResult(
97 const DownloadState& download_state, 98 const DownloadState& download_state,
98 const DownloadResult& result, 99 const DownloadResult& result,
99 const scoped_refptr<base::RefCountedString>& attachment_data); 100 const scoped_refptr<base::RefCountedString>& attachment_data);
100 101
101 // Extract the crc32c from an X-Goog-Hash header in |headers|. 102 // Extract the crc32c from an X-Goog-Hash header in |headers|.
102 // 103 //
103 // Return true if a crc32c was found and useable for checking data integrity. 104 // Return true if a crc32c was found and useable for checking data integrity.
104 // "Usable" means headers are present, there is "x-goog-hash" header with 105 // "Usable" means headers are present, there is "x-goog-hash" header with
105 // "crc32c" hash in it, this hash is correctly base64 encoded 32 bit integer. 106 // "crc32c" hash in it, this hash is correctly base64 encoded 32 bit integer.
106 SYNC_EXPORT static bool ExtractCrc32c(const net::HttpResponseHeaders* headers, 107 SYNC_EXPORT static bool ExtractCrc32c(const net::HttpResponseHeaders* headers,
107 uint32_t* crc32c); 108 uint32_t* crc32c);
108 109
109 GURL sync_service_url_; 110 GURL sync_service_url_;
110 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 111 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
111 112
112 std::string account_id_; 113 std::string account_id_;
113 OAuth2TokenService::ScopeSet oauth2_scopes_; 114 OAuth2TokenService::ScopeSet oauth2_scopes_;
114 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> 115 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>
115 token_service_provider_; 116 token_service_provider_;
116 scoped_ptr<OAuth2TokenService::Request> access_token_request_; 117 std::unique_ptr<OAuth2TokenService::Request> access_token_request_;
117 std::string raw_store_birthday_; 118 std::string raw_store_birthday_;
118 119
119 StateMap state_map_; 120 StateMap state_map_;
120 // |requests_waiting_for_access_token_| only keeps references to DownloadState 121 // |requests_waiting_for_access_token_| only keeps references to DownloadState
121 // objects while access token request is pending. It doesn't control objects' 122 // objects while access token request is pending. It doesn't control objects'
122 // lifetime. 123 // lifetime.
123 StateList requests_waiting_for_access_token_; 124 StateList requests_waiting_for_access_token_;
124 125
125 ModelType model_type_; 126 ModelType model_type_;
126 127
127 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl); 128 DISALLOW_COPY_AND_ASSIGN(AttachmentDownloaderImpl);
128 }; 129 };
129 130
130 } // namespace syncer 131 } // namespace syncer
131 132
132 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_ 133 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_DOWNLOADER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698