| 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_DRIVE_API_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 typedef base::Callback<void(GDataErrorCode error, | 25 typedef base::Callback<void(GDataErrorCode error, |
| 26 scoped_ptr<FileResource> entry)> | 26 scoped_ptr<FileResource> entry)> |
| 27 FileResourceCallback; | 27 FileResourceCallback; |
| 28 | 28 |
| 29 | 29 |
| 30 //============================== GetAboutOperation ============================= | 30 //============================== GetAboutOperation ============================= |
| 31 | 31 |
| 32 // This class performs the operation for fetching About data. | 32 // This class performs the operation for fetching About data. |
| 33 class GetAboutOperation : public GetDataOperation { | 33 class GetAboutOperation : public GetDataOperation { |
| 34 public: | 34 public: |
| 35 GetAboutOperation(OperationRegistry* registry, | 35 GetAboutOperation(OperationRunner* runner, |
| 36 net::URLRequestContextGetter* url_request_context_getter, | 36 net::URLRequestContextGetter* url_request_context_getter, |
| 37 const DriveApiUrlGenerator& url_generator, | 37 const DriveApiUrlGenerator& url_generator, |
| 38 const GetAboutResourceCallback& callback); | 38 const GetAboutResourceCallback& callback); |
| 39 virtual ~GetAboutOperation(); | 39 virtual ~GetAboutOperation(); |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 // Overridden from GetDataOperation. | 42 // Overridden from GetDataOperation. |
| 43 virtual GURL GetURL() const OVERRIDE; | 43 virtual GURL GetURL() const OVERRIDE; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 const DriveApiUrlGenerator url_generator_; | 46 const DriveApiUrlGenerator url_generator_; |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(GetAboutOperation); | 48 DISALLOW_COPY_AND_ASSIGN(GetAboutOperation); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 //============================= GetApplistOperation ============================ | 51 //============================= GetApplistOperation ============================ |
| 52 | 52 |
| 53 // This class performs the operation for fetching Applist. | 53 // This class performs the operation for fetching Applist. |
| 54 class GetApplistOperation : public GetDataOperation { | 54 class GetApplistOperation : public GetDataOperation { |
| 55 public: | 55 public: |
| 56 GetApplistOperation(OperationRegistry* registry, | 56 GetApplistOperation(OperationRunner* runner, |
| 57 net::URLRequestContextGetter* url_request_context_getter, | 57 net::URLRequestContextGetter* url_request_context_getter, |
| 58 const DriveApiUrlGenerator& url_generator, | 58 const DriveApiUrlGenerator& url_generator, |
| 59 const GetDataCallback& callback); | 59 const GetDataCallback& callback); |
| 60 virtual ~GetApplistOperation(); | 60 virtual ~GetApplistOperation(); |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 // Overridden from GetDataOperation. | 63 // Overridden from GetDataOperation. |
| 64 virtual GURL GetURL() const OVERRIDE; | 64 virtual GURL GetURL() const OVERRIDE; |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 const DriveApiUrlGenerator url_generator_; | 67 const DriveApiUrlGenerator url_generator_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(GetApplistOperation); | 69 DISALLOW_COPY_AND_ASSIGN(GetApplistOperation); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 //============================ GetChangelistOperation ========================== | 72 //============================ GetChangelistOperation ========================== |
| 73 | 73 |
| 74 // This class performs the operation for fetching changelist. | 74 // This class performs the operation for fetching changelist. |
| 75 // The result may contain only first part of the result. The remaining result | 75 // The result may contain only first part of the result. The remaining result |
| 76 // should be able to be fetched by ContinueGetFileListOperation defined below. | 76 // should be able to be fetched by ContinueGetFileListOperation defined below. |
| 77 class GetChangelistOperation : public GetDataOperation { | 77 class GetChangelistOperation : public GetDataOperation { |
| 78 public: | 78 public: |
| 79 // |include_deleted| specifies if the response should contain the changes | 79 // |include_deleted| specifies if the response should contain the changes |
| 80 // for deleted entries or not. | 80 // for deleted entries or not. |
| 81 // |start_changestamp| specifies the starting point of change list or 0 if | 81 // |start_changestamp| specifies the starting point of change list or 0 if |
| 82 // all changes are necessary. | 82 // all changes are necessary. |
| 83 // |max_results| specifies the max of the number of files resource in the | 83 // |max_results| specifies the max of the number of files resource in the |
| 84 // response. | 84 // response. |
| 85 GetChangelistOperation( | 85 GetChangelistOperation( |
| 86 OperationRegistry* registry, | 86 OperationRunner* runner, |
| 87 net::URLRequestContextGetter* url_request_context_getter, | 87 net::URLRequestContextGetter* url_request_context_getter, |
| 88 const DriveApiUrlGenerator& url_generator, | 88 const DriveApiUrlGenerator& url_generator, |
| 89 bool include_deleted, | 89 bool include_deleted, |
| 90 int64 start_changestamp, | 90 int64 start_changestamp, |
| 91 int max_results, | 91 int max_results, |
| 92 const GetDataCallback& callback); | 92 const GetDataCallback& callback); |
| 93 virtual ~GetChangelistOperation(); | 93 virtual ~GetChangelistOperation(); |
| 94 | 94 |
| 95 protected: | 95 protected: |
| 96 // Overridden from GetDataOperation. | 96 // Overridden from GetDataOperation. |
| 97 virtual GURL GetURL() const OVERRIDE; | 97 virtual GURL GetURL() const OVERRIDE; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 const DriveApiUrlGenerator url_generator_; | 100 const DriveApiUrlGenerator url_generator_; |
| 101 const bool include_deleted_; | 101 const bool include_deleted_; |
| 102 const int64 start_changestamp_; | 102 const int64 start_changestamp_; |
| 103 const int max_results_; | 103 const int max_results_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(GetChangelistOperation); | 105 DISALLOW_COPY_AND_ASSIGN(GetChangelistOperation); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 //============================= GetFilelistOperation =========================== | 108 //============================= GetFilelistOperation =========================== |
| 109 | 109 |
| 110 // This class performs the operation for fetching Filelist. | 110 // This class performs the operation for fetching Filelist. |
| 111 // The result may contain only first part of the result. The remaining result | 111 // The result may contain only first part of the result. The remaining result |
| 112 // should be able to be fetched by ContinueGetFileListOperation defined below. | 112 // should be able to be fetched by ContinueGetFileListOperation defined below. |
| 113 class GetFilelistOperation : public GetDataOperation { | 113 class GetFilelistOperation : public GetDataOperation { |
| 114 public: | 114 public: |
| 115 GetFilelistOperation( | 115 GetFilelistOperation( |
| 116 OperationRegistry* registry, | 116 OperationRunner* runner, |
| 117 net::URLRequestContextGetter* url_request_context_getter, | 117 net::URLRequestContextGetter* url_request_context_getter, |
| 118 const DriveApiUrlGenerator& url_generator, | 118 const DriveApiUrlGenerator& url_generator, |
| 119 const std::string& search_string, | 119 const std::string& search_string, |
| 120 int max_results, | 120 int max_results, |
| 121 const GetDataCallback& callback); | 121 const GetDataCallback& callback); |
| 122 virtual ~GetFilelistOperation(); | 122 virtual ~GetFilelistOperation(); |
| 123 | 123 |
| 124 protected: | 124 protected: |
| 125 // Overridden from GetDataOperation. | 125 // Overridden from GetDataOperation. |
| 126 virtual GURL GetURL() const OVERRIDE; | 126 virtual GURL GetURL() const OVERRIDE; |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 const DriveApiUrlGenerator url_generator_; | 129 const DriveApiUrlGenerator url_generator_; |
| 130 const std::string search_string_; | 130 const std::string search_string_; |
| 131 const int max_results_; | 131 const int max_results_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(GetFilelistOperation); | 133 DISALLOW_COPY_AND_ASSIGN(GetFilelistOperation); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 //=============================== GetFileOperation ============================= | 136 //=============================== GetFileOperation ============================= |
| 137 | 137 |
| 138 // This class performs the operation for fetching a file. | 138 // This class performs the operation for fetching a file. |
| 139 class GetFileOperation : public GetDataOperation { | 139 class GetFileOperation : public GetDataOperation { |
| 140 public: | 140 public: |
| 141 GetFileOperation(OperationRegistry* registry, | 141 GetFileOperation(OperationRunner* runner, |
| 142 net::URLRequestContextGetter* url_request_context_getter, | 142 net::URLRequestContextGetter* url_request_context_getter, |
| 143 const DriveApiUrlGenerator& url_generator, | 143 const DriveApiUrlGenerator& url_generator, |
| 144 const std::string& file_id, | 144 const std::string& file_id, |
| 145 const FileResourceCallback& callback); | 145 const FileResourceCallback& callback); |
| 146 virtual ~GetFileOperation(); | 146 virtual ~GetFileOperation(); |
| 147 | 147 |
| 148 protected: | 148 protected: |
| 149 // Overridden from GetDataOperation. | 149 // Overridden from GetDataOperation. |
| 150 virtual GURL GetURL() const OVERRIDE; | 150 virtual GURL GetURL() const OVERRIDE; |
| 151 | 151 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 163 // TODO(hidehiko): Move all the operations defined in this file into drive | 163 // TODO(hidehiko): Move all the operations defined in this file into drive |
| 164 // namespace. crbug.com/180808 | 164 // namespace. crbug.com/180808 |
| 165 namespace drive { | 165 namespace drive { |
| 166 | 166 |
| 167 //======================= ContinueGetFileListOperation ========================= | 167 //======================= ContinueGetFileListOperation ========================= |
| 168 | 168 |
| 169 // This class performs the operation to fetch remaining Filelist result. | 169 // This class performs the operation to fetch remaining Filelist result. |
| 170 class ContinueGetFileListOperation : public GetDataOperation { | 170 class ContinueGetFileListOperation : public GetDataOperation { |
| 171 public: | 171 public: |
| 172 ContinueGetFileListOperation( | 172 ContinueGetFileListOperation( |
| 173 OperationRegistry* registry, | 173 OperationRunner* runner, |
| 174 net::URLRequestContextGetter* url_request_context_getter, | 174 net::URLRequestContextGetter* url_request_context_getter, |
| 175 const GURL& url, | 175 const GURL& url, |
| 176 const GetDataCallback& callback); | 176 const GetDataCallback& callback); |
| 177 virtual ~ContinueGetFileListOperation(); | 177 virtual ~ContinueGetFileListOperation(); |
| 178 | 178 |
| 179 protected: | 179 protected: |
| 180 virtual GURL GetURL() const OVERRIDE; | 180 virtual GURL GetURL() const OVERRIDE; |
| 181 | 181 |
| 182 private: | 182 private: |
| 183 const GURL url_; | 183 const GURL url_; |
| 184 | 184 |
| 185 DISALLOW_COPY_AND_ASSIGN(ContinueGetFileListOperation); | 185 DISALLOW_COPY_AND_ASSIGN(ContinueGetFileListOperation); |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 //========================== CreateDirectoryOperation ========================== | 188 //========================== CreateDirectoryOperation ========================== |
| 189 | 189 |
| 190 // This class performs the operation for creating a directory. | 190 // This class performs the operation for creating a directory. |
| 191 class CreateDirectoryOperation : public GetDataOperation { | 191 class CreateDirectoryOperation : public GetDataOperation { |
| 192 public: | 192 public: |
| 193 CreateDirectoryOperation( | 193 CreateDirectoryOperation( |
| 194 OperationRegistry* registry, | 194 OperationRunner* runner, |
| 195 net::URLRequestContextGetter* url_request_context_getter, | 195 net::URLRequestContextGetter* url_request_context_getter, |
| 196 const DriveApiUrlGenerator& url_generator, | 196 const DriveApiUrlGenerator& url_generator, |
| 197 const std::string& parent_resource_id, | 197 const std::string& parent_resource_id, |
| 198 const std::string& directory_name, | 198 const std::string& directory_name, |
| 199 const FileResourceCallback& callback); | 199 const FileResourceCallback& callback); |
| 200 virtual ~CreateDirectoryOperation(); | 200 virtual ~CreateDirectoryOperation(); |
| 201 | 201 |
| 202 protected: | 202 protected: |
| 203 // Overridden from GetDataOperation. | 203 // Overridden from GetDataOperation. |
| 204 virtual GURL GetURL() const OVERRIDE; | 204 virtual GURL GetURL() const OVERRIDE; |
| 205 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 205 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 206 virtual bool GetContentData(std::string* upload_content_type, | 206 virtual bool GetContentData(std::string* upload_content_type, |
| 207 std::string* upload_content) OVERRIDE; | 207 std::string* upload_content) OVERRIDE; |
| 208 | 208 |
| 209 private: | 209 private: |
| 210 const DriveApiUrlGenerator url_generator_; | 210 const DriveApiUrlGenerator url_generator_; |
| 211 const std::string parent_resource_id_; | 211 const std::string parent_resource_id_; |
| 212 const std::string directory_name_; | 212 const std::string directory_name_; |
| 213 | 213 |
| 214 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | 214 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 //=========================== RenameResourceOperation ========================== | 217 //=========================== RenameResourceOperation ========================== |
| 218 | 218 |
| 219 // This class performs the operation for renaming a document/file/directory. | 219 // This class performs the operation for renaming a document/file/directory. |
| 220 class RenameResourceOperation : public EntryActionOperation { | 220 class RenameResourceOperation : public EntryActionOperation { |
| 221 public: | 221 public: |
| 222 // |callback| must not be null. | 222 // |callback| must not be null. |
| 223 RenameResourceOperation( | 223 RenameResourceOperation( |
| 224 OperationRegistry* registry, | 224 OperationRunner* runner, |
| 225 net::URLRequestContextGetter* url_request_context_getter, | 225 net::URLRequestContextGetter* url_request_context_getter, |
| 226 const DriveApiUrlGenerator& url_generator, | 226 const DriveApiUrlGenerator& url_generator, |
| 227 const std::string& resource_id, | 227 const std::string& resource_id, |
| 228 const std::string& new_name, | 228 const std::string& new_name, |
| 229 const EntryActionCallback& callback); | 229 const EntryActionCallback& callback); |
| 230 virtual ~RenameResourceOperation(); | 230 virtual ~RenameResourceOperation(); |
| 231 | 231 |
| 232 protected: | 232 protected: |
| 233 // UrlFetchOperationBase overrides. | 233 // UrlFetchOperationBase overrides. |
| 234 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 234 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 255 // |parent_resource_id| can be empty. In the case, the copy will be created | 255 // |parent_resource_id| can be empty. In the case, the copy will be created |
| 256 // directly under the default root directory (this is the default behavior | 256 // directly under the default root directory (this is the default behavior |
| 257 // of Drive API v2's copy operation). | 257 // of Drive API v2's copy operation). |
| 258 // | 258 // |
| 259 // This operation corresponds to "Files: copy" operation on Drive API v2. See | 259 // This operation corresponds to "Files: copy" operation on Drive API v2. See |
| 260 // also: https://developers.google.com/drive/v2/reference/files/copy | 260 // also: https://developers.google.com/drive/v2/reference/files/copy |
| 261 class CopyResourceOperation : public GetDataOperation { | 261 class CopyResourceOperation : public GetDataOperation { |
| 262 public: | 262 public: |
| 263 // Upon completion, |callback| will be called. |callback| must not be null. | 263 // Upon completion, |callback| will be called. |callback| must not be null. |
| 264 CopyResourceOperation( | 264 CopyResourceOperation( |
| 265 OperationRegistry* registry, | 265 OperationRunner* runner, |
| 266 net::URLRequestContextGetter* url_request_context_getter, | 266 net::URLRequestContextGetter* url_request_context_getter, |
| 267 const DriveApiUrlGenerator& url_generator, | 267 const DriveApiUrlGenerator& url_generator, |
| 268 const std::string& resource_id, | 268 const std::string& resource_id, |
| 269 const std::string& parent_resource_id, | 269 const std::string& parent_resource_id, |
| 270 const std::string& new_name, | 270 const std::string& new_name, |
| 271 const FileResourceCallback& callback); | 271 const FileResourceCallback& callback); |
| 272 virtual ~CopyResourceOperation(); | 272 virtual ~CopyResourceOperation(); |
| 273 | 273 |
| 274 protected: | 274 protected: |
| 275 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 275 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 295 // response from WAPI server. For the transition, we simply ignore the result, | 295 // response from WAPI server. For the transition, we simply ignore the result, |
| 296 // because now we do not handle resources in trash. | 296 // because now we do not handle resources in trash. |
| 297 // Note for the naming: the name "trash" comes from the server's operation | 297 // Note for the naming: the name "trash" comes from the server's operation |
| 298 // name. In order to be consistent with the server, we chose "trash" here, | 298 // name. In order to be consistent with the server, we chose "trash" here, |
| 299 // although we are preferring the term "remove" in drive/google_api code. | 299 // although we are preferring the term "remove" in drive/google_api code. |
| 300 // TODO(hidehiko): Replace the base class to GetDataOperation. | 300 // TODO(hidehiko): Replace the base class to GetDataOperation. |
| 301 class TrashResourceOperation : public EntryActionOperation { | 301 class TrashResourceOperation : public EntryActionOperation { |
| 302 public: | 302 public: |
| 303 // |callback| must not be null. | 303 // |callback| must not be null. |
| 304 TrashResourceOperation( | 304 TrashResourceOperation( |
| 305 OperationRegistry* registry, | 305 OperationRunner* runner, |
| 306 net::URLRequestContextGetter* url_request_context_getter, | 306 net::URLRequestContextGetter* url_request_context_getter, |
| 307 const DriveApiUrlGenerator& url_generator, | 307 const DriveApiUrlGenerator& url_generator, |
| 308 const std::string& resource_id, | 308 const std::string& resource_id, |
| 309 const EntryActionCallback& callback); | 309 const EntryActionCallback& callback); |
| 310 virtual ~TrashResourceOperation(); | 310 virtual ~TrashResourceOperation(); |
| 311 | 311 |
| 312 protected: | 312 protected: |
| 313 // UrlFetchOperationBase overrides. | 313 // UrlFetchOperationBase overrides. |
| 314 virtual GURL GetURL() const OVERRIDE; | 314 virtual GURL GetURL() const OVERRIDE; |
| 315 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 315 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 316 | 316 |
| 317 private: | 317 private: |
| 318 const DriveApiUrlGenerator url_generator_; | 318 const DriveApiUrlGenerator url_generator_; |
| 319 const std::string resource_id_; | 319 const std::string resource_id_; |
| 320 | 320 |
| 321 DISALLOW_COPY_AND_ASSIGN(TrashResourceOperation); | 321 DISALLOW_COPY_AND_ASSIGN(TrashResourceOperation); |
| 322 }; | 322 }; |
| 323 | 323 |
| 324 //========================== InsertResourceOperation =========================== | 324 //========================== InsertResourceOperation =========================== |
| 325 | 325 |
| 326 // This class performs the operation for inserting a resource to a directory. | 326 // This class performs the operation for inserting a resource to a directory. |
| 327 // Note that this is the operation of "Children: insert" of the Drive API v2. | 327 // Note that this is the operation of "Children: insert" of the Drive API v2. |
| 328 // https://developers.google.com/drive/v2/reference/children/insert. | 328 // https://developers.google.com/drive/v2/reference/children/insert. |
| 329 class InsertResourceOperation : public EntryActionOperation { | 329 class InsertResourceOperation : public EntryActionOperation { |
| 330 public: | 330 public: |
| 331 // |callback| must not be null. | 331 // |callback| must not be null. |
| 332 InsertResourceOperation( | 332 InsertResourceOperation( |
| 333 OperationRegistry* registry, | 333 OperationRunner* runner, |
| 334 net::URLRequestContextGetter* url_request_context_getter, | 334 net::URLRequestContextGetter* url_request_context_getter, |
| 335 const DriveApiUrlGenerator& url_generator, | 335 const DriveApiUrlGenerator& url_generator, |
| 336 const std::string& parent_resource_id, | 336 const std::string& parent_resource_id, |
| 337 const std::string& resource_id, | 337 const std::string& resource_id, |
| 338 const EntryActionCallback& callback); | 338 const EntryActionCallback& callback); |
| 339 virtual ~InsertResourceOperation(); | 339 virtual ~InsertResourceOperation(); |
| 340 | 340 |
| 341 protected: | 341 protected: |
| 342 // UrlFetchOperationBase overrides. | 342 // UrlFetchOperationBase overrides. |
| 343 virtual GURL GetURL() const OVERRIDE; | 343 virtual GURL GetURL() const OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 358 // This class performs the operation for removing a resource from a directory. | 358 // This class performs the operation for removing a resource from a directory. |
| 359 // Note that we use "delete" for the name of this class, which comes from the | 359 // Note that we use "delete" for the name of this class, which comes from the |
| 360 // operation name of the Drive API v2, although we prefer "remove" for that | 360 // operation name of the Drive API v2, although we prefer "remove" for that |
| 361 // sense in "drive/google_api" | 361 // sense in "drive/google_api" |
| 362 // Also note that this is the operation of "Children: delete" of the Drive API | 362 // Also note that this is the operation of "Children: delete" of the Drive API |
| 363 // v2. https://developers.google.com/drive/v2/reference/children/delete | 363 // v2. https://developers.google.com/drive/v2/reference/children/delete |
| 364 class DeleteResourceOperation : public EntryActionOperation { | 364 class DeleteResourceOperation : public EntryActionOperation { |
| 365 public: | 365 public: |
| 366 // |callback| must not be null. | 366 // |callback| must not be null. |
| 367 DeleteResourceOperation( | 367 DeleteResourceOperation( |
| 368 OperationRegistry* registry, | 368 OperationRunner* runner, |
| 369 net::URLRequestContextGetter* url_request_context_getter, | 369 net::URLRequestContextGetter* url_request_context_getter, |
| 370 const DriveApiUrlGenerator& url_generator, | 370 const DriveApiUrlGenerator& url_generator, |
| 371 const std::string& parent_resource_id, | 371 const std::string& parent_resource_id, |
| 372 const std::string& resource_id, | 372 const std::string& resource_id, |
| 373 const EntryActionCallback& callback); | 373 const EntryActionCallback& callback); |
| 374 virtual ~DeleteResourceOperation(); | 374 virtual ~DeleteResourceOperation(); |
| 375 | 375 |
| 376 protected: | 376 protected: |
| 377 // UrlFetchOperationBase overrides. | 377 // UrlFetchOperationBase overrides. |
| 378 virtual GURL GetURL() const OVERRIDE; | 378 virtual GURL GetURL() const OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 389 //======================= InitiateUploadNewFileOperation ======================= | 389 //======================= InitiateUploadNewFileOperation ======================= |
| 390 | 390 |
| 391 // This class performs the operation for initiating the upload of a new file. | 391 // This class performs the operation for initiating the upload of a new file. |
| 392 class InitiateUploadNewFileOperation : public InitiateUploadOperationBase { | 392 class InitiateUploadNewFileOperation : public InitiateUploadOperationBase { |
| 393 public: | 393 public: |
| 394 // |parent_resource_id| should be the resource id of the parent directory. | 394 // |parent_resource_id| should be the resource id of the parent directory. |
| 395 // |title| should be set. | 395 // |title| should be set. |
| 396 // See also the comments of InitiateUploadOperationBase for more details | 396 // See also the comments of InitiateUploadOperationBase for more details |
| 397 // about the other parameters. | 397 // about the other parameters. |
| 398 InitiateUploadNewFileOperation( | 398 InitiateUploadNewFileOperation( |
| 399 OperationRegistry* registry, | 399 OperationRunner* runner, |
| 400 net::URLRequestContextGetter* url_request_context_getter, | 400 net::URLRequestContextGetter* url_request_context_getter, |
| 401 const DriveApiUrlGenerator& url_generator, | 401 const DriveApiUrlGenerator& url_generator, |
| 402 const base::FilePath& drive_file_path, | 402 const base::FilePath& drive_file_path, |
| 403 const std::string& content_type, | 403 const std::string& content_type, |
| 404 int64 content_length, | 404 int64 content_length, |
| 405 const std::string& parent_resource_id, | 405 const std::string& parent_resource_id, |
| 406 const std::string& title, | 406 const std::string& title, |
| 407 const InitiateUploadCallback& callback); | 407 const InitiateUploadCallback& callback); |
| 408 virtual ~InitiateUploadNewFileOperation(); | 408 virtual ~InitiateUploadNewFileOperation(); |
| 409 | 409 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 428 // file. | 428 // file. |
| 429 class InitiateUploadExistingFileOperation | 429 class InitiateUploadExistingFileOperation |
| 430 : public InitiateUploadOperationBase { | 430 : public InitiateUploadOperationBase { |
| 431 public: | 431 public: |
| 432 // |upload_url| should be the upload_url() of the file | 432 // |upload_url| should be the upload_url() of the file |
| 433 // (resumable-create-media URL) | 433 // (resumable-create-media URL) |
| 434 // |etag| should be set if it is available to detect the upload confliction. | 434 // |etag| should be set if it is available to detect the upload confliction. |
| 435 // See also the comments of InitiateUploadOperationBase for more details | 435 // See also the comments of InitiateUploadOperationBase for more details |
| 436 // about the other parameters. | 436 // about the other parameters. |
| 437 InitiateUploadExistingFileOperation( | 437 InitiateUploadExistingFileOperation( |
| 438 OperationRegistry* registry, | 438 OperationRunner* runner, |
| 439 net::URLRequestContextGetter* url_request_context_getter, | 439 net::URLRequestContextGetter* url_request_context_getter, |
| 440 const DriveApiUrlGenerator& url_generator, | 440 const DriveApiUrlGenerator& url_generator, |
| 441 const base::FilePath& drive_file_path, | 441 const base::FilePath& drive_file_path, |
| 442 const std::string& content_type, | 442 const std::string& content_type, |
| 443 int64 content_length, | 443 int64 content_length, |
| 444 const std::string& resource_id, | 444 const std::string& resource_id, |
| 445 const std::string& etag, | 445 const std::string& etag, |
| 446 const InitiateUploadCallback& callback); | 446 const InitiateUploadCallback& callback); |
| 447 virtual ~InitiateUploadExistingFileOperation(); | 447 virtual ~InitiateUploadExistingFileOperation(); |
| 448 | 448 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 466 scoped_ptr<FileResource> new_resource)> UploadRangeCallback; | 466 scoped_ptr<FileResource> new_resource)> UploadRangeCallback; |
| 467 | 467 |
| 468 //============================ ResumeUploadOperation =========================== | 468 //============================ ResumeUploadOperation =========================== |
| 469 | 469 |
| 470 // Performs the operation for resuming the upload of a file. | 470 // Performs the operation for resuming the upload of a file. |
| 471 class ResumeUploadOperation : public ResumeUploadOperationBase { | 471 class ResumeUploadOperation : public ResumeUploadOperationBase { |
| 472 public: | 472 public: |
| 473 // See also ResumeUploadOperationBase's comment for parameters meaning. | 473 // See also ResumeUploadOperationBase's comment for parameters meaning. |
| 474 // |callback| must not be null. |progress_callback| may be null. | 474 // |callback| must not be null. |progress_callback| may be null. |
| 475 ResumeUploadOperation( | 475 ResumeUploadOperation( |
| 476 OperationRegistry* registry, | 476 OperationRunner* runner, |
| 477 net::URLRequestContextGetter* url_request_context_getter, | 477 net::URLRequestContextGetter* url_request_context_getter, |
| 478 const base::FilePath& drive_file_path, | 478 const base::FilePath& drive_file_path, |
| 479 const GURL& upload_location, | 479 const GURL& upload_location, |
| 480 int64 start_position, | 480 int64 start_position, |
| 481 int64 end_position, | 481 int64 end_position, |
| 482 int64 content_length, | 482 int64 content_length, |
| 483 const std::string& content_type, | 483 const std::string& content_type, |
| 484 const base::FilePath& local_file_path, | 484 const base::FilePath& local_file_path, |
| 485 const UploadRangeCallback& callback, | 485 const UploadRangeCallback& callback, |
| 486 const ProgressCallback& progress_callback); | 486 const ProgressCallback& progress_callback); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 503 }; | 503 }; |
| 504 | 504 |
| 505 //========================== GetUploadStatusOperation ========================== | 505 //========================== GetUploadStatusOperation ========================== |
| 506 | 506 |
| 507 // Performs the operation to request the current upload status of a file. | 507 // Performs the operation to request the current upload status of a file. |
| 508 class GetUploadStatusOperation : public GetUploadStatusOperationBase { | 508 class GetUploadStatusOperation : public GetUploadStatusOperationBase { |
| 509 public: | 509 public: |
| 510 // See also GetUploadStatusOperationBase's comment for parameters meaning. | 510 // See also GetUploadStatusOperationBase's comment for parameters meaning. |
| 511 // |callback| must not be null. | 511 // |callback| must not be null. |
| 512 GetUploadStatusOperation( | 512 GetUploadStatusOperation( |
| 513 OperationRegistry* registry, | 513 OperationRunner* runner, |
| 514 net::URLRequestContextGetter* url_request_context_getter, | 514 net::URLRequestContextGetter* url_request_context_getter, |
| 515 const base::FilePath& drive_file_path, | 515 const base::FilePath& drive_file_path, |
| 516 const GURL& upload_url, | 516 const GURL& upload_url, |
| 517 int64 content_length, | 517 int64 content_length, |
| 518 const UploadRangeCallback& callback); | 518 const UploadRangeCallback& callback); |
| 519 virtual ~GetUploadStatusOperation(); | 519 virtual ~GetUploadStatusOperation(); |
| 520 | 520 |
| 521 protected: | 521 protected: |
| 522 // UploadRangeOperationBase overrides. | 522 // UploadRangeOperationBase overrides. |
| 523 virtual void OnRangeOperationComplete( | 523 virtual void OnRangeOperationComplete( |
| 524 const UploadRangeResponse& response, | 524 const UploadRangeResponse& response, |
| 525 scoped_ptr<base::Value> value) OVERRIDE; | 525 scoped_ptr<base::Value> value) OVERRIDE; |
| 526 | 526 |
| 527 private: | 527 private: |
| 528 const UploadRangeCallback callback_; | 528 const UploadRangeCallback callback_; |
| 529 | 529 |
| 530 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusOperation); | 530 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusOperation); |
| 531 }; | 531 }; |
| 532 | 532 |
| 533 | 533 |
| 534 } // namespace drive | 534 } // namespace drive |
| 535 } // namespace google_apis | 535 } // namespace google_apis |
| 536 | 536 |
| 537 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ | 537 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
| OLD | NEW |