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