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

Unified Diff: chrome/browser/google_apis/gdata_wapi_operations.cc

Issue 12246002: Implement GetUploadStatusOperation on GData WAPI. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148632_create_base_operation
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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google_apis/gdata_wapi_operations.cc
diff --git a/chrome/browser/google_apis/gdata_wapi_operations.cc b/chrome/browser/google_apis/gdata_wapi_operations.cc
index f4b0d8690d5f235f5a7b866fde46ffd4da240dc3..fef4be103131b3511f266325329888c55bdfe18d 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations.cc
+++ b/chrome/browser/google_apis/gdata_wapi_operations.cc
@@ -782,4 +782,41 @@ void ResumeUploadOperation::OnURLFetchUploadProgress(
NotifyProgress(params_.start_position + current, params_.content_length);
}
+//========================== GetUploadStatusOperation ==========================
+
+GetUploadStatusOperation::GetUploadStatusOperation(
+ OperationRegistry* registry,
+ net::URLRequestContextGetter* url_request_context_getter,
+ const UploadRangeCallback& callback,
+ UploadMode upload_mode,
+ const FilePath& drive_file_path,
+ const GURL& upload_url,
+ int64 content_length)
+ : UploadRangeOperationBase(registry,
+ url_request_context_getter,
+ callback,
+ upload_mode,
+ drive_file_path,
+ upload_url),
+ content_length_(content_length) {}
+
+GetUploadStatusOperation::~GetUploadStatusOperation() {}
+
+std::vector<std::string>
+GetUploadStatusOperation::GetExtraRequestHeaders() const {
+ // The header looks like
+ // Content-Range: bytes */<content_length>
+ // for example:
+ // Content-Range: bytes */13851821
+ // Use * for unknown/streaming content length, such as
+ // Content-Range: bytes */*
+ DCHECK_GE(content_length_, -1);
+
+ std::vector<std::string> headers;
+ headers.push_back(
+ std::string(kUploadContentRange) + "*/" +
+ (content_length_ == -1 ? "*" : base::Int64ToString(content_length_)));
+ return headers;
+}
+
} // namespace google_apis

Powered by Google App Engine
This is Rietveld 408576698