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

Side by Side 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 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 params_.end_position - params_.start_position); 775 params_.end_position - params_.start_position);
776 return true; 776 return true;
777 } 777 }
778 778
779 void ResumeUploadOperation::OnURLFetchUploadProgress( 779 void ResumeUploadOperation::OnURLFetchUploadProgress(
780 const URLFetcher* source, int64 current, int64 total) { 780 const URLFetcher* source, int64 current, int64 total) {
781 // Adjust the progress values according to the range currently uploaded. 781 // Adjust the progress values according to the range currently uploaded.
782 NotifyProgress(params_.start_position + current, params_.content_length); 782 NotifyProgress(params_.start_position + current, params_.content_length);
783 } 783 }
784 784
785 //========================== GetUploadStatusOperation ==========================
786
787 GetUploadStatusOperation::GetUploadStatusOperation(
788 OperationRegistry* registry,
789 net::URLRequestContextGetter* url_request_context_getter,
790 const UploadRangeCallback& callback,
791 UploadMode upload_mode,
792 const FilePath& drive_file_path,
793 const GURL& upload_url,
794 int64 content_length)
795 : UploadRangeOperationBase(registry,
796 url_request_context_getter,
797 callback,
798 upload_mode,
799 drive_file_path,
800 upload_url),
801 content_length_(content_length) {}
802
803 GetUploadStatusOperation::~GetUploadStatusOperation() {}
804
805 std::vector<std::string>
806 GetUploadStatusOperation::GetExtraRequestHeaders() const {
807 // The header looks like
808 // Content-Range: bytes */<content_length>
809 // for example:
810 // Content-Range: bytes */13851821
811 // Use * for unknown/streaming content length, such as
812 // Content-Range: bytes */*
813 DCHECK_GE(content_length_, -1);
814
815 std::vector<std::string> headers;
816 headers.push_back(
817 std::string(kUploadContentRange) + "*/" +
818 (content_length_ == -1 ? "*" : base::Int64ToString(content_length_)));
819 return headers;
820 }
821
785 } // namespace google_apis 822 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698