| 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_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const GDataWapiUrlGenerator url_generator_; | 69 const GDataWapiUrlGenerator url_generator_; |
| 70 const GURL override_url_; | 70 const GURL override_url_; |
| 71 const int start_changestamp_; | 71 const int start_changestamp_; |
| 72 const std::string search_string_; | 72 const std::string search_string_; |
| 73 const bool shared_with_me_; | 73 const bool shared_with_me_; |
| 74 const std::string directory_resource_id_; | 74 const std::string directory_resource_id_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(GetDocumentsOperation); | 76 DISALLOW_COPY_AND_ASSIGN(GetDocumentsOperation); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 //========================= GetDocumentEntryOperation ========================== | 79 //========================= GetResourceEntryOperation ========================== |
| 80 | 80 |
| 81 // This class performs the operation for fetching a single document entry. | 81 // This class performs the operation for fetching a single resource entry. |
| 82 class GetDocumentEntryOperation : public GetDataOperation { | 82 class GetResourceEntryOperation : public GetDataOperation { |
| 83 public: | 83 public: |
| 84 // |callback| must not be null. | 84 // |callback| must not be null. |
| 85 GetDocumentEntryOperation( | 85 GetResourceEntryOperation( |
| 86 OperationRegistry* registry, | 86 OperationRegistry* registry, |
| 87 net::URLRequestContextGetter* url_request_context_getter, | 87 net::URLRequestContextGetter* url_request_context_getter, |
| 88 const GDataWapiUrlGenerator& url_generator, | 88 const GDataWapiUrlGenerator& url_generator, |
| 89 const std::string& resource_id, | 89 const std::string& resource_id, |
| 90 const GetDataCallback& callback); | 90 const GetDataCallback& callback); |
| 91 virtual ~GetDocumentEntryOperation(); | 91 virtual ~GetResourceEntryOperation(); |
| 92 | 92 |
| 93 protected: | 93 protected: |
| 94 // UrlFetchOperationBase overrides. | 94 // UrlFetchOperationBase overrides. |
| 95 virtual GURL GetURL() const OVERRIDE; | 95 virtual GURL GetURL() const OVERRIDE; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 const GDataWapiUrlGenerator url_generator_; | 98 const GDataWapiUrlGenerator url_generator_; |
| 99 // Resource id of the requested entry. | 99 // Resource id of the requested entry. |
| 100 const std::string resource_id_; | 100 const std::string resource_id_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(GetDocumentEntryOperation); | 102 DISALLOW_COPY_AND_ASSIGN(GetResourceEntryOperation); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 //========================= GetAccountMetadataOperation ======================== | 105 //========================= GetAccountMetadataOperation ======================== |
| 106 | 106 |
| 107 // This class performs the operation for fetching account metadata. | 107 // This class performs the operation for fetching account metadata. |
| 108 class GetAccountMetadataOperation : public GetDataOperation { | 108 class GetAccountMetadataOperation : public GetDataOperation { |
| 109 public: | 109 public: |
| 110 // |callback| must not be null. | 110 // |callback| must not be null. |
| 111 GetAccountMetadataOperation( | 111 GetAccountMetadataOperation( |
| 112 OperationRegistry* registry, | 112 OperationRegistry* registry, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 scoped_ptr<std::string> download_data) OVERRIDE; | 176 scoped_ptr<std::string> download_data) OVERRIDE; |
| 177 | 177 |
| 178 private: | 178 private: |
| 179 const DownloadActionCallback download_action_callback_; | 179 const DownloadActionCallback download_action_callback_; |
| 180 const GetContentCallback get_content_callback_; | 180 const GetContentCallback get_content_callback_; |
| 181 const GURL content_url_; | 181 const GURL content_url_; |
| 182 | 182 |
| 183 DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation); | 183 DISALLOW_COPY_AND_ASSIGN(DownloadFileOperation); |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 //=========================== DeleteDocumentOperation ========================== | 186 //=========================== DeleteResourceOperation ========================== |
| 187 | 187 |
| 188 // This class performs the operation for deleting a document. | 188 // This class performs the operation for deleting a resource. |
| 189 class DeleteDocumentOperation : public EntryActionOperation { | 189 // |
| 190 // In WAPI, "gd:deleted" means that the resource was put in the trash, and |
| 191 // "docs:removed" means its permanently gone. Since what the class does is to |
| 192 // put the resource into trash, we have chosen "Delete" in the name, even though |
| 193 // we are preferring the term "Remove" in drive/google_api code. |
| 194 class DeleteResourceOperation : public EntryActionOperation { |
| 190 public: | 195 public: |
| 191 // |callback| must not be null. | 196 // |callback| must not be null. |
| 192 DeleteDocumentOperation( | 197 DeleteResourceOperation( |
| 193 OperationRegistry* registry, | 198 OperationRegistry* registry, |
| 194 net::URLRequestContextGetter* url_request_context_getter, | 199 net::URLRequestContextGetter* url_request_context_getter, |
| 195 const EntryActionCallback& callback, | 200 const EntryActionCallback& callback, |
| 196 const GURL& edit_url); | 201 const GURL& edit_url); |
| 197 virtual ~DeleteDocumentOperation(); | 202 virtual ~DeleteResourceOperation(); |
| 198 | 203 |
| 199 protected: | 204 protected: |
| 200 // UrlFetchOperationBase overrides. | 205 // UrlFetchOperationBase overrides. |
| 201 virtual GURL GetURL() const OVERRIDE; | 206 virtual GURL GetURL() const OVERRIDE; |
| 202 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 207 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 203 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; | 208 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
| 204 | 209 |
| 205 private: | 210 private: |
| 206 const GURL edit_url_; | 211 const GURL edit_url_; |
| 207 | 212 |
| 208 DISALLOW_COPY_AND_ASSIGN(DeleteDocumentOperation); | 213 DISALLOW_COPY_AND_ASSIGN(DeleteResourceOperation); |
| 209 }; | 214 }; |
| 210 | 215 |
| 211 //========================== CreateDirectoryOperation ========================== | 216 //========================== CreateDirectoryOperation ========================== |
| 212 | 217 |
| 213 // This class performs the operation for creating a directory. | 218 // This class performs the operation for creating a directory. |
| 214 class CreateDirectoryOperation : public GetDataOperation { | 219 class CreateDirectoryOperation : public GetDataOperation { |
| 215 public: | 220 public: |
| 216 // A new directory will be created under a directory specified by | 221 // A new directory will be created under a directory specified by |
| 217 // |parent_content_url|. If this parameter is empty, a new directory will | 222 // |parent_content_url|. If this parameter is empty, a new directory will |
| 218 // be created in the root directory. | 223 // be created in the root directory. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 234 std::string* upload_content) OVERRIDE; | 239 std::string* upload_content) OVERRIDE; |
| 235 | 240 |
| 236 private: | 241 private: |
| 237 const GDataWapiUrlGenerator url_generator_; | 242 const GDataWapiUrlGenerator url_generator_; |
| 238 const GURL parent_content_url_; | 243 const GURL parent_content_url_; |
| 239 const FilePath::StringType directory_name_; | 244 const FilePath::StringType directory_name_; |
| 240 | 245 |
| 241 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | 246 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); |
| 242 }; | 247 }; |
| 243 | 248 |
| 244 //============================ CopyDocumentOperation =========================== | 249 //============================ CopyHostedDocumentOperation ===================== |
| 245 | 250 |
| 246 // This class performs the operation for making a copy of a hosted document. | 251 // This class performs the operation for making a copy of a hosted document. |
| 247 // Note that this function cannot be used to copy regular files, as it's not | 252 // Note that this function cannot be used to copy regular files, as it's not |
| 248 // supported by WAPI. | 253 // supported by WAPI. |
| 249 class CopyDocumentOperation : public GetDataOperation { | 254 class CopyHostedDocumentOperation : public GetDataOperation { |
| 250 public: | 255 public: |
| 251 // |callback| must not be null. | 256 // |callback| must not be null. |
| 252 CopyDocumentOperation( | 257 CopyHostedDocumentOperation( |
| 253 OperationRegistry* registry, | 258 OperationRegistry* registry, |
| 254 net::URLRequestContextGetter* url_request_context_getter, | 259 net::URLRequestContextGetter* url_request_context_getter, |
| 255 const GDataWapiUrlGenerator& url_generator, | 260 const GDataWapiUrlGenerator& url_generator, |
| 256 const GetDataCallback& callback, | 261 const GetDataCallback& callback, |
| 257 const std::string& resource_id, | 262 const std::string& resource_id, |
| 258 const FilePath::StringType& new_name); | 263 const FilePath::StringType& new_name); |
| 259 virtual ~CopyDocumentOperation(); | 264 virtual ~CopyHostedDocumentOperation(); |
| 260 | 265 |
| 261 protected: | 266 protected: |
| 262 // UrlFetchOperationBase overrides. | 267 // UrlFetchOperationBase overrides. |
| 263 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 268 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 264 virtual GURL GetURL() const OVERRIDE; | 269 virtual GURL GetURL() const OVERRIDE; |
| 265 virtual bool GetContentData(std::string* upload_content_type, | 270 virtual bool GetContentData(std::string* upload_content_type, |
| 266 std::string* upload_content) OVERRIDE; | 271 std::string* upload_content) OVERRIDE; |
| 267 | 272 |
| 268 private: | 273 private: |
| 269 const GDataWapiUrlGenerator url_generator_; | 274 const GDataWapiUrlGenerator url_generator_; |
| 270 const std::string resource_id_; | 275 const std::string resource_id_; |
| 271 const FilePath::StringType new_name_; | 276 const FilePath::StringType new_name_; |
| 272 | 277 |
| 273 DISALLOW_COPY_AND_ASSIGN(CopyDocumentOperation); | 278 DISALLOW_COPY_AND_ASSIGN(CopyHostedDocumentOperation); |
| 274 }; | 279 }; |
| 275 | 280 |
| 276 //=========================== RenameResourceOperation ========================== | 281 //=========================== RenameResourceOperation ========================== |
| 277 | 282 |
| 278 // This class performs the operation for renaming a document/file/directory. | 283 // This class performs the operation for renaming a document/file/directory. |
| 279 class RenameResourceOperation : public EntryActionOperation { | 284 class RenameResourceOperation : public EntryActionOperation { |
| 280 public: | 285 public: |
| 281 // |callback| must not be null. | 286 // |callback| must not be null. |
| 282 RenameResourceOperation( | 287 RenameResourceOperation( |
| 283 OperationRegistry* registry, | 288 OperationRegistry* registry, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 private: | 369 private: |
| 365 const GDataWapiUrlGenerator url_generator_; | 370 const GDataWapiUrlGenerator url_generator_; |
| 366 const GURL parent_content_url_; | 371 const GURL parent_content_url_; |
| 367 const GURL edit_url_; | 372 const GURL edit_url_; |
| 368 | 373 |
| 369 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); | 374 DISALLOW_COPY_AND_ASSIGN(AddResourceToDirectoryOperation); |
| 370 }; | 375 }; |
| 371 | 376 |
| 372 //==================== RemoveResourceFromDirectoryOperation ==================== | 377 //==================== RemoveResourceFromDirectoryOperation ==================== |
| 373 | 378 |
| 374 // This class performs the operation for adding a document/file/directory | 379 // This class performs the operation for removing a document/file/directory |
| 375 // from a directory. | 380 // from a directory. |
| 376 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { | 381 class RemoveResourceFromDirectoryOperation : public EntryActionOperation { |
| 377 public: | 382 public: |
| 378 // |callback| must not be null. | 383 // |callback| must not be null. |
| 379 RemoveResourceFromDirectoryOperation( | 384 RemoveResourceFromDirectoryOperation( |
| 380 OperationRegistry* registry, | 385 OperationRegistry* registry, |
| 381 net::URLRequestContextGetter* url_request_context_getter, | 386 net::URLRequestContextGetter* url_request_context_getter, |
| 382 const EntryActionCallback& callback, | 387 const EntryActionCallback& callback, |
| 383 const GURL& parent_content_url, | 388 const GURL& parent_content_url, |
| 384 const std::string& resource_id); | 389 const std::string& resource_id); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 const ResumeUploadCallback callback_; | 574 const ResumeUploadCallback callback_; |
| 570 const ResumeUploadParams params_; | 575 const ResumeUploadParams params_; |
| 571 bool last_chunk_completed_; | 576 bool last_chunk_completed_; |
| 572 | 577 |
| 573 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | 578 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); |
| 574 }; | 579 }; |
| 575 | 580 |
| 576 } // namespace google_apis | 581 } // namespace google_apis |
| 577 | 582 |
| 578 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ | 583 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ |
| OLD | NEW |