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 "google_apis/drive/base_requests.h" | 5 #include "google_apis/drive/base_requests.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "net/base/load_flags.h" | 30 #include "net/base/load_flags.h" |
31 #include "net/base/mime_util.h" | 31 #include "net/base/mime_util.h" |
32 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
33 #include "net/base/upload_bytes_element_reader.h" | 33 #include "net/base/upload_bytes_element_reader.h" |
34 #include "net/base/upload_data_stream.h" | 34 #include "net/base/upload_data_stream.h" |
35 #include "net/base/upload_element_reader.h" | 35 #include "net/base/upload_element_reader.h" |
36 #include "net/base/upload_file_element_reader.h" | 36 #include "net/base/upload_file_element_reader.h" |
37 #include "net/http/http_byte_range.h" | 37 #include "net/http/http_byte_range.h" |
38 #include "net/http/http_response_headers.h" | 38 #include "net/http/http_response_headers.h" |
39 #include "net/http/http_util.h" | 39 #include "net/http/http_util.h" |
| 40 #include "net/traffic_annotation/network_traffic_annotation.h" |
40 #include "net/url_request/url_fetcher.h" | 41 #include "net/url_request/url_fetcher.h" |
41 #include "net/url_request/url_request_status.h" | 42 #include "net/url_request/url_request_status.h" |
42 | 43 |
43 using net::URLFetcher; | 44 using net::URLFetcher; |
44 | 45 |
45 namespace { | 46 namespace { |
46 | 47 |
47 // Template for optional OAuth2 authorization HTTP header. | 48 // Template for optional OAuth2 authorization HTTP header. |
48 const char kAuthorizationHeaderFormat[] = "Authorization: Bearer %s"; | 49 const char kAuthorizationHeaderFormat[] = "Authorization: Bearer %s"; |
49 // Template for GData API version HTTP header. | 50 // Template for GData API version HTTP header. |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 base::ThreadTaskRunnerHandle::Get()->PostTask( | 393 base::ThreadTaskRunnerHandle::Get()->PostTask( |
393 FROM_HERE, base::Bind(&UrlFetchRequestBase::CompleteRequestWithError, | 394 FROM_HERE, base::Bind(&UrlFetchRequestBase::CompleteRequestWithError, |
394 weak_ptr_factory_.GetWeakPtr(), error_code)); | 395 weak_ptr_factory_.GetWeakPtr(), error_code)); |
395 return; | 396 return; |
396 } | 397 } |
397 | 398 |
398 re_authenticate_callback_ = callback; | 399 re_authenticate_callback_ = callback; |
399 DVLOG(1) << "URL: " << url.spec(); | 400 DVLOG(1) << "URL: " << url.spec(); |
400 | 401 |
401 URLFetcher::RequestType request_type = GetRequestType(); | 402 URLFetcher::RequestType request_type = GetRequestType(); |
402 url_fetcher_ = URLFetcher::Create(url, request_type, this); | 403 url_fetcher_ = URLFetcher::Create(url, request_type, this, |
| 404 sender_->get_traffic_annotation_tag()); |
403 url_fetcher_->SetRequestContext(sender_->url_request_context_getter()); | 405 url_fetcher_->SetRequestContext(sender_->url_request_context_getter()); |
404 // Always set flags to neither send nor save cookies. | 406 // Always set flags to neither send nor save cookies. |
405 url_fetcher_->SetLoadFlags( | 407 url_fetcher_->SetLoadFlags( |
406 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | | 408 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | |
407 net::LOAD_DISABLE_CACHE); | 409 net::LOAD_DISABLE_CACHE); |
408 | 410 |
409 base::FilePath output_file_path; | 411 base::FilePath output_file_path; |
410 GetContentCallback get_content_callback; | 412 GetContentCallback get_content_callback; |
411 GetOutputFilePath(&output_file_path, &get_content_callback); | 413 GetOutputFilePath(&output_file_path, &get_content_callback); |
412 if (!get_content_callback.is_null()) | 414 if (!get_content_callback.is_null()) |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 download_action_callback_.Run(code, temp_file); | 1002 download_action_callback_.Run(code, temp_file); |
1001 OnProcessURLFetchResultsComplete(); | 1003 OnProcessURLFetchResultsComplete(); |
1002 } | 1004 } |
1003 | 1005 |
1004 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( | 1006 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( |
1005 DriveApiErrorCode code) { | 1007 DriveApiErrorCode code) { |
1006 download_action_callback_.Run(code, base::FilePath()); | 1008 download_action_callback_.Run(code, base::FilePath()); |
1007 } | 1009 } |
1008 | 1010 |
1009 } // namespace google_apis | 1011 } // namespace google_apis |
OLD | NEW |