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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // The parameters for the request. See ResumeUploadParams for the details. | 500 // The parameters for the request. See ResumeUploadParams for the details. |
501 const int64 start_position_; | 501 const int64 start_position_; |
502 const int64 end_position_; | 502 const int64 end_position_; |
503 const int64 content_length_; | 503 const int64 content_length_; |
504 const std::string content_type_; | 504 const std::string content_type_; |
505 const scoped_refptr<net::IOBuffer> buf_; | 505 const scoped_refptr<net::IOBuffer> buf_; |
506 | 506 |
507 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); | 507 DISALLOW_COPY_AND_ASSIGN(ResumeUploadOperation); |
508 }; | 508 }; |
509 | 509 |
| 510 //========================== GetUploadStatusOperation ========================== |
| 511 |
| 512 // This class performs the operation for getting the current upload status |
| 513 // of a file. |
| 514 // This operation calls |callback| with: |
| 515 // - HTTP_RESUME_INCOMPLETE and the range of previously uploaded data, |
| 516 // if a file has been partially uploaded. |new_entry| of the |callback| is |
| 517 // not used. |
| 518 // - HTTP_SUCCESS or HTTP_CREATED (up to the upload mode) and |new_entry| |
| 519 // for the uploaded data, if a file has been completely uploaded. |
| 520 // |range| of the |callback| is not used. |
| 521 // See also UploadRangeOperationBase. |
| 522 class GetUploadStatusOperation : public UploadRangeOperationBase { |
| 523 public: |
| 524 // |callback| must not be null. See also UploadRangeOperationBase's |
| 525 // constructor for more details. |
| 526 // |content_length| is the whole data size to be uploaded. |
| 527 GetUploadStatusOperation( |
| 528 OperationRegistry* registry, |
| 529 net::URLRequestContextGetter* url_request_context_getter, |
| 530 const UploadRangeCallback& callback, |
| 531 UploadMode upload_mode, |
| 532 const base::FilePath& drive_file_path, |
| 533 const GURL& upload_url, |
| 534 int64 content_length); |
| 535 virtual ~GetUploadStatusOperation(); |
| 536 |
| 537 protected: |
| 538 // UrlFetchOperationBase overrides. |
| 539 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; |
| 540 |
| 541 // UploadRangeOperationBase overrides. |
| 542 virtual void OnRangeOperationComplete( |
| 543 const UploadRangeResponse& response, |
| 544 scoped_ptr<base::Value> value) OVERRIDE; |
| 545 |
| 546 private: |
| 547 const UploadRangeCallback callback_; |
| 548 const int64 content_length_; |
| 549 |
| 550 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusOperation); |
| 551 }; |
| 552 |
510 } // namespace google_apis | 553 } // namespace google_apis |
511 | 554 |
512 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ | 555 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_OPERATIONS_H_ |
OLD | NEW |