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_PARSER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 // account. | 651 // account. |
652 class AccountMetadataFeed { | 652 class AccountMetadataFeed { |
653 public: | 653 public: |
654 virtual ~AccountMetadataFeed(); | 654 virtual ~AccountMetadataFeed(); |
655 | 655 |
656 // Creates feed from parsed JSON Value. You should call this | 656 // Creates feed from parsed JSON Value. You should call this |
657 // instead of instantiating JSONValueConverter by yourself because | 657 // instead of instantiating JSONValueConverter by yourself because |
658 // this method does some post-process for some fields. See | 658 // this method does some post-process for some fields. See |
659 // FillRemainingFields comment and implementation in DocumentEntry | 659 // FillRemainingFields comment and implementation in DocumentEntry |
660 // class for the details. | 660 // class for the details. |
661 static scoped_ptr<AccountMetadataFeed> CreateFrom(const base::Value& value); | 661 static scoped_ptr<AccountMetadataFeed> CreateFrom(const base::Value& value, |
| 662 bool use_drive_api); |
662 | 663 |
663 int64 quota_bytes_total() const { | 664 int64 quota_bytes_total() const { |
664 return quota_bytes_total_; | 665 return quota_bytes_total_; |
665 } | 666 } |
666 | 667 |
667 int64 quota_bytes_used() const { | 668 int64 quota_bytes_used() const { |
668 return quota_bytes_used_; | 669 return quota_bytes_used_; |
669 } | 670 } |
670 | 671 |
671 int largest_changestamp() const { | 672 int largest_changestamp() const { |
672 return largest_changestamp_; | 673 return largest_changestamp_; |
673 } | 674 } |
674 | 675 |
675 const ScopedVector<InstalledApp>& installed_apps() const { | 676 const ScopedVector<InstalledApp>& installed_apps() const { |
676 return installed_apps_; | 677 return installed_apps_; |
677 } | 678 } |
678 | 679 |
679 // Registers the mapping between JSON field names and the members in | 680 protected: |
680 // this class. | |
681 static void RegisterJSONConverter( | |
682 base::JSONValueConverter<AccountMetadataFeed>* converter); | |
683 | |
684 private: | |
685 AccountMetadataFeed(); | 681 AccountMetadataFeed(); |
686 | 682 |
687 // Parses and initializes data members from content of |value|. | |
688 // Return false if parsing fails. | |
689 bool Parse(const base::Value& value); | |
690 | |
691 int64 quota_bytes_total_; | 683 int64 quota_bytes_total_; |
692 int64 quota_bytes_used_; | 684 int64 quota_bytes_used_; |
693 int largest_changestamp_; | 685 int largest_changestamp_; |
694 ScopedVector<InstalledApp> installed_apps_; | 686 ScopedVector<InstalledApp> installed_apps_; |
695 | 687 |
| 688 private: |
696 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); | 689 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); |
697 }; | 690 }; |
698 | 691 |
699 | |
700 } // namespace gdata | 692 } // namespace gdata |
701 | 693 |
702 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ | 694 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ |
OLD | NEW |