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/base_operations.h" | 5 #include "chrome/browser/google_apis/base_operations.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } else { | 179 } else { |
180 // Even if there is no content data, UrlFetcher requires to set empty | 180 // Even if there is no content data, UrlFetcher requires to set empty |
181 // upload data string for POST, PUT and PATCH methods, explicitly. | 181 // upload data string for POST, PUT and PATCH methods, explicitly. |
182 // It is because that most requests of those methods have non-empty | 182 // It is because that most requests of those methods have non-empty |
183 // body, and UrlFetcher checks whether it is actually not forgotten. | 183 // body, and UrlFetcher checks whether it is actually not forgotten. |
184 if (request_type == URLFetcher::POST || | 184 if (request_type == URLFetcher::POST || |
185 request_type == URLFetcher::PUT || | 185 request_type == URLFetcher::PUT || |
186 request_type == URLFetcher::PATCH) { | 186 request_type == URLFetcher::PATCH) { |
187 // Set empty upload content-type and upload content, so that | 187 // Set empty upload content-type and upload content, so that |
188 // the request will have no "Content-type: " header and no content. | 188 // the request will have no "Content-type: " header and no content. |
189 url_fetcher_->SetUploadData("", ""); | 189 url_fetcher_->SetUploadData(std::string(), std::string()); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 // Register to operation registry. | 193 // Register to operation registry. |
194 NotifyStartToOperationRegistry(); | 194 NotifyStartToOperationRegistry(); |
195 | 195 |
196 url_fetcher_->Start(); | 196 url_fetcher_->Start(); |
197 started_ = true; | 197 started_ = true; |
198 } | 198 } |
199 | 199 |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 712 |
713 download_action_callback_.Run(code, temp_file); | 713 download_action_callback_.Run(code, temp_file); |
714 OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS); | 714 OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS); |
715 } | 715 } |
716 | 716 |
717 void DownloadFileOperation::RunCallbackOnPrematureFailure(GDataErrorCode code) { | 717 void DownloadFileOperation::RunCallbackOnPrematureFailure(GDataErrorCode code) { |
718 download_action_callback_.Run(code, base::FilePath()); | 718 download_action_callback_.Run(code, base::FilePath()); |
719 } | 719 } |
720 | 720 |
721 } // namespace google_apis | 721 } // namespace google_apis |
OLD | NEW |