| 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_parser.h" | 5 #include "google_apis/drive/drive_api_parser.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // File Resource | 140 // File Resource |
| 141 // https://developers.google.com/drive/v2/reference/files | 141 // https://developers.google.com/drive/v2/reference/files |
| 142 const char kFileKind[] = "drive#file"; | 142 const char kFileKind[] = "drive#file"; |
| 143 const char kTitle[] = "title"; | 143 const char kTitle[] = "title"; |
| 144 const char kMimeType[] = "mimeType"; | 144 const char kMimeType[] = "mimeType"; |
| 145 const char kCreatedDate[] = "createdDate"; | 145 const char kCreatedDate[] = "createdDate"; |
| 146 const char kModificationDate[] = "modificationDate"; | 146 const char kModificationDate[] = "modificationDate"; |
| 147 const char kModifiedDate[] = "modifiedDate"; | 147 const char kModifiedDate[] = "modifiedDate"; |
| 148 const char kLastViewedByMeDate[] = "lastViewedByMeDate"; | 148 const char kLastViewedByMeDate[] = "lastViewedByMeDate"; |
| 149 const char kSharedWithMeDate[] = "sharedWithMeDate"; | 149 const char kSharedWithMeDate[] = "sharedWithMeDate"; |
| 150 const char kDownloadUrl[] = "downloadUrl"; |
| 150 const char kMd5Checksum[] = "md5Checksum"; | 151 const char kMd5Checksum[] = "md5Checksum"; |
| 151 const char kFileSize[] = "fileSize"; | 152 const char kFileSize[] = "fileSize"; |
| 152 const char kAlternateLink[] = "alternateLink"; | 153 const char kAlternateLink[] = "alternateLink"; |
| 153 const char kParents[] = "parents"; | 154 const char kParents[] = "parents"; |
| 154 const char kOpenWithLinks[] = "openWithLinks"; | 155 const char kOpenWithLinks[] = "openWithLinks"; |
| 155 const char kLabels[] = "labels"; | 156 const char kLabels[] = "labels"; |
| 156 const char kImageMediaMetadata[] = "imageMediaMetadata"; | 157 const char kImageMediaMetadata[] = "imageMediaMetadata"; |
| 157 const char kShared[] = "shared"; | 158 const char kShared[] = "shared"; |
| 158 // These 5 flags are defined under |labels|. | 159 // These 5 flags are defined under |labels|. |
| 159 const char kLabelTrashed[] = "trashed"; | 160 const char kLabelTrashed[] = "trashed"; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 &util::GetTimeFromString); | 454 &util::GetTimeFromString); |
| 454 converter->RegisterCustomField<base::Time>( | 455 converter->RegisterCustomField<base::Time>( |
| 455 kLastViewedByMeDate, | 456 kLastViewedByMeDate, |
| 456 &FileResource::last_viewed_by_me_date_, | 457 &FileResource::last_viewed_by_me_date_, |
| 457 &util::GetTimeFromString); | 458 &util::GetTimeFromString); |
| 458 converter->RegisterCustomField<base::Time>( | 459 converter->RegisterCustomField<base::Time>( |
| 459 kSharedWithMeDate, | 460 kSharedWithMeDate, |
| 460 &FileResource::shared_with_me_date_, | 461 &FileResource::shared_with_me_date_, |
| 461 &util::GetTimeFromString); | 462 &util::GetTimeFromString); |
| 462 converter->RegisterBoolField(kShared, &FileResource::shared_); | 463 converter->RegisterBoolField(kShared, &FileResource::shared_); |
| 464 converter->RegisterCustomField<GURL>( |
| 465 kDownloadUrl, &FileResource::download_url_, GetGURLFromString); |
| 463 converter->RegisterStringField(kMd5Checksum, &FileResource::md5_checksum_); | 466 converter->RegisterStringField(kMd5Checksum, &FileResource::md5_checksum_); |
| 464 converter->RegisterCustomField<int64>(kFileSize, | 467 converter->RegisterCustomField<int64>(kFileSize, |
| 465 &FileResource::file_size_, | 468 &FileResource::file_size_, |
| 466 &base::StringToInt64); | 469 &base::StringToInt64); |
| 467 converter->RegisterCustomField<GURL>(kAlternateLink, | 470 converter->RegisterCustomField<GURL>(kAlternateLink, |
| 468 &FileResource::alternate_link_, | 471 &FileResource::alternate_link_, |
| 469 GetGURLFromString); | 472 GetGURLFromString); |
| 470 converter->RegisterCustomValueField<std::vector<ParentReference> >( | 473 converter->RegisterCustomValueField<std::vector<ParentReference> >( |
| 471 kParents, | 474 kParents, |
| 472 &FileResource::parents_, | 475 &FileResource::parents_, |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 bool ImageMediaMetadata::Parse(const base::Value& value) { | 698 bool ImageMediaMetadata::Parse(const base::Value& value) { |
| 696 base::JSONValueConverter<ImageMediaMetadata> converter; | 699 base::JSONValueConverter<ImageMediaMetadata> converter; |
| 697 if (!converter.Convert(value, this)) { | 700 if (!converter.Convert(value, this)) { |
| 698 LOG(ERROR) << "Unable to parse: Invalid ImageMediaMetadata."; | 701 LOG(ERROR) << "Unable to parse: Invalid ImageMediaMetadata."; |
| 699 return false; | 702 return false; |
| 700 } | 703 } |
| 701 return true; | 704 return true; |
| 702 } | 705 } |
| 703 | 706 |
| 704 } // namespace google_apis | 707 } // namespace google_apis |
| OLD | NEW |