| 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/drive_api_requests.h" | 5 #include "google_apis/drive/drive_api_requests.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 net::URLFetcher::RequestType FilesInsertRequest::GetRequestType() const { | 203 net::URLFetcher::RequestType FilesInsertRequest::GetRequestType() const { |
| 204 return net::URLFetcher::POST; | 204 return net::URLFetcher::POST; |
| 205 } | 205 } |
| 206 | 206 |
| 207 bool FilesInsertRequest::GetContentData(std::string* upload_content_type, | 207 bool FilesInsertRequest::GetContentData(std::string* upload_content_type, |
| 208 std::string* upload_content) { | 208 std::string* upload_content) { |
| 209 *upload_content_type = kContentTypeApplicationJson; | 209 *upload_content_type = kContentTypeApplicationJson; |
| 210 | 210 |
| 211 base::DictionaryValue root; | 211 base::DictionaryValue root; |
| 212 | 212 |
| 213 if (!last_viewed_by_me_date_.is_null()) { |
| 214 root.SetString("lastViewedByMeDate", |
| 215 util::FormatTimeAsString(last_viewed_by_me_date_)); |
| 216 } |
| 217 |
| 213 if (!mime_type_.empty()) | 218 if (!mime_type_.empty()) |
| 214 root.SetString("mimeType", mime_type_); | 219 root.SetString("mimeType", mime_type_); |
| 215 | 220 |
| 221 if (!modified_date_.is_null()) |
| 222 root.SetString("modifiedDate", util::FormatTimeAsString(modified_date_)); |
| 223 |
| 216 if (!parents_.empty()) { | 224 if (!parents_.empty()) { |
| 217 base::ListValue* parents_value = new base::ListValue; | 225 base::ListValue* parents_value = new base::ListValue; |
| 218 for (size_t i = 0; i < parents_.size(); ++i) { | 226 for (size_t i = 0; i < parents_.size(); ++i) { |
| 219 base::DictionaryValue* parent = new base::DictionaryValue; | 227 base::DictionaryValue* parent = new base::DictionaryValue; |
| 220 parent->SetString("id", parents_[i]); | 228 parent->SetString("id", parents_[i]); |
| 221 parents_value->Append(parent); | 229 parents_value->Append(parent); |
| 222 } | 230 } |
| 223 root.Set("parents", parents_value); | 231 root.Set("parents", parents_value); |
| 224 } | 232 } |
| 225 | 233 |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 progress_callback, | 827 progress_callback, |
| 820 url_generator.GenerateDownloadFileUrl(resource_id), | 828 url_generator.GenerateDownloadFileUrl(resource_id), |
| 821 output_file_path) { | 829 output_file_path) { |
| 822 } | 830 } |
| 823 | 831 |
| 824 DownloadFileRequest::~DownloadFileRequest() { | 832 DownloadFileRequest::~DownloadFileRequest() { |
| 825 } | 833 } |
| 826 | 834 |
| 827 } // namespace drive | 835 } // namespace drive |
| 828 } // namespace google_apis | 836 } // namespace google_apis |
| OLD | NEW |