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