| 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_PARSER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_PARSER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_PARSER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_PARSER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 template <class NestedType> | 29 template <class NestedType> |
| 30 class RepeatedMessageConverter; | 30 class RepeatedMessageConverter; |
| 31 } // namespace internal | 31 } // namespace internal |
| 32 | 32 |
| 33 } // namespace base | 33 } // namespace base |
| 34 | 34 |
| 35 // Defines data elements of Google Documents API as described in | 35 // Defines data elements of Google Documents API as described in |
| 36 // http://code.google.com/apis/documents/. | 36 // http://code.google.com/apis/documents/. |
| 37 namespace gdata { | 37 namespace gdata { |
| 38 | 38 |
| 39 // TODO(kochi): These forward declarations will be unnecessary once |
| 40 // http://crbug.com/142293 is resolved. |
| 41 class ChangeList; |
| 42 class ChangeResource; |
| 43 class FileList; |
| 44 class FileResource; |
| 45 |
| 39 // Defines link (URL) of an entity (document, file, feed...). Each entity could | 46 // Defines link (URL) of an entity (document, file, feed...). Each entity could |
| 40 // have more than one link representing it. | 47 // have more than one link representing it. |
| 41 class Link { | 48 class Link { |
| 42 public: | 49 public: |
| 43 enum LinkType { | 50 enum LinkType { |
| 44 UNKNOWN, | 51 UNKNOWN, |
| 45 SELF, | 52 SELF, |
| 46 NEXT, | 53 NEXT, |
| 47 PARENT, | 54 PARENT, |
| 48 ALTERNATE, | 55 ALTERNATE, |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 371 |
| 365 // Creates document entry from parsed JSON Value. You should call | 372 // Creates document entry from parsed JSON Value. You should call |
| 366 // this instead of instantiating JSONValueConverter by yourself | 373 // this instead of instantiating JSONValueConverter by yourself |
| 367 // because this method does some post-process for some fields. See | 374 // because this method does some post-process for some fields. See |
| 368 // FillRemainingFields comment and implementation for the details. | 375 // FillRemainingFields comment and implementation for the details. |
| 369 static DocumentEntry* CreateFrom(const base::Value& value); | 376 static DocumentEntry* CreateFrom(const base::Value& value); |
| 370 | 377 |
| 371 // Creates document entry from parsed XML. | 378 // Creates document entry from parsed XML. |
| 372 static DocumentEntry* CreateFromXml(XmlReader* xml_reader); | 379 static DocumentEntry* CreateFromXml(XmlReader* xml_reader); |
| 373 | 380 |
| 381 // Creates document entry from FileResource. |
| 382 // TODO(kochi): This should go away soon. http://crbug.com/142293 |
| 383 static DocumentEntry* CreateFromFileResource(const FileResource& file); |
| 384 |
| 385 // Creates document entry from ChangeResource. |
| 386 // Todo(Kochi): This should go away soon. http://crbug.com/142293 |
| 387 static DocumentEntry* CreateFromChangeResource(const ChangeResource& change); |
| 388 |
| 374 // Returns name of entry node. | 389 // Returns name of entry node. |
| 375 static std::string GetEntryNodeName(); | 390 static std::string GetEntryNodeName(); |
| 376 | 391 |
| 377 // Registers the mapping between JSON field names and the members in | 392 // Registers the mapping between JSON field names and the members in |
| 378 // this class. | 393 // this class. |
| 379 static void RegisterJSONConverter( | 394 static void RegisterJSONConverter( |
| 380 base::JSONValueConverter<DocumentEntry>* converter); | 395 base::JSONValueConverter<DocumentEntry>* converter); |
| 381 | 396 |
| 382 // Helper function for parsing bool fields based on presence of | 397 // Helper function for parsing bool fields based on presence of |
| 383 // their value nodes. | 398 // their value nodes. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 // "version": "1.0" | 520 // "version": "1.0" |
| 506 // } | 521 // } |
| 507 static scoped_ptr<DocumentFeed> ExtractAndParse(const base::Value& value); | 522 static scoped_ptr<DocumentFeed> ExtractAndParse(const base::Value& value); |
| 508 | 523 |
| 509 // Creates feed from parsed JSON Value. You should call this | 524 // Creates feed from parsed JSON Value. You should call this |
| 510 // instead of instantiating JSONValueConverter by yourself because | 525 // instead of instantiating JSONValueConverter by yourself because |
| 511 // this method does some post-process for some fields. See | 526 // this method does some post-process for some fields. See |
| 512 // FillRemainingFields comment and implementation in DocumentEntry | 527 // FillRemainingFields comment and implementation in DocumentEntry |
| 513 // class for the details. | 528 // class for the details. |
| 514 static scoped_ptr<DocumentFeed> CreateFrom(const base::Value& value); | 529 static scoped_ptr<DocumentFeed> CreateFrom(const base::Value& value); |
| 530 // Variant of CreateFrom() above, creates feed from parsed ChangeList. |
| 531 // TODO(kochi): This should go away soon. http://crbug.com/142293 |
| 532 static scoped_ptr<DocumentFeed> CreateFromChangeList( |
| 533 const ChangeList& changelist); |
| 515 | 534 |
| 516 // Registers the mapping between JSON field names and the members in | 535 // Registers the mapping between JSON field names and the members in |
| 517 // this class. | 536 // this class. |
| 518 static void RegisterJSONConverter( | 537 static void RegisterJSONConverter( |
| 519 base::JSONValueConverter<DocumentFeed>* converter); | 538 base::JSONValueConverter<DocumentFeed>* converter); |
| 520 | 539 |
| 521 // Returns true and passes|url| of the next feed if the current entry list | 540 // Returns true and passes|url| of the next feed if the current entry list |
| 522 // does not completed this feed. | 541 // does not completed this feed. |
| 523 bool GetNextFeedURL(GURL* url); | 542 bool GetNextFeedURL(GURL* url); |
| 524 | 543 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 int64 largest_changestamp_; | 705 int64 largest_changestamp_; |
| 687 ScopedVector<InstalledApp> installed_apps_; | 706 ScopedVector<InstalledApp> installed_apps_; |
| 688 | 707 |
| 689 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); | 708 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); |
| 690 }; | 709 }; |
| 691 | 710 |
| 692 | 711 |
| 693 } // namespace gdata | 712 } // namespace gdata |
| 694 | 713 |
| 695 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_PARSER_H_ | 714 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_PARSER_H_ |
| OLD | NEW |