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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 OperationRegistry* registry, | 554 OperationRegistry* registry, |
555 net::URLRequestContextGetter* url_request_context_getter, | 555 net::URLRequestContextGetter* url_request_context_getter, |
556 const InitiateUploadCallback& callback, | 556 const InitiateUploadCallback& callback, |
557 const InitiateUploadParams& params) | 557 const InitiateUploadParams& params) |
558 : UrlFetchOperationBase(registry, | 558 : UrlFetchOperationBase(registry, |
559 url_request_context_getter, | 559 url_request_context_getter, |
560 OPERATION_UPLOAD, | 560 OPERATION_UPLOAD, |
561 params.drive_file_path), | 561 params.drive_file_path), |
562 callback_(callback), | 562 callback_(callback), |
563 params_(params), | 563 params_(params), |
564 initiate_upload_url_(chrome_common_net::AppendOrReplaceQueryParameter( | 564 initiate_upload_url_(net::AppendOrReplaceQueryParameter( |
565 params.upload_location, | 565 params.upload_location, |
566 kUploadParamConvertKey, | 566 kUploadParamConvertKey, |
567 kUploadParamConvertValue)) { | 567 kUploadParamConvertValue)) { |
568 DCHECK(!callback_.is_null()); | 568 DCHECK(!callback_.is_null()); |
569 } | 569 } |
570 | 570 |
571 InitiateUploadOperation::~InitiateUploadOperation() {} | 571 InitiateUploadOperation::~InitiateUploadOperation() {} |
572 | 572 |
573 GURL InitiateUploadOperation::GetURL() const { | 573 GURL InitiateUploadOperation::GetURL() const { |
574 return GDataWapiUrlGenerator::AddStandardUrlParams(initiate_upload_url_); | 574 return GDataWapiUrlGenerator::AddStandardUrlParams(initiate_upload_url_); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 return true; | 814 return true; |
815 } | 815 } |
816 | 816 |
817 void ResumeUploadOperation::OnURLFetchUploadProgress( | 817 void ResumeUploadOperation::OnURLFetchUploadProgress( |
818 const URLFetcher* source, int64 current, int64 total) { | 818 const URLFetcher* source, int64 current, int64 total) { |
819 // Adjust the progress values according to the range currently uploaded. | 819 // Adjust the progress values according to the range currently uploaded. |
820 NotifyProgress(params_.start_position + current, params_.content_length); | 820 NotifyProgress(params_.start_position + current, params_.content_length); |
821 } | 821 } |
822 | 822 |
823 } // namespace google_apis | 823 } // namespace google_apis |
OLD | NEW |