| 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 #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" |
| 11 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 11 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
| 12 #include "chrome/browser/google_apis/time_util.h" | 12 #include "chrome/browser/google_apis/time_util.h" |
| 13 #include "chrome/common/net/url_util.h" | |
| 14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 15 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 15 #include "net/base/url_util.h" |
| 16 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
| 17 #include "net/http/http_util.h" | 17 #include "net/http/http_util.h" |
| 18 #include "third_party/libxml/chromium/libxml_utils.h" | 18 #include "third_party/libxml/chromium/libxml_utils.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 using net::URLFetcher; | 21 using net::URLFetcher; |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // etag matching header. | 25 // etag matching header. |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 OperationRegistry* registry, | 558 OperationRegistry* registry, |
| 559 net::URLRequestContextGetter* url_request_context_getter, | 559 net::URLRequestContextGetter* url_request_context_getter, |
| 560 const InitiateUploadCallback& callback, | 560 const InitiateUploadCallback& callback, |
| 561 const InitiateUploadParams& params) | 561 const InitiateUploadParams& params) |
| 562 : UrlFetchOperationBase(registry, | 562 : UrlFetchOperationBase(registry, |
| 563 url_request_context_getter, | 563 url_request_context_getter, |
| 564 OPERATION_UPLOAD, | 564 OPERATION_UPLOAD, |
| 565 params.drive_file_path), | 565 params.drive_file_path), |
| 566 callback_(callback), | 566 callback_(callback), |
| 567 params_(params), | 567 params_(params), |
| 568 initiate_upload_url_(chrome_common_net::AppendOrReplaceQueryParameter( | 568 initiate_upload_url_(net::AppendOrReplaceQueryParameter( |
| 569 params.upload_location, | 569 params.upload_location, |
| 570 kUploadParamConvertKey, | 570 kUploadParamConvertKey, |
| 571 kUploadParamConvertValue)) { | 571 kUploadParamConvertValue)) { |
| 572 DCHECK(!callback_.is_null()); | 572 DCHECK(!callback_.is_null()); |
| 573 } | 573 } |
| 574 | 574 |
| 575 InitiateUploadOperation::~InitiateUploadOperation() {} | 575 InitiateUploadOperation::~InitiateUploadOperation() {} |
| 576 | 576 |
| 577 GURL InitiateUploadOperation::GetURL() const { | 577 GURL InitiateUploadOperation::GetURL() const { |
| 578 return GDataWapiUrlGenerator::AddStandardUrlParams(initiate_upload_url_); | 578 return GDataWapiUrlGenerator::AddStandardUrlParams(initiate_upload_url_); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 return true; | 818 return true; |
| 819 } | 819 } |
| 820 | 820 |
| 821 void ResumeUploadOperation::OnURLFetchUploadProgress( | 821 void ResumeUploadOperation::OnURLFetchUploadProgress( |
| 822 const URLFetcher* source, int64 current, int64 total) { | 822 const URLFetcher* source, int64 current, int64 total) { |
| 823 // Adjust the progress values according to the range currently uploaded. | 823 // Adjust the progress values according to the range currently uploaded. |
| 824 NotifyProgress(params_.start_position + current, params_.content_length); | 824 NotifyProgress(params_.start_position + current, params_.content_length); |
| 825 } | 825 } |
| 826 | 826 |
| 827 } // namespace google_apis | 827 } // namespace google_apis |
| OLD | NEW |