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_GOOGLE_APIS_GDATA_WAPI_PARSER_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_PARSER_H_ |
6 #define CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_PARSER_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 const ChangeResource& change); | 375 const ChangeResource& change); |
376 | 376 |
377 // Returns name of entry node. | 377 // Returns name of entry node. |
378 static std::string GetEntryNodeName(); | 378 static std::string GetEntryNodeName(); |
379 | 379 |
380 // Registers the mapping between JSON field names and the members in | 380 // Registers the mapping between JSON field names and the members in |
381 // this class. | 381 // this class. |
382 static void RegisterJSONConverter( | 382 static void RegisterJSONConverter( |
383 base::JSONValueConverter<DocumentEntry>* converter); | 383 base::JSONValueConverter<DocumentEntry>* converter); |
384 | 384 |
385 // Helper function for parsing bool fields based on presence of | 385 // Sets true to |result| if the field exists. |
386 // their value nodes. | 386 // Always returns true even when the field does not exist. |
387 static bool HasFieldPresent(const base::Value* value, bool* result); | 387 static bool HasFieldPresent(const base::Value* value, bool* result); |
388 | 388 |
| 389 // Parses |value| as int64 and sets it to |result|. If the field does not |
| 390 // exist, sets 0 to |result| as default value. |
| 391 // Returns true if |value| is NULL or it is parsed as int64 successfully. |
| 392 static bool ParseChangestamp(const base::Value* value, int64* result); |
| 393 |
389 // Returns true if |file| has one of the hosted document extensions. | 394 // Returns true if |file| has one of the hosted document extensions. |
390 static bool HasHostedDocumentExtension(const FilePath& file); | 395 static bool HasHostedDocumentExtension(const FilePath& file); |
391 | 396 |
392 // Document entry resource id. | 397 // Document entry resource id. |
393 const std::string& resource_id() const { return resource_id_; } | 398 const std::string& resource_id() const { return resource_id_; } |
394 | 399 |
395 // Document entry id. | 400 // Document entry id. |
396 const std::string& id() const { return id_; } | 401 const std::string& id() const { return id_; } |
397 | 402 |
398 // Document entry kind. | 403 // Document entry kind. |
(...skipping 28 matching lines...) Expand all Loading... |
427 | 432 |
428 // Document feed file content MD5 (exists only for kinds FILE and PDF). | 433 // Document feed file content MD5 (exists only for kinds FILE and PDF). |
429 const std::string& file_md5() const { return file_md5_; } | 434 const std::string& file_md5() const { return file_md5_; } |
430 | 435 |
431 // Document feed file size (exists only for kinds FILE and PDF). | 436 // Document feed file size (exists only for kinds FILE and PDF). |
432 int64 file_size() const { return file_size_; } | 437 int64 file_size() const { return file_size_; } |
433 | 438 |
434 // True if the file or directory is deleted (applicable to change feeds only). | 439 // True if the file or directory is deleted (applicable to change feeds only). |
435 bool deleted() const { return deleted_ || removed_; } | 440 bool deleted() const { return deleted_ || removed_; } |
436 | 441 |
| 442 // Changestamp (exists only for change query results). |
| 443 // If not exists, defaults to 0. |
| 444 int64 changestamp() const { return changestamp_; } |
| 445 |
437 // Text version of document entry kind. Returns an empty string for | 446 // Text version of document entry kind. Returns an empty string for |
438 // unknown entry kind. | 447 // unknown entry kind. |
439 std::string GetEntryKindText() const; | 448 std::string GetEntryKindText() const; |
440 | 449 |
441 // Returns preferred file extension for hosted documents. If entry is not | 450 // Returns preferred file extension for hosted documents. If entry is not |
442 // a hosted document, this call returns an empty string. | 451 // a hosted document, this call returns an empty string. |
443 std::string GetHostedDocumentExtension() const; | 452 std::string GetHostedDocumentExtension() const; |
444 | 453 |
445 // True if document entry is remotely hosted. | 454 // True if document entry is remotely hosted. |
446 bool is_hosted_document() const { | 455 bool is_hosted_document() const { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 std::vector<string16> labels_; | 519 std::vector<string16> labels_; |
511 Content content_; | 520 Content content_; |
512 ScopedVector<FeedLink> feed_links_; | 521 ScopedVector<FeedLink> feed_links_; |
513 // Optional fields for files only. | 522 // Optional fields for files only. |
514 string16 filename_; | 523 string16 filename_; |
515 string16 suggested_filename_; | 524 string16 suggested_filename_; |
516 std::string file_md5_; | 525 std::string file_md5_; |
517 int64 file_size_; | 526 int64 file_size_; |
518 bool deleted_; | 527 bool deleted_; |
519 bool removed_; | 528 bool removed_; |
| 529 int64 changestamp_; |
520 | 530 |
521 DISALLOW_COPY_AND_ASSIGN(DocumentEntry); | 531 DISALLOW_COPY_AND_ASSIGN(DocumentEntry); |
522 }; | 532 }; |
523 | 533 |
524 // Document feed represents a list of entries. The feed is paginated and | 534 // Document feed represents a list of entries. The feed is paginated and |
525 // the rest of the feed can be fetched by retrieving the remaining parts of the | 535 // the rest of the feed can be fetched by retrieving the remaining parts of the |
526 // feed from URLs provided by GetNextFeedURL() method. | 536 // feed from URLs provided by GetNextFeedURL() method. |
527 class DocumentFeed : public FeedEntry { | 537 class DocumentFeed : public FeedEntry { |
528 public: | 538 public: |
529 virtual ~DocumentFeed(); | 539 virtual ~DocumentFeed(); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 int64 largest_changestamp_; | 737 int64 largest_changestamp_; |
728 ScopedVector<InstalledApp> installed_apps_; | 738 ScopedVector<InstalledApp> installed_apps_; |
729 | 739 |
730 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); | 740 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); |
731 }; | 741 }; |
732 | 742 |
733 | 743 |
734 } // namespace google_apis | 744 } // namespace google_apis |
735 | 745 |
736 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_PARSER_H_ | 746 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_PARSER_H_ |
OLD | NEW |