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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 POST, | 55 POST, |
56 BATCH, | 56 BATCH, |
57 RESUMABLE_EDIT_MEDIA, | 57 RESUMABLE_EDIT_MEDIA, |
58 RESUMABLE_CREATE_MEDIA, | 58 RESUMABLE_CREATE_MEDIA, |
59 TABLES_FEED, | 59 TABLES_FEED, |
60 WORKSHEET_FEED, | 60 WORKSHEET_FEED, |
61 THUMBNAIL, | 61 THUMBNAIL, |
62 EMBED, | 62 EMBED, |
63 PRODUCT, | 63 PRODUCT, |
64 ICON, | 64 ICON, |
65 OPEN_WITH, | |
66 }; | 65 }; |
67 Link(); | 66 Link(); |
68 | 67 |
69 // Registers the mapping between JSON field names and the members in | 68 // Registers the mapping between JSON field names and the members in |
70 // this class. | 69 // this class. |
71 static void RegisterJSONConverter(base::JSONValueConverter<Link>* converter); | 70 static void RegisterJSONConverter(base::JSONValueConverter<Link>* converter); |
72 | 71 |
73 // Creates document entry from parsed XML. | 72 // Creates document entry from parsed XML. |
74 static Link* CreateFromXml(XmlReader* xml_reader); | 73 static Link* CreateFromXml(XmlReader* xml_reader); |
75 | 74 |
76 // Type of the link. | 75 // Type of the link. |
77 LinkType type() const { return type_; } | 76 LinkType type() const { return type_; } |
78 | 77 |
79 // URL of the link. | 78 // URL of the link. |
80 const GURL& href() const { return href_; } | 79 const GURL& href() const { return href_; } |
81 | 80 |
82 // Title of the link. | 81 // Title of the link. |
83 const string16& title() const { return title_; } | 82 const string16& title() const { return title_; } |
84 | 83 |
85 // For OPEN_WITH links, this contains the application ID. For all other link | |
86 // types, it is the empty string. | |
87 const std::string& app_id() const { return app_id_; } | |
88 | |
89 // Link MIME type. | 84 // Link MIME type. |
90 const std::string& mime_type() const { return mime_type_; } | 85 const std::string& mime_type() const { return mime_type_; } |
91 | 86 |
92 private: | 87 private: |
93 friend class DocumentEntry; | 88 friend class DocumentEntry; |
94 // Converts value of link.rel into LinkType. Outputs to |type| and returns | 89 // Converts value of link.rel into LinkType. Outputs to |result| and |
95 // true when |rel| has a valid value. Otherwise does nothing and returns | 90 // returns true when |rel| has a valid value. Otherwise does nothing |
96 // false. | 91 // and returns false. |
97 static bool GetLinkType(const base::StringPiece& rel, LinkType* type); | 92 static bool GetLinkType(const base::StringPiece& rel, LinkType* result); |
98 | |
99 // Converts value of link.rel to application ID, if there is one embedded in | |
100 // the link.rel field. Outputs to |app_id| and returns true when |rel| has a | |
101 // valid value. Otherwise does nothing and returns false. | |
102 static bool GetAppID(const base::StringPiece& rel, std::string* app_id); | |
103 | |
104 | 93 |
105 LinkType type_; | 94 LinkType type_; |
106 GURL href_; | 95 GURL href_; |
107 string16 title_; | 96 string16 title_; |
108 std::string app_id_; | |
109 std::string mime_type_; | 97 std::string mime_type_; |
110 | 98 |
111 DISALLOW_COPY_AND_ASSIGN(Link); | 99 DISALLOW_COPY_AND_ASSIGN(Link); |
112 }; | 100 }; |
113 | 101 |
114 // Feed links define links (URLs) to special list of entries (i.e. list of | 102 // Feed links define links (URLs) to special list of entries (i.e. list of |
115 // previous document revisions). | 103 // previous document revisions). |
116 class FeedLink { | 104 class FeedLink { |
117 public: | 105 public: |
118 enum FeedLinkType { | 106 enum FeedLinkType { |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 int largest_changestamp_; | 613 int largest_changestamp_; |
626 ScopedVector<InstalledApp> installed_apps_; | 614 ScopedVector<InstalledApp> installed_apps_; |
627 | 615 |
628 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); | 616 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); |
629 }; | 617 }; |
630 | 618 |
631 | 619 |
632 } // namespace gdata | 620 } // namespace gdata |
633 | 621 |
634 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ | 622 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ |
OLD | NEW |