OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "chrome/browser/chromeos/gdata/operations_base.h" | 11 #include "chrome/browser/chromeos/gdata/operations_base.h" |
12 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" | 12 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" |
13 | 13 |
14 namespace gdata { | 14 namespace gdata { |
15 | 15 |
16 class GDataEntry; | 16 class GDataEntry; |
17 class DocumentEntry; | 17 class DocumentEntry; |
18 | 18 |
19 //============================ GetDocumentsOperation =========================== | 19 //============================ GetDocumentsOperation =========================== |
20 | 20 |
21 // This class performs the operation for fetching a document list. | 21 // This class performs the operation for fetching a document list. |
22 class GetDocumentsOperation : public GetDataOperation { | 22 class GetDocumentsOperation : public GetDataOperation { |
23 public: | 23 public: |
24 // |start_changestamp| specifies the starting point of change list or 0 if | 24 // |start_changestamp| specifies the starting point of change list or 0 if |
25 // all changes are necessary. | 25 // all changes are necessary. |
26 // |url| specifies URL for documents feed fetching operation. If empty URL is | 26 // |url| specifies URL for documents feed fetching operation. If empty URL is |
27 // passed, the default URL is used and returns the first page of the result. | 27 // passed, the default URL is used and returns the first page of the result. |
28 // When non-first page result is requested, |url| should be specified. | 28 // When non-first page result is requested, |url| should be specified. |
29 GetDocumentsOperation(GDataOperationRegistry* registry, | 29 GetDocumentsOperation(OperationRegistry* registry, |
30 const GURL& url, | 30 const GURL& url, |
31 int start_changestamp, | 31 int start_changestamp, |
32 const std::string& search_string, | 32 const std::string& search_string, |
33 const std::string& directory_resource_id, | 33 const std::string& directory_resource_id, |
34 const GetDataCallback& callback); | 34 const GetDataCallback& callback); |
35 virtual ~GetDocumentsOperation(); | 35 virtual ~GetDocumentsOperation(); |
36 | 36 |
37 protected: | 37 protected: |
38 // Overridden from GetDataOperation. | 38 // Overridden from GetDataOperation. |
39 virtual GURL GetURL() const OVERRIDE; | 39 virtual GURL GetURL() const OVERRIDE; |
40 | 40 |
41 private: | 41 private: |
42 GURL override_url_; | 42 GURL override_url_; |
43 int start_changestamp_; | 43 int start_changestamp_; |
44 std::string search_string_; | 44 std::string search_string_; |
45 std::string directory_resource_id_; | 45 std::string directory_resource_id_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(GetDocumentsOperation); | 47 DISALLOW_COPY_AND_ASSIGN(GetDocumentsOperation); |
48 }; | 48 }; |
49 | 49 |
50 //========================= GetDocumentEntryOperation ========================== | 50 //========================= GetDocumentEntryOperation ========================== |
51 | 51 |
52 // This class performs the operation for fetching a single document entry. | 52 // This class performs the operation for fetching a single document entry. |
53 class GetDocumentEntryOperation : public GetDataOperation { | 53 class GetDocumentEntryOperation : public GetDataOperation { |
54 public: | 54 public: |
55 GetDocumentEntryOperation(GDataOperationRegistry* registry, | 55 GetDocumentEntryOperation(OperationRegistry* registry, |
56 const std::string& resource_id, | 56 const std::string& resource_id, |
57 const GetDataCallback& callback); | 57 const GetDataCallback& callback); |
58 virtual ~GetDocumentEntryOperation(); | 58 virtual ~GetDocumentEntryOperation(); |
59 | 59 |
60 protected: | 60 protected: |
61 // Overridden from GetGdataOperation. | 61 // Overridden from GetGdataOperation. |
62 virtual GURL GetURL() const OVERRIDE; | 62 virtual GURL GetURL() const OVERRIDE; |
63 | 63 |
64 private: | 64 private: |
65 // Resource id of the requested entry. | 65 // Resource id of the requested entry. |
66 std::string resource_id_; | 66 std::string resource_id_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(GetDocumentEntryOperation); | 68 DISALLOW_COPY_AND_ASSIGN(GetDocumentEntryOperation); |
69 }; | 69 }; |
70 | 70 |
71 //========================= GetAccountMetadataOperation ======================== | 71 //========================= GetAccountMetadataOperation ======================== |
72 | 72 |
73 // This class performs the operation for fetching account metadata. | 73 // This class performs the operation for fetching account metadata. |
74 class GetAccountMetadataOperation : public GetDataOperation { | 74 class GetAccountMetadataOperation : public GetDataOperation { |
75 public: | 75 public: |
76 GetAccountMetadataOperation(GDataOperationRegistry* registry, | 76 GetAccountMetadataOperation(OperationRegistry* registry, |
77 const GetDataCallback& callback); | 77 const GetDataCallback& callback); |
78 virtual ~GetAccountMetadataOperation(); | 78 virtual ~GetAccountMetadataOperation(); |
79 | 79 |
80 protected: | 80 protected: |
81 // Overridden from GetDataOperation. | 81 // Overridden from GetDataOperation. |
82 virtual GURL GetURL() const OVERRIDE; | 82 virtual GURL GetURL() const OVERRIDE; |
83 | 83 |
84 private: | 84 private: |
85 DISALLOW_COPY_AND_ASSIGN(GetAccountMetadataOperation); | 85 DISALLOW_COPY_AND_ASSIGN(GetAccountMetadataOperation); |
86 }; | 86 }; |
87 | 87 |
88 //============================ DownloadFileOperation =========================== | 88 //============================ DownloadFileOperation =========================== |
89 | 89 |
90 // Callback type for DownloadDocument/DownloadFile DocumentServiceInterface | 90 // Callback type for DownloadDocument/DownloadFile DocumentServiceInterface |
91 // calls. | 91 // calls. |
92 typedef base::Callback<void(GDataErrorCode error, | 92 typedef base::Callback<void(GDataErrorCode error, |
93 const GURL& content_url, | 93 const GURL& content_url, |
94 const FilePath& temp_file)> DownloadActionCallback; | 94 const FilePath& temp_file)> DownloadActionCallback; |
95 | 95 |
96 // This class performs the operation for downloading of a given document/file. | 96 // This class performs the operation for downloading of a given document/file. |
97 class DownloadFileOperation : public UrlFetchOperationBase { | 97 class DownloadFileOperation : public UrlFetchOperationBase { |
98 public: | 98 public: |
99 DownloadFileOperation( | 99 DownloadFileOperation( |
100 GDataOperationRegistry* registry, | 100 OperationRegistry* registry, |
101 const DownloadActionCallback& download_action_callback, | 101 const DownloadActionCallback& download_action_callback, |
102 const GetContentCallback& get_content_callback, | 102 const GetContentCallback& get_content_callback, |
103 const GURL& document_url, | 103 const GURL& document_url, |
104 const FilePath& virtual_path, | 104 const FilePath& virtual_path, |
105 const FilePath& output_file_path); | 105 const FilePath& output_file_path); |
106 virtual ~DownloadFileOperation(); | 106 virtual ~DownloadFileOperation(); |
107 | 107 |
108 protected: | 108 protected: |
109 // Overridden from UrlFetchOperationBase. | 109 // Overridden from UrlFetchOperationBase. |
110 virtual GURL GetURL() const OVERRIDE; | 110 virtual GURL GetURL() const OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
125 GURL document_url_; | 125 GURL document_url_; |
126 | 126 |
127 DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation); | 127 DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation); |
128 }; | 128 }; |
129 | 129 |
130 //=========================== DeleteDocumentOperation ========================== | 130 //=========================== DeleteDocumentOperation ========================== |
131 | 131 |
132 // This class performs the operation for deleting a document. | 132 // This class performs the operation for deleting a document. |
133 class DeleteDocumentOperation : public EntryActionOperation { | 133 class DeleteDocumentOperation : public EntryActionOperation { |
134 public: | 134 public: |
135 DeleteDocumentOperation(GDataOperationRegistry* registry, | 135 DeleteDocumentOperation(OperationRegistry* registry, |
136 const EntryActionCallback& callback, | 136 const EntryActionCallback& callback, |
137 const GURL& document_url); | 137 const GURL& document_url); |
138 virtual ~DeleteDocumentOperation(); | 138 virtual ~DeleteDocumentOperation(); |
139 | 139 |
140 protected: | 140 protected: |
141 // Overridden from UrlFetchOperationBase. | 141 // Overridden from UrlFetchOperationBase. |
142 virtual GURL GetURL() const OVERRIDE; | 142 virtual GURL GetURL() const OVERRIDE; |
143 | 143 |
144 // Overridden from EntryActionOperation. | 144 // Overridden from EntryActionOperation. |
145 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 145 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
146 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 146 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
147 | 147 |
148 private: | 148 private: |
149 DISALLOW_COPY_AND_ASSIGN(DeleteDocumentOperation); | 149 DISALLOW_COPY_AND_ASSIGN(DeleteDocumentOperation); |
150 }; | 150 }; |
151 | 151 |
152 //========================== CreateDirectoryOperation ========================== | 152 //========================== CreateDirectoryOperation ========================== |
153 | 153 |
154 // This class performs the operation for creating a directory. | 154 // This class performs the operation for creating a directory. |
155 class CreateDirectoryOperation : public GetDataOperation { | 155 class CreateDirectoryOperation : public GetDataOperation { |
156 public: | 156 public: |
157 // Empty |parent_content_url| will create the directory in the root folder. | 157 // Empty |parent_content_url| will create the directory in the root folder. |
158 CreateDirectoryOperation(GDataOperationRegistry* registry, | 158 CreateDirectoryOperation(OperationRegistry* registry, |
159 const GetDataCallback& callback, | 159 const GetDataCallback& callback, |
160 const GURL& parent_content_url, | 160 const GURL& parent_content_url, |
161 const FilePath::StringType& directory_name); | 161 const FilePath::StringType& directory_name); |
162 virtual ~CreateDirectoryOperation(); | 162 virtual ~CreateDirectoryOperation(); |
163 | 163 |
164 protected: | 164 protected: |
165 // Overridden from UrlFetchOperationBase. | 165 // Overridden from UrlFetchOperationBase. |
166 virtual GURL GetURL() const OVERRIDE; | 166 virtual GURL GetURL() const OVERRIDE; |
167 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 167 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
168 | 168 |
169 // Overridden from UrlFetchOperationBase. | 169 // Overridden from UrlFetchOperationBase. |
170 virtual bool GetContentData(std::string* upload_content_type, | 170 virtual bool GetContentData(std::string* upload_content_type, |
171 std::string* upload_content) OVERRIDE; | 171 std::string* upload_content) OVERRIDE; |
172 | 172 |
173 private: | 173 private: |
174 GURL parent_content_url_; | 174 GURL parent_content_url_; |
175 FilePath::StringType directory_name_; | 175 FilePath::StringType directory_name_; |
176 | 176 |
177 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | 177 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); |
178 }; | 178 }; |
179 | 179 |
180 //============================ CopyDocumentOperation =========================== | 180 //============================ CopyDocumentOperation =========================== |
181 | 181 |
182 // This class performs the operation for making a copy of a document. | 182 // This class performs the operation for making a copy of a document. |
183 class CopyDocumentOperation : public GetDataOperation { | 183 class CopyDocumentOperation : public GetDataOperation { |
184 public: | 184 public: |
185 CopyDocumentOperation(GDataOperationRegistry* registry, | 185 CopyDocumentOperation(OperationRegistry* registry, |
186 const GetDataCallback& callback, | 186 const GetDataCallback& callback, |
187 const std::string& resource_id, | 187 const std::string& resource_id, |
188 const FilePath::StringType& new_name); | 188 const FilePath::StringType& new_name); |
189 virtual ~CopyDocumentOperation(); | 189 virtual ~CopyDocumentOperation(); |
190 | 190 |
191 protected: | 191 protected: |
192 // Overridden from GetDataOperation. | 192 // Overridden from GetDataOperation. |
193 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 193 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
194 | 194 |
195 // Overridden from UrlFetchOperationBase. | 195 // Overridden from UrlFetchOperationBase. |
196 virtual GURL GetURL() const OVERRIDE; | 196 virtual GURL GetURL() const OVERRIDE; |
197 virtual bool GetContentData(std::string* upload_content_type, | 197 virtual bool GetContentData(std::string* upload_content_type, |
198 std::string* upload_content) OVERRIDE; | 198 std::string* upload_content) OVERRIDE; |
199 | 199 |
200 private: | 200 private: |
201 std::string resource_id_; | 201 std::string resource_id_; |
202 FilePath::StringType new_name_; | 202 FilePath::StringType new_name_; |
203 | 203 |
204 DISALLOW_COPY_AND_ASSIGN(CopyDocumentOperation); | 204 DISALLOW_COPY_AND_ASSIGN(CopyDocumentOperation); |
205 }; | 205 }; |
206 | 206 |
207 //=========================== RenameResourceOperation ========================== | 207 //=========================== RenameResourceOperation ========================== |
208 | 208 |
209 // This class performs the operation for renaming a document/file/directory. | 209 // This class performs the operation for renaming a document/file/directory. |
210 class RenameResourceOperation : public EntryActionOperation { | 210 class RenameResourceOperation : public EntryActionOperation { |
211 public: | 211 public: |
212 RenameResourceOperation(GDataOperationRegistry* registry, | 212 RenameResourceOperation(OperationRegistry* registry, |
213 const EntryActionCallback& callback, | 213 const EntryActionCallback& callback, |
214 const GURL& document_url, | 214 const GURL& document_url, |
215 const FilePath::StringType& new_name); | 215 const FilePath::StringType& new_name); |
216 virtual ~RenameResourceOperation(); | 216 virtual ~RenameResourceOperation(); |
217 | 217 |
218 protected: | 218 protected: |
219 // Overridden from EntryActionOperation. | 219 // Overridden from EntryActionOperation. |
220 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 220 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
221 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 221 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
222 | 222 |
223 // Overridden from UrlFetchOperationBase. | 223 // Overridden from UrlFetchOperationBase. |
224 virtual GURL GetURL() const OVERRIDE; | 224 virtual GURL GetURL() const OVERRIDE; |
225 virtual bool GetContentData(std::string* upload_content_type, | 225 virtual bool GetContentData(std::string* upload_content_type, |
226 std::string* upload_content) OVERRIDE; | 226 std::string* upload_content) OVERRIDE; |
227 | 227 |
228 private: | 228 private: |
229 FilePath::StringType new_name_; | 229 FilePath::StringType new_name_; |
230 | 230 |
231 DISALLOW_COPY_AND_ASSIGN(RenameResourceOperation); | 231 DISALLOW_COPY_AND_ASSIGN(RenameResourceOperation); |
232 }; | 232 }; |
233 | 233 |
234 //=========================== AuthorizeAppOperation ========================== | 234 //=========================== AuthorizeAppOperation ========================== |
235 | 235 |
236 // This class performs the operation for renaming a document/file/directory. | 236 // This class performs the operation for renaming a document/file/directory. |
237 class AuthorizeAppsOperation : public GetDataOperation { | 237 class AuthorizeAppsOperation : public GetDataOperation { |
238 public: | 238 public: |
239 AuthorizeAppsOperation(GDataOperationRegistry* registry, | 239 AuthorizeAppsOperation(OperationRegistry* registry, |
240 const GetDataCallback& callback, | 240 const GetDataCallback& callback, |
241 const GURL& document_url, | 241 const GURL& document_url, |
242 const std::string& app_ids); | 242 const std::string& app_ids); |
243 virtual ~AuthorizeAppsOperation(); | 243 virtual ~AuthorizeAppsOperation(); |
244 protected: | 244 protected: |
245 // Overridden from EntryActionOperation. | 245 // Overridden from EntryActionOperation. |
246 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 246 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
247 | 247 |
248 // Overridden from UrlFetchOperationBase. | 248 // Overridden from UrlFetchOperationBase. |
249 virtual bool GetContentData(std::string* upload_content_type, | 249 virtual bool GetContentData(std::string* upload_content_type, |
(...skipping 14 matching lines...) Expand all Loading... |
264 | 264 |
265 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); | 265 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); |
266 }; | 266 }; |
267 | 267 |
268 //======================= AddResourceToDirectoryOperation ====================== | 268 //======================= AddResourceToDirectoryOperation ====================== |
269 | 269 |
270 // This class performs the operation for adding a document/file/directory | 270 // This class performs the operation for adding a document/file/directory |
271 // to a directory. | 271 // to a directory. |
272 class AddResourceToDirectoryOperation : public EntryActionOperation { | 272 class AddResourceToDirectoryOperation : public EntryActionOperation { |
273 public: | 273 public: |
274 AddResourceToDirectoryOperation(GDataOperationRegistry* registry, | 274 AddResourceToDirectoryOperation(OperationRegistry* registry, |
275 const EntryActionCallback& callback, | 275 const EntryActionCallback& callback, |
276 const GURL& parent_content_url, | 276 const GURL& parent_content_url, |
277 const GURL& document_url); | 277 const GURL& document_url); |
278 virtual ~AddResourceToDirectoryOperation(); | 278 virtual ~AddResourceToDirectoryOperation(); |
279 | 279 |
280 protected: | 280 protected: |
281 // Overridden from UrlFetchOperationBase. | 281 // Overridden from UrlFetchOperationBase. |
282 virtual GURL GetURL() const OVERRIDE; | 282 virtual GURL GetURL() const OVERRIDE; |
283 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 283 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
284 virtual bool GetContentData(std::string* upload_content_type, | 284 virtual bool GetContentData(std::string* upload_content_type, |
285 std::string* upload_content) OVERRIDE; | 285 std::string* upload_content) OVERRIDE; |
286 | 286 |
287 private: | 287 private: |
288 GURL parent_content_url_; | 288 GURL parent_content_url_; |
289 | 289 |
290 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); | 290 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); |
291 }; | 291 }; |
292 | 292 |
293 //==================== RemoveResourceFromDirectoryOperation ==================== | 293 //==================== RemoveResourceFromDirectoryOperation ==================== |
294 | 294 |
295 // This class performs the operation for adding a document/file/directory | 295 // This class performs the operation for adding a document/file/directory |
296 // from a directory. | 296 // from a directory. |
297 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { | 297 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { |
298 public: | 298 public: |
299 RemoveResourceFromDirectoryOperation(GDataOperationRegistry* registry, | 299 RemoveResourceFromDirectoryOperation(OperationRegistry* registry, |
300 const EntryActionCallback& callback, | 300 const EntryActionCallback& callback, |
301 const GURL& parent_content_url, | 301 const GURL& parent_content_url, |
302 const GURL& document_url, | 302 const GURL& document_url, |
303 const std::string& resource_id); | 303 const std::string& resource_id); |
304 virtual ~RemoveResourceFromDirectoryOperation(); | 304 virtual ~RemoveResourceFromDirectoryOperation(); |
305 | 305 |
306 protected: | 306 protected: |
307 // Overridden from UrlFetchOperationBase. | 307 // Overridden from UrlFetchOperationBase. |
308 virtual GURL GetURL() const OVERRIDE; | 308 virtual GURL GetURL() const OVERRIDE; |
309 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 309 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 const FilePath& virtual_path; | 345 const FilePath& virtual_path; |
346 }; | 346 }; |
347 | 347 |
348 // Callback type for DocumentServiceInterface::InitiateUpload. | 348 // Callback type for DocumentServiceInterface::InitiateUpload. |
349 typedef base::Callback<void(GDataErrorCode error, | 349 typedef base::Callback<void(GDataErrorCode error, |
350 const GURL& upload_url)> InitiateUploadCallback; | 350 const GURL& upload_url)> InitiateUploadCallback; |
351 | 351 |
352 // This class performs the operation for initiating the upload of a file. | 352 // This class performs the operation for initiating the upload of a file. |
353 class InitiateUploadOperation : public UrlFetchOperationBase { | 353 class InitiateUploadOperation : public UrlFetchOperationBase { |
354 public: | 354 public: |
355 InitiateUploadOperation(GDataOperationRegistry* registry, | 355 InitiateUploadOperation(OperationRegistry* registry, |
356 const InitiateUploadCallback& callback, | 356 const InitiateUploadCallback& callback, |
357 const InitiateUploadParams& params); | 357 const InitiateUploadParams& params); |
358 virtual ~InitiateUploadOperation(); | 358 virtual ~InitiateUploadOperation(); |
359 | 359 |
360 protected: | 360 protected: |
361 // Overridden from UrlFetchOperationBase. | 361 // Overridden from UrlFetchOperationBase. |
362 virtual GURL GetURL() const OVERRIDE; | 362 virtual GURL GetURL() const OVERRIDE; |
363 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 363 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
364 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 364 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
365 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 365 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 ~ResumeUploadParams(); | 407 ~ResumeUploadParams(); |
408 | 408 |
409 UploadMode upload_mode; // Mode of the upload. | 409 UploadMode upload_mode; // Mode of the upload. |
410 int64 start_range; // Start of range of contents currently stored in |buf|. | 410 int64 start_range; // Start of range of contents currently stored in |buf|. |
411 int64 end_range; // End of range of contents currently stored in |buf|. | 411 int64 end_range; // End of range of contents currently stored in |buf|. |
412 int64 content_length; // File content-Length. | 412 int64 content_length; // File content-Length. |
413 std::string content_type; // Content-Type of file. | 413 std::string content_type; // Content-Type of file. |
414 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. | 414 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. |
415 GURL upload_location; // Url of where to upload the file to. | 415 GURL upload_location; // Url of where to upload the file to. |
416 // Virtual GData path of the file seen in the UI. Not necessary for | 416 // Virtual GData path of the file seen in the UI. Not necessary for |
417 // resuming an upload, but used for adding an entry to | 417 // resuming an upload, but used for adding an entry to OperationRegistry. |
418 // GDataOperationRegistry. | |
419 FilePath virtual_path; | 418 FilePath virtual_path; |
420 }; | 419 }; |
421 | 420 |
422 // Callback type for DocumentServiceInterface::ResumeUpload. | 421 // Callback type for DocumentServiceInterface::ResumeUpload. |
423 typedef base::Callback<void( | 422 typedef base::Callback<void( |
424 const ResumeUploadResponse& response, | 423 const ResumeUploadResponse& response, |
425 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; | 424 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; |
426 | 425 |
427 // This class performs the operation for resuming the upload of a file. | 426 // This class performs the operation for resuming the upload of a file. |
428 class ResumeUploadOperation : public UrlFetchOperationBase { | 427 class ResumeUploadOperation : public UrlFetchOperationBase { |
429 public: | 428 public: |
430 ResumeUploadOperation(GDataOperationRegistry* registry, | 429 ResumeUploadOperation(OperationRegistry* registry, |
431 const ResumeUploadCallback& callback, | 430 const ResumeUploadCallback& callback, |
432 const ResumeUploadParams& params); | 431 const ResumeUploadParams& params); |
433 virtual ~ResumeUploadOperation(); | 432 virtual ~ResumeUploadOperation(); |
434 | 433 |
435 protected: | 434 protected: |
436 // Overridden from UrlFetchOperationBase. | 435 // Overridden from UrlFetchOperationBase. |
437 virtual GURL GetURL() const OVERRIDE; | 436 virtual GURL GetURL() const OVERRIDE; |
438 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 437 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
439 virtual void NotifyStartToOperationRegistry() OVERRIDE; | 438 virtual void NotifyStartToOperationRegistry() OVERRIDE; |
440 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 439 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
(...skipping 15 matching lines...) Expand all Loading... |
456 bool last_chunk_completed_; | 455 bool last_chunk_completed_; |
457 | 456 |
458 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | 457 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); |
459 }; | 458 }; |
460 | 459 |
461 //========================== GetContactGroupsOperation ========================= | 460 //========================== GetContactGroupsOperation ========================= |
462 | 461 |
463 // This class fetches a JSON feed containing a user's contact groups. | 462 // This class fetches a JSON feed containing a user's contact groups. |
464 class GetContactGroupsOperation : public GetDataOperation { | 463 class GetContactGroupsOperation : public GetDataOperation { |
465 public: | 464 public: |
466 GetContactGroupsOperation(GDataOperationRegistry* registry, | 465 GetContactGroupsOperation(OperationRegistry* registry, |
467 const GetDataCallback& callback); | 466 const GetDataCallback& callback); |
468 virtual ~GetContactGroupsOperation(); | 467 virtual ~GetContactGroupsOperation(); |
469 | 468 |
470 void set_feed_url_for_testing(const GURL& url) { | 469 void set_feed_url_for_testing(const GURL& url) { |
471 feed_url_for_testing_ = url; | 470 feed_url_for_testing_ = url; |
472 } | 471 } |
473 | 472 |
474 protected: | 473 protected: |
475 // Overridden from GetDataOperation. | 474 // Overridden from GetDataOperation. |
476 virtual GURL GetURL() const OVERRIDE; | 475 virtual GURL GetURL() const OVERRIDE; |
477 | 476 |
478 private: | 477 private: |
479 // If non-empty, URL of the feed to fetch. | 478 // If non-empty, URL of the feed to fetch. |
480 GURL feed_url_for_testing_; | 479 GURL feed_url_for_testing_; |
481 | 480 |
482 DISALLOW_COPY_AND_ASSIGN(GetContactGroupsOperation); | 481 DISALLOW_COPY_AND_ASSIGN(GetContactGroupsOperation); |
483 }; | 482 }; |
484 | 483 |
485 //============================ GetContactsOperation ============================ | 484 //============================ GetContactsOperation ============================ |
486 | 485 |
487 // This class fetches a JSON feed containing a user's contacts. | 486 // This class fetches a JSON feed containing a user's contacts. |
488 class GetContactsOperation : public GetDataOperation { | 487 class GetContactsOperation : public GetDataOperation { |
489 public: | 488 public: |
490 GetContactsOperation(GDataOperationRegistry* registry, | 489 GetContactsOperation(OperationRegistry* registry, |
491 const std::string& group_id, | 490 const std::string& group_id, |
492 const base::Time& min_update_time, | 491 const base::Time& min_update_time, |
493 const GetDataCallback& callback); | 492 const GetDataCallback& callback); |
494 virtual ~GetContactsOperation(); | 493 virtual ~GetContactsOperation(); |
495 | 494 |
496 void set_feed_url_for_testing(const GURL& url) { | 495 void set_feed_url_for_testing(const GURL& url) { |
497 feed_url_for_testing_ = url; | 496 feed_url_for_testing_ = url; |
498 } | 497 } |
499 | 498 |
500 protected: | 499 protected: |
(...skipping 14 matching lines...) Expand all Loading... |
515 base::Time min_update_time_; | 514 base::Time min_update_time_; |
516 | 515 |
517 DISALLOW_COPY_AND_ASSIGN(GetContactsOperation); | 516 DISALLOW_COPY_AND_ASSIGN(GetContactsOperation); |
518 }; | 517 }; |
519 | 518 |
520 //========================== GetContactPhotoOperation ========================== | 519 //========================== GetContactPhotoOperation ========================== |
521 | 520 |
522 // This class fetches a contact's photo. | 521 // This class fetches a contact's photo. |
523 class GetContactPhotoOperation : public UrlFetchOperationBase { | 522 class GetContactPhotoOperation : public UrlFetchOperationBase { |
524 public: | 523 public: |
525 GetContactPhotoOperation(GDataOperationRegistry* registry, | 524 GetContactPhotoOperation(OperationRegistry* registry, |
526 const GURL& photo_url, | 525 const GURL& photo_url, |
527 const GetContentCallback& callback); | 526 const GetContentCallback& callback); |
528 virtual ~GetContactPhotoOperation(); | 527 virtual ~GetContactPhotoOperation(); |
529 | 528 |
530 protected: | 529 protected: |
531 // Overridden from UrlFetchOperationBase. | 530 // Overridden from UrlFetchOperationBase. |
532 virtual GURL GetURL() const OVERRIDE; | 531 virtual GURL GetURL() const OVERRIDE; |
533 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 532 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
534 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 533 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
535 | 534 |
536 private: | 535 private: |
537 // Location of the photo to fetch. | 536 // Location of the photo to fetch. |
538 GURL photo_url_; | 537 GURL photo_url_; |
539 | 538 |
540 // Callback to which the photo data is passed. | 539 // Callback to which the photo data is passed. |
541 GetContentCallback callback_; | 540 GetContentCallback callback_; |
542 | 541 |
543 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); | 542 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); |
544 }; | 543 }; |
545 | 544 |
546 } // namespace gdata | 545 } // namespace gdata |
547 | 546 |
548 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 547 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
OLD | NEW |