Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/google_apis/gdata_wapi_operations.cc

Issue 12209035: Implement retry flow on DriveUploader. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148632_wapi_get_upload_status_operation_impl
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/google_apis/gdata_wapi_operations.h" 5 #include "chrome/browser/google_apis/gdata_wapi_operations.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 10 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 InitiateUploadParams::~InitiateUploadParams() { 81 InitiateUploadParams::~InitiateUploadParams() {
82 } 82 }
83 83
84 ResumeUploadParams::ResumeUploadParams( 84 ResumeUploadParams::ResumeUploadParams(
85 UploadMode upload_mode, 85 UploadMode upload_mode,
86 int64 start_position, 86 int64 start_position,
87 int64 end_position, 87 int64 end_position,
88 int64 content_length, 88 int64 content_length,
89 const std::string& content_type, 89 const std::string& content_type,
90 scoped_refptr<net::IOBuffer> buf, 90 scoped_refptr<net::IOBuffer> buf,
91 int64 buf_offset,
91 const GURL& upload_location, 92 const GURL& upload_location,
92 const FilePath& drive_file_path) : upload_mode(upload_mode), 93 const FilePath& drive_file_path) : upload_mode(upload_mode),
93 start_position(start_position), 94 start_position(start_position),
94 end_position(end_position), 95 end_position(end_position),
95 content_length(content_length), 96 content_length(content_length),
96 content_type(content_type), 97 content_type(content_type),
97 buf(buf), 98 buf(buf),
99 buf_offset(buf_offset),
98 upload_location(upload_location), 100 upload_location(upload_location),
99 drive_file_path(drive_file_path) { 101 drive_file_path(drive_file_path) {
100 } 102 }
101 103
102 ResumeUploadParams::~ResumeUploadParams() { 104 ResumeUploadParams::~ResumeUploadParams() {
103 } 105 }
104 106
105 //============================ GetResourceListOperation ======================== 107 //============================ GetResourceListOperation ========================
106 108
107 GetResourceListOperation::GetResourceListOperation( 109 GetResourceListOperation::GetResourceListOperation(
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 base::Int64ToString(params_.start_position) + "-" + 766 base::Int64ToString(params_.start_position) + "-" +
765 base::Int64ToString(params_.end_position - 1) + "/" + 767 base::Int64ToString(params_.end_position - 1) + "/" +
766 (params_.content_length == -1 ? "*" : 768 (params_.content_length == -1 ? "*" :
767 base::Int64ToString(params_.content_length))); 769 base::Int64ToString(params_.content_length)));
768 return headers; 770 return headers;
769 } 771 }
770 772
771 bool ResumeUploadOperation::GetContentData(std::string* upload_content_type, 773 bool ResumeUploadOperation::GetContentData(std::string* upload_content_type,
772 std::string* upload_content) { 774 std::string* upload_content) {
773 *upload_content_type = params_.content_type; 775 *upload_content_type = params_.content_type;
774 *upload_content = std::string(params_.buf->data(), 776 *upload_content = std::string(params_.buf->data() + params_.buf_offset,
775 params_.end_position - params_.start_position); 777 params_.end_position - params_.start_position);
776 return true; 778 return true;
777 } 779 }
778 780
779 void ResumeUploadOperation::OnURLFetchUploadProgress( 781 void ResumeUploadOperation::OnURLFetchUploadProgress(
780 const URLFetcher* source, int64 current, int64 total) { 782 const URLFetcher* source, int64 current, int64 total) {
781 // Adjust the progress values according to the range currently uploaded. 783 // Adjust the progress values according to the range currently uploaded.
782 NotifyProgress(params_.start_position + current, params_.content_length); 784 NotifyProgress(params_.start_position + current, params_.content_length);
783 } 785 }
784 786
(...skipping 28 matching lines...) Expand all
813 DCHECK_GE(content_length_, -1); 815 DCHECK_GE(content_length_, -1);
814 816
815 std::vector<std::string> headers; 817 std::vector<std::string> headers;
816 headers.push_back( 818 headers.push_back(
817 std::string(kUploadContentRange) + "*/" + 819 std::string(kUploadContentRange) + "*/" +
818 (content_length_ == -1 ? "*" : base::Int64ToString(content_length_))); 820 (content_length_ == -1 ? "*" : base::Int64ToString(content_length_)));
819 return headers; 821 return headers;
820 } 822 }
821 823
822 } // namespace google_apis 824 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698