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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 public: | 161 public: |
162 EntryActionOperation(GDataOperationRegistry* registry, | 162 EntryActionOperation(GDataOperationRegistry* registry, |
163 Profile* profile, | 163 Profile* profile, |
164 const EntryActionCallback& callback, | 164 const EntryActionCallback& callback, |
165 const GURL& document_url); | 165 const GURL& document_url); |
166 virtual ~EntryActionOperation(); | 166 virtual ~EntryActionOperation(); |
167 | 167 |
168 protected: | 168 protected: |
169 // Overridden from UrlFetchOperationBase. | 169 // Overridden from UrlFetchOperationBase. |
170 virtual GURL GetURL() const OVERRIDE; | 170 virtual GURL GetURL() const OVERRIDE; |
171 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) | 171 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
172 OVERRIDE; | |
173 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 172 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
174 | 173 |
175 const GURL& document_url() const { return document_url_; } | 174 const GURL& document_url() const { return document_url_; } |
176 | 175 |
177 private: | 176 private: |
178 EntryActionCallback callback_; | 177 EntryActionCallback callback_; |
179 GURL document_url_; | 178 GURL document_url_; |
180 | 179 |
181 DISALLOW_COPY_AND_ASSIGN(EntryActionOperation); | 180 DISALLOW_COPY_AND_ASSIGN(EntryActionOperation); |
182 }; | 181 }; |
183 | 182 |
184 //============================== GetDataOperation ============================== | 183 //============================== GetDataOperation ============================== |
185 | 184 |
186 // This class performs the operation for fetching and parsing JSON data content. | 185 // This class performs the operation for fetching and parsing JSON data content. |
187 class GetDataOperation : public UrlFetchOperationBase { | 186 class GetDataOperation : public UrlFetchOperationBase { |
188 public: | 187 public: |
189 GetDataOperation(GDataOperationRegistry* registry, | 188 GetDataOperation(GDataOperationRegistry* registry, |
190 Profile* profile, | 189 Profile* profile, |
191 const GetDataCallback& callback); | 190 const GetDataCallback& callback); |
192 virtual ~GetDataOperation(); | 191 virtual ~GetDataOperation(); |
193 | 192 |
194 // Parse GData JSON response. | 193 // Parse GData JSON response. |
195 virtual base::Value* ParseResponse(const std::string& data); | 194 virtual base::Value* ParseResponse(const std::string& data); |
196 | 195 |
197 protected: | 196 protected: |
198 // Overridden from UrlFetchOperationBase. | 197 // Overridden from UrlFetchOperationBase. |
199 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) | 198 virtual bool ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
200 OVERRIDE; | |
201 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 199 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
202 | 200 |
203 private: | 201 private: |
204 GetDataCallback callback_; | 202 GetDataCallback callback_; |
205 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); | 203 DISALLOW_COPY_AND_ASSIGN(GetDataOperation); |
206 }; | 204 }; |
207 | 205 |
208 //============================ GetDocumentsOperation =========================== | 206 //============================ GetDocumentsOperation =========================== |
209 | 207 |
210 // This class performs the operation for fetching a document list. | 208 // This class performs the operation for fetching a document list. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 DISALLOW_COPY_AND_ASSIGN(GetDocumentEntryOperation); | 255 DISALLOW_COPY_AND_ASSIGN(GetDocumentEntryOperation); |
258 }; | 256 }; |
259 | 257 |
260 //========================= GetAccountMetadataOperation ======================== | 258 //========================= GetAccountMetadataOperation ======================== |
261 | 259 |
262 // This class performs the operation for fetching account metadata. | 260 // This class performs the operation for fetching account metadata. |
263 class GetAccountMetadataOperation : public GetDataOperation { | 261 class GetAccountMetadataOperation : public GetDataOperation { |
264 public: | 262 public: |
265 GetAccountMetadataOperation(GDataOperationRegistry* registry, | 263 GetAccountMetadataOperation(GDataOperationRegistry* registry, |
266 Profile* profile, | 264 Profile* profile, |
267 const GetDataCallback& callback); | 265 const GetDataCallback& callback, |
| 266 bool use_drive_api); |
268 virtual ~GetAccountMetadataOperation(); | 267 virtual ~GetAccountMetadataOperation(); |
269 | 268 |
270 protected: | 269 protected: |
271 // Overridden from GetDataOperation. | 270 // Overridden from GetDataOperation. |
272 virtual GURL GetURL() const OVERRIDE; | 271 virtual GURL GetURL() const OVERRIDE; |
273 | 272 |
274 private: | 273 private: |
| 274 // True if Drive v2 API is used. |
| 275 bool use_drive_api_; |
| 276 |
275 DISALLOW_COPY_AND_ASSIGN(GetAccountMetadataOperation); | 277 DISALLOW_COPY_AND_ASSIGN(GetAccountMetadataOperation); |
276 }; | 278 }; |
277 | 279 |
278 //============================ DownloadFileOperation =========================== | 280 //============================ DownloadFileOperation =========================== |
279 | 281 |
280 // This class performs the operation for downloading of a given document/file. | 282 // This class performs the operation for downloading of a given document/file. |
281 class DownloadFileOperation : public UrlFetchOperationBase { | 283 class DownloadFileOperation : public UrlFetchOperationBase { |
282 public: | 284 public: |
283 DownloadFileOperation( | 285 DownloadFileOperation( |
284 GDataOperationRegistry* registry, | 286 GDataOperationRegistry* registry, |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 ResumeUploadCallback callback_; | 577 ResumeUploadCallback callback_; |
576 ResumeUploadParams params_; | 578 ResumeUploadParams params_; |
577 bool last_chunk_completed_; | 579 bool last_chunk_completed_; |
578 | 580 |
579 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | 581 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); |
580 }; | 582 }; |
581 | 583 |
582 } // namespace gdata | 584 } // namespace gdata |
583 | 585 |
584 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 586 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
OLD | NEW |