| 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 | 244 |
| 245 protected: | 245 protected: |
| 246 // Overridden from EntryActionOperation. | 246 // Overridden from EntryActionOperation. |
| 247 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 247 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 248 | 248 |
| 249 // Overridden from UrlFetchOperationBase. | 249 // Overridden from UrlFetchOperationBase. |
| 250 virtual bool GetContentData(std::string* upload_content_type, | 250 virtual bool GetContentData(std::string* upload_content_type, |
| 251 std::string* upload_content) OVERRIDE; | 251 std::string* upload_content) OVERRIDE; |
| 252 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 252 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 266 | 266 |
| 267 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); | 267 DISALLOW_COPY_AND_ASSIGN(AuthorizeAppsOperation); |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 //======================= AddResourceToDirectoryOperation ====================== | 270 //======================= AddResourceToDirectoryOperation ====================== |
| 271 | 271 |
| 272 // This class performs the operation for adding a document/file/directory | 272 // This class performs the operation for adding a document/file/directory |
| 273 // to a directory. | 273 // to a directory. |
| 274 class AddResourceToDirectoryOperation : public EntryActionOperation { | 274 class AddResourceToDirectoryOperation : public EntryActionOperation { |
| 275 public: | 275 public: |
| 276 AddResourceToDirectoryOperation(GDataOperationRegistry* registry, | 276 AddResourceToDirectoryOperation(OperationRegistry* registry, |
| 277 const EntryActionCallback& callback, | 277 const EntryActionCallback& callback, |
| 278 const GURL& parent_content_url, | 278 const GURL& parent_content_url, |
| 279 const GURL& document_url); | 279 const GURL& document_url); |
| 280 virtual ~AddResourceToDirectoryOperation(); | 280 virtual ~AddResourceToDirectoryOperation(); |
| 281 | 281 |
| 282 protected: | 282 protected: |
| 283 // Overridden from UrlFetchOperationBase. | 283 // Overridden from UrlFetchOperationBase. |
| 284 virtual GURL GetURL() const OVERRIDE; | 284 virtual GURL GetURL() const OVERRIDE; |
| 285 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 285 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 286 virtual bool GetContentData(std::string* upload_content_type, | 286 virtual bool GetContentData(std::string* upload_content_type, |
| 287 std::string* upload_content) OVERRIDE; | 287 std::string* upload_content) OVERRIDE; |
| 288 | 288 |
| 289 private: | 289 private: |
| 290 GURL parent_content_url_; | 290 GURL parent_content_url_; |
| 291 | 291 |
| 292 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); | 292 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); |
| 293 }; | 293 }; |
| 294 | 294 |
| 295 //==================== RemoveResourceFromDirectoryOperation ==================== | 295 //==================== RemoveResourceFromDirectoryOperation ==================== |
| 296 | 296 |
| 297 // This class performs the operation for adding a document/file/directory | 297 // This class performs the operation for adding a document/file/directory |
| 298 // from a directory. | 298 // from a directory. |
| 299 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { | 299 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { |
| 300 public: | 300 public: |
| 301 RemoveResourceFromDirectoryOperation(GDataOperationRegistry* registry, | 301 RemoveResourceFromDirectoryOperation(OperationRegistry* registry, |
| 302 const EntryActionCallback& callback, | 302 const EntryActionCallback& callback, |
| 303 const GURL& parent_content_url, | 303 const GURL& parent_content_url, |
| 304 const GURL& document_url, | 304 const GURL& document_url, |
| 305 const std::string& resource_id); | 305 const std::string& resource_id); |
| 306 virtual ~RemoveResourceFromDirectoryOperation(); | 306 virtual ~RemoveResourceFromDirectoryOperation(); |
| 307 | 307 |
| 308 protected: | 308 protected: |
| 309 // Overridden from UrlFetchOperationBase. | 309 // Overridden from UrlFetchOperationBase. |
| 310 virtual GURL GetURL() const OVERRIDE; | 310 virtual GURL GetURL() const OVERRIDE; |
| 311 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 311 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 const FilePath& virtual_path; | 347 const FilePath& virtual_path; |
| 348 }; | 348 }; |
| 349 | 349 |
| 350 // Callback type for DocumentServiceInterface::InitiateUpload. | 350 // Callback type for DocumentServiceInterface::InitiateUpload. |
| 351 typedef base::Callback<void(GDataErrorCode error, | 351 typedef base::Callback<void(GDataErrorCode error, |
| 352 const GURL& upload_url)> InitiateUploadCallback; | 352 const GURL& upload_url)> InitiateUploadCallback; |
| 353 | 353 |
| 354 // This class performs the operation for initiating the upload of a file. | 354 // This class performs the operation for initiating the upload of a file. |
| 355 class InitiateUploadOperation : public UrlFetchOperationBase { | 355 class InitiateUploadOperation : public UrlFetchOperationBase { |
| 356 public: | 356 public: |
| 357 InitiateUploadOperation(GDataOperationRegistry* registry, | 357 InitiateUploadOperation(OperationRegistry* registry, |
| 358 const InitiateUploadCallback& callback, | 358 const InitiateUploadCallback& callback, |
| 359 const InitiateUploadParams& params); | 359 const InitiateUploadParams& params); |
| 360 virtual ~InitiateUploadOperation(); | 360 virtual ~InitiateUploadOperation(); |
| 361 | 361 |
| 362 protected: | 362 protected: |
| 363 // Overridden from UrlFetchOperationBase. | 363 // Overridden from UrlFetchOperationBase. |
| 364 virtual GURL GetURL() const OVERRIDE; | 364 virtual GURL GetURL() const OVERRIDE; |
| 365 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 365 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
| 366 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 366 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
| 367 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 367 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 ~ResumeUploadParams(); | 409 ~ResumeUploadParams(); |
| 410 | 410 |
| 411 UploadMode upload_mode; // Mode of the upload. | 411 UploadMode upload_mode; // Mode of the upload. |
| 412 int64 start_range; // Start of range of contents currently stored in |buf|. | 412 int64 start_range; // Start of range of contents currently stored in |buf|. |
| 413 int64 end_range; // End of range of contents currently stored in |buf|. | 413 int64 end_range; // End of range of contents currently stored in |buf|. |
| 414 int64 content_length; // File content-Length. | 414 int64 content_length; // File content-Length. |
| 415 std::string content_type; // Content-Type of file. | 415 std::string content_type; // Content-Type of file. |
| 416 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. | 416 scoped_refptr<net::IOBuffer> buf; // Holds current content to be uploaded. |
| 417 GURL upload_location; // Url of where to upload the file to. | 417 GURL upload_location; // Url of where to upload the file to. |
| 418 // Virtual GData path of the file seen in the UI. Not necessary for | 418 // Virtual GData path of the file seen in the UI. Not necessary for |
| 419 // resuming an upload, but used for adding an entry to | 419 // resuming an upload, but used for adding an entry to OperationRegistry. |
| 420 // GDataOperationRegistry. | |
| 421 FilePath virtual_path; | 420 FilePath virtual_path; |
| 422 }; | 421 }; |
| 423 | 422 |
| 424 // Callback type for DocumentServiceInterface::ResumeUpload. | 423 // Callback type for DocumentServiceInterface::ResumeUpload. |
| 425 typedef base::Callback<void( | 424 typedef base::Callback<void( |
| 426 const ResumeUploadResponse& response, | 425 const ResumeUploadResponse& response, |
| 427 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; | 426 scoped_ptr<gdata::DocumentEntry> new_entry)> ResumeUploadCallback; |
| 428 | 427 |
| 429 // This class performs the operation for resuming the upload of a file. | 428 // This class performs the operation for resuming the upload of a file. |
| 430 class ResumeUploadOperation : public UrlFetchOperationBase { | 429 class ResumeUploadOperation : public UrlFetchOperationBase { |
| 431 public: | 430 public: |
| 432 ResumeUploadOperation(GDataOperationRegistry* registry, | 431 ResumeUploadOperation(OperationRegistry* registry, |
| 433 const ResumeUploadCallback& callback, | 432 const ResumeUploadCallback& callback, |
| 434 const ResumeUploadParams& params); | 433 const ResumeUploadParams& params); |
| 435 virtual ~ResumeUploadOperation(); | 434 virtual ~ResumeUploadOperation(); |
| 436 | 435 |
| 437 protected: | 436 protected: |
| 438 // Overridden from UrlFetchOperationBase. | 437 // Overridden from UrlFetchOperationBase. |
| 439 virtual GURL GetURL() const OVERRIDE; | 438 virtual GURL GetURL() const OVERRIDE; |
| 440 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 439 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
| 441 virtual void NotifyStartToOperationRegistry() OVERRIDE; | 440 virtual void NotifyStartToOperationRegistry() OVERRIDE; |
| 442 virtual void NotifySuccessToOperationRegistry() OVERRIDE; | 441 virtual void NotifySuccessToOperationRegistry() OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 458 bool last_chunk_completed_; | 457 bool last_chunk_completed_; |
| 459 | 458 |
| 460 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | 459 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); |
| 461 }; | 460 }; |
| 462 | 461 |
| 463 //========================== GetContactGroupsOperation ========================= | 462 //========================== GetContactGroupsOperation ========================= |
| 464 | 463 |
| 465 // This class fetches a JSON feed containing a user's contact groups. | 464 // This class fetches a JSON feed containing a user's contact groups. |
| 466 class GetContactGroupsOperation : public GetDataOperation { | 465 class GetContactGroupsOperation : public GetDataOperation { |
| 467 public: | 466 public: |
| 468 GetContactGroupsOperation(GDataOperationRegistry* registry, | 467 GetContactGroupsOperation(OperationRegistry* registry, |
| 469 const GetDataCallback& callback); | 468 const GetDataCallback& callback); |
| 470 virtual ~GetContactGroupsOperation(); | 469 virtual ~GetContactGroupsOperation(); |
| 471 | 470 |
| 472 void set_feed_url_for_testing(const GURL& url) { | 471 void set_feed_url_for_testing(const GURL& url) { |
| 473 feed_url_for_testing_ = url; | 472 feed_url_for_testing_ = url; |
| 474 } | 473 } |
| 475 | 474 |
| 476 protected: | 475 protected: |
| 477 // Overridden from GetDataOperation. | 476 // Overridden from GetDataOperation. |
| 478 virtual GURL GetURL() const OVERRIDE; | 477 virtual GURL GetURL() const OVERRIDE; |
| 479 | 478 |
| 480 private: | 479 private: |
| 481 // If non-empty, URL of the feed to fetch. | 480 // If non-empty, URL of the feed to fetch. |
| 482 GURL feed_url_for_testing_; | 481 GURL feed_url_for_testing_; |
| 483 | 482 |
| 484 DISALLOW_COPY_AND_ASSIGN(GetContactGroupsOperation); | 483 DISALLOW_COPY_AND_ASSIGN(GetContactGroupsOperation); |
| 485 }; | 484 }; |
| 486 | 485 |
| 487 //============================ GetContactsOperation ============================ | 486 //============================ GetContactsOperation ============================ |
| 488 | 487 |
| 489 // This class fetches a JSON feed containing a user's contacts. | 488 // This class fetches a JSON feed containing a user's contacts. |
| 490 class GetContactsOperation : public GetDataOperation { | 489 class GetContactsOperation : public GetDataOperation { |
| 491 public: | 490 public: |
| 492 GetContactsOperation(GDataOperationRegistry* registry, | 491 GetContactsOperation(OperationRegistry* registry, |
| 493 const std::string& group_id, | 492 const std::string& group_id, |
| 494 const base::Time& min_update_time, | 493 const base::Time& min_update_time, |
| 495 const GetDataCallback& callback); | 494 const GetDataCallback& callback); |
| 496 virtual ~GetContactsOperation(); | 495 virtual ~GetContactsOperation(); |
| 497 | 496 |
| 498 void set_feed_url_for_testing(const GURL& url) { | 497 void set_feed_url_for_testing(const GURL& url) { |
| 499 feed_url_for_testing_ = url; | 498 feed_url_for_testing_ = url; |
| 500 } | 499 } |
| 501 | 500 |
| 502 protected: | 501 protected: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 517 base::Time min_update_time_; | 516 base::Time min_update_time_; |
| 518 | 517 |
| 519 DISALLOW_COPY_AND_ASSIGN(GetContactsOperation); | 518 DISALLOW_COPY_AND_ASSIGN(GetContactsOperation); |
| 520 }; | 519 }; |
| 521 | 520 |
| 522 //========================== GetContactPhotoOperation ========================== | 521 //========================== GetContactPhotoOperation ========================== |
| 523 | 522 |
| 524 // This class fetches a contact's photo. | 523 // This class fetches a contact's photo. |
| 525 class GetContactPhotoOperation : public UrlFetchOperationBase { | 524 class GetContactPhotoOperation : public UrlFetchOperationBase { |
| 526 public: | 525 public: |
| 527 GetContactPhotoOperation(GDataOperationRegistry* registry, | 526 GetContactPhotoOperation(OperationRegistry* registry, |
| 528 const GURL& photo_url, | 527 const GURL& photo_url, |
| 529 const GetContentCallback& callback); | 528 const GetContentCallback& callback); |
| 530 virtual ~GetContactPhotoOperation(); | 529 virtual ~GetContactPhotoOperation(); |
| 531 | 530 |
| 532 protected: | 531 protected: |
| 533 // Overridden from UrlFetchOperationBase. | 532 // Overridden from UrlFetchOperationBase. |
| 534 virtual GURL GetURL() const OVERRIDE; | 533 virtual GURL GetURL() const OVERRIDE; |
| 535 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; | 534 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; |
| 536 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; | 535 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; |
| 537 | 536 |
| 538 private: | 537 private: |
| 539 // Location of the photo to fetch. | 538 // Location of the photo to fetch. |
| 540 GURL photo_url_; | 539 GURL photo_url_; |
| 541 | 540 |
| 542 // Callback to which the photo data is passed. | 541 // Callback to which the photo data is passed. |
| 543 GetContentCallback callback_; | 542 GetContentCallback callback_; |
| 544 | 543 |
| 545 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); | 544 DISALLOW_COPY_AND_ASSIGN(GetContactPhotoOperation); |
| 546 }; | 545 }; |
| 547 | 546 |
| 548 } // namespace gdata | 547 } // namespace gdata |
| 549 | 548 |
| 550 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ | 549 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_OPERATIONS_H_ |
| OLD | NEW |