| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const char kSupportsCreate[] = "supportsCreate"; | 100 const char kSupportsCreate[] = "supportsCreate"; |
| 101 const char kSupportsImport[] = "supportsImport"; | 101 const char kSupportsImport[] = "supportsImport"; |
| 102 const char kInstalled[] = "installed"; | 102 const char kInstalled[] = "installed"; |
| 103 const char kAuthorized[] = "authorized"; | 103 const char kAuthorized[] = "authorized"; |
| 104 const char kProductUrl[] = "productUrl"; | 104 const char kProductUrl[] = "productUrl"; |
| 105 const char kPrimaryMimeTypes[] = "primaryMimeTypes"; | 105 const char kPrimaryMimeTypes[] = "primaryMimeTypes"; |
| 106 const char kSecondaryMimeTypes[] = "secondaryMimeTypes"; | 106 const char kSecondaryMimeTypes[] = "secondaryMimeTypes"; |
| 107 const char kPrimaryFileExtensions[] = "primaryFileExtensions"; | 107 const char kPrimaryFileExtensions[] = "primaryFileExtensions"; |
| 108 const char kSecondaryFileExtensions[] = "secondaryFileExtensions"; | 108 const char kSecondaryFileExtensions[] = "secondaryFileExtensions"; |
| 109 const char kIcons[] = "icons"; | 109 const char kIcons[] = "icons"; |
| 110 const char kCreateUrl[] = "createUrl"; |
| 110 | 111 |
| 111 // Apps List | 112 // Apps List |
| 112 // https://developers.google.com/drive/v2/reference/apps/list | 113 // https://developers.google.com/drive/v2/reference/apps/list |
| 113 const char kAppListKind[] = "drive#appList"; | 114 const char kAppListKind[] = "drive#appList"; |
| 114 | 115 |
| 115 // Parent Resource | 116 // Parent Resource |
| 116 // https://developers.google.com/drive/v2/reference/parents | 117 // https://developers.google.com/drive/v2/reference/parents |
| 117 const char kParentReferenceKind[] = "drive#parentReference"; | 118 const char kParentReferenceKind[] = "drive#parentReference"; |
| 118 const char kParentLink[] = "parentLink"; | 119 const char kParentLink[] = "parentLink"; |
| 119 const char kIsRoot[] = "isRoot"; | 120 const char kIsRoot[] = "isRoot"; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 GetGURLFromString); | 322 GetGURLFromString); |
| 322 converter->RegisterRepeatedString(kPrimaryMimeTypes, | 323 converter->RegisterRepeatedString(kPrimaryMimeTypes, |
| 323 &AppResource::primary_mimetypes_); | 324 &AppResource::primary_mimetypes_); |
| 324 converter->RegisterRepeatedString(kSecondaryMimeTypes, | 325 converter->RegisterRepeatedString(kSecondaryMimeTypes, |
| 325 &AppResource::secondary_mimetypes_); | 326 &AppResource::secondary_mimetypes_); |
| 326 converter->RegisterRepeatedString(kPrimaryFileExtensions, | 327 converter->RegisterRepeatedString(kPrimaryFileExtensions, |
| 327 &AppResource::primary_file_extensions_); | 328 &AppResource::primary_file_extensions_); |
| 328 converter->RegisterRepeatedString(kSecondaryFileExtensions, | 329 converter->RegisterRepeatedString(kSecondaryFileExtensions, |
| 329 &AppResource::secondary_file_extensions_); | 330 &AppResource::secondary_file_extensions_); |
| 330 converter->RegisterRepeatedMessage(kIcons, &AppResource::icons_); | 331 converter->RegisterRepeatedMessage(kIcons, &AppResource::icons_); |
| 332 converter->RegisterCustomField<GURL>(kCreateUrl, |
| 333 &AppResource::create_url_, |
| 334 GetGURLFromString); |
| 331 } | 335 } |
| 332 | 336 |
| 333 // static | 337 // static |
| 334 scoped_ptr<AppResource> AppResource::CreateFrom(const base::Value& value) { | 338 scoped_ptr<AppResource> AppResource::CreateFrom(const base::Value& value) { |
| 335 scoped_ptr<AppResource> resource(new AppResource()); | 339 scoped_ptr<AppResource> resource(new AppResource()); |
| 336 if (!IsResourceKindExpected(value, kAppKind) || !resource->Parse(value)) { | 340 if (!IsResourceKindExpected(value, kAppKind) || !resource->Parse(value)) { |
| 337 LOG(ERROR) << "Unable to create: Invalid AppResource JSON!"; | 341 LOG(ERROR) << "Unable to create: Invalid AppResource JSON!"; |
| 338 return scoped_ptr<AppResource>(); | 342 return scoped_ptr<AppResource>(); |
| 339 } | 343 } |
| 340 return resource.Pass(); | 344 return resource.Pass(); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 return true; | 724 return true; |
| 721 base::JSONValueConverter<ImageMediaMetadata> converter; | 725 base::JSONValueConverter<ImageMediaMetadata> converter; |
| 722 if (!converter.Convert(value, this)) { | 726 if (!converter.Convert(value, this)) { |
| 723 LOG(ERROR) << "Unable to parse: Invalid ImageMediaMetadata."; | 727 LOG(ERROR) << "Unable to parse: Invalid ImageMediaMetadata."; |
| 724 return false; | 728 return false; |
| 725 } | 729 } |
| 726 return true; | 730 return true; |
| 727 } | 731 } |
| 728 | 732 |
| 729 } // namespace google_apis | 733 } // namespace google_apis |
| OLD | NEW |