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 GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ | 5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ |
6 #define GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ | 6 #define GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 594 |
595 // Creates file list from parsed JSON. | 595 // Creates file list from parsed JSON. |
596 static scoped_ptr<FileList> CreateFrom(const base::Value& value); | 596 static scoped_ptr<FileList> CreateFrom(const base::Value& value); |
597 | 597 |
598 // Returns a link to the next page of files. The URL includes the next page | 598 // Returns a link to the next page of files. The URL includes the next page |
599 // token. | 599 // token. |
600 const GURL& next_link() const { return next_link_; } | 600 const GURL& next_link() const { return next_link_; } |
601 | 601 |
602 // Returns a set of files in this list. | 602 // Returns a set of files in this list. |
603 const ScopedVector<FileResource>& items() const { return items_; } | 603 const ScopedVector<FileResource>& items() const { return items_; } |
| 604 ScopedVector<FileResource>* mutable_items() { return &items_; } |
604 | 605 |
605 void set_next_link(const GURL& next_link) { | 606 void set_next_link(const GURL& next_link) { |
606 next_link_ = next_link; | 607 next_link_ = next_link; |
607 } | 608 } |
608 void set_items(ScopedVector<FileResource> items) { | |
609 items_ = items.Pass(); | |
610 } | |
611 | 609 |
612 private: | 610 private: |
613 friend class DriveAPIParserTest; | 611 friend class DriveAPIParserTest; |
614 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, FileListParser); | 612 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, FileListParser); |
615 | 613 |
616 // Parses and initializes data members from content of |value|. | 614 // Parses and initializes data members from content of |value|. |
617 // Return false if parsing fails. | 615 // Return false if parsing fails. |
618 bool Parse(const base::Value& value); | 616 bool Parse(const base::Value& value); |
619 | 617 |
620 GURL next_link_; | 618 GURL next_link_; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 706 |
709 // Returns a link to the next page of files. The URL includes the next page | 707 // Returns a link to the next page of files. The URL includes the next page |
710 // token. | 708 // token. |
711 const GURL& next_link() const { return next_link_; } | 709 const GURL& next_link() const { return next_link_; } |
712 | 710 |
713 // Returns the largest change ID number. | 711 // Returns the largest change ID number. |
714 int64 largest_change_id() const { return largest_change_id_; } | 712 int64 largest_change_id() const { return largest_change_id_; } |
715 | 713 |
716 // Returns a set of changes in this list. | 714 // Returns a set of changes in this list. |
717 const ScopedVector<ChangeResource>& items() const { return items_; } | 715 const ScopedVector<ChangeResource>& items() const { return items_; } |
| 716 ScopedVector<ChangeResource>* mutable_items() { return &items_; } |
718 | 717 |
719 void set_next_link(const GURL& next_link) { | 718 void set_next_link(const GURL& next_link) { |
720 next_link_ = next_link; | 719 next_link_ = next_link; |
721 } | 720 } |
722 void set_largest_change_id(int64 largest_change_id) { | 721 void set_largest_change_id(int64 largest_change_id) { |
723 largest_change_id_ = largest_change_id; | 722 largest_change_id_ = largest_change_id; |
724 } | 723 } |
725 void set_items(ScopedVector<ChangeResource> items) { | |
726 items_ = items.Pass(); | |
727 } | |
728 | 724 |
729 private: | 725 private: |
730 friend class DriveAPIParserTest; | 726 friend class DriveAPIParserTest; |
731 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, ChangeListParser); | 727 FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, ChangeListParser); |
732 | 728 |
733 // Parses and initializes data members from content of |value|. | 729 // Parses and initializes data members from content of |value|. |
734 // Return false if parsing fails. | 730 // Return false if parsing fails. |
735 bool Parse(const base::Value& value); | 731 bool Parse(const base::Value& value); |
736 | 732 |
737 GURL next_link_; | 733 GURL next_link_; |
738 int64 largest_change_id_; | 734 int64 largest_change_id_; |
739 ScopedVector<ChangeResource> items_; | 735 ScopedVector<ChangeResource> items_; |
740 | 736 |
741 DISALLOW_COPY_AND_ASSIGN(ChangeList); | 737 DISALLOW_COPY_AND_ASSIGN(ChangeList); |
742 }; | 738 }; |
743 | 739 |
744 } // namespace google_apis | 740 } // namespace google_apis |
745 | 741 |
746 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ | 742 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_PARSER_H_ |
OLD | NEW |