| 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 "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 base::ThreadTaskRunnerHandle::Get()->PostTask( | 347 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 348 FROM_HERE, base::Bind(&UrlFetchRequestBase::CompleteRequestWithError, | 348 FROM_HERE, base::Bind(&UrlFetchRequestBase::CompleteRequestWithError, |
| 349 weak_ptr_factory_.GetWeakPtr(), error_code)); | 349 weak_ptr_factory_.GetWeakPtr(), error_code)); |
| 350 return; | 350 return; |
| 351 } | 351 } |
| 352 | 352 |
| 353 re_authenticate_callback_ = callback; | 353 re_authenticate_callback_ = callback; |
| 354 DVLOG(1) << "URL: " << url.spec(); | 354 DVLOG(1) << "URL: " << url.spec(); |
| 355 | 355 |
| 356 URLFetcher::RequestType request_type = GetRequestType(); | 356 URLFetcher::RequestType request_type = GetRequestType(); |
| 357 url_fetcher_.reset(URLFetcher::Create(url, request_type, this)); | 357 url_fetcher_ = URLFetcher::Create(url, request_type, this); |
| 358 url_fetcher_->SetRequestContext(sender_->url_request_context_getter()); | 358 url_fetcher_->SetRequestContext(sender_->url_request_context_getter()); |
| 359 // Always set flags to neither send nor save cookies. | 359 // Always set flags to neither send nor save cookies. |
| 360 url_fetcher_->SetLoadFlags( | 360 url_fetcher_->SetLoadFlags( |
| 361 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | | 361 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | |
| 362 net::LOAD_DISABLE_CACHE); | 362 net::LOAD_DISABLE_CACHE); |
| 363 | 363 |
| 364 base::FilePath output_file_path; | 364 base::FilePath output_file_path; |
| 365 GetContentCallback get_content_callback; | 365 GetContentCallback get_content_callback; |
| 366 GetOutputFilePath(&output_file_path, &get_content_callback); | 366 GetOutputFilePath(&output_file_path, &get_content_callback); |
| 367 if (!get_content_callback.is_null()) | 367 if (!get_content_callback.is_null()) |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 download_action_callback_.Run(code, temp_file); | 1010 download_action_callback_.Run(code, temp_file); |
| 1011 OnProcessURLFetchResultsComplete(); | 1011 OnProcessURLFetchResultsComplete(); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( | 1014 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( |
| 1015 DriveApiErrorCode code) { | 1015 DriveApiErrorCode code) { |
| 1016 download_action_callback_.Run(code, base::FilePath()); | 1016 download_action_callback_.Run(code, base::FilePath()); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 } // namespace google_apis | 1019 } // namespace google_apis |
| OLD | NEW |