Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_parser.h

Issue 10546034: Adds parsing for the app_id field from an "open-with-" link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added json test Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
67 68
68 // Registers the mapping between JSON field names and the members in 69 // Registers the mapping between JSON field names and the members in
69 // this class. 70 // this class.
70 static void RegisterJSONConverter(base::JSONValueConverter<Link>* converter); 71 static void RegisterJSONConverter(base::JSONValueConverter<Link>* converter);
71 72
72 // Creates document entry from parsed XML. 73 // Creates document entry from parsed XML.
73 static Link* CreateFromXml(XmlReader* xml_reader); 74 static Link* CreateFromXml(XmlReader* xml_reader);
74 75
75 // Type of the link. 76 // Type of the link.
76 LinkType type() const { return type_; } 77 LinkType type() const { return type_; }
77 78
78 // URL of the link. 79 // URL of the link.
79 const GURL& href() const { return href_; } 80 const GURL& href() const { return href_; }
80 81
81 // Title of the link. 82 // Title of the link.
82 const string16& title() const { return title_; } 83 const string16& title() const { return title_; }
83 84
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
84 // Link MIME type. 89 // Link MIME type.
85 const std::string& mime_type() const { return mime_type_; } 90 const std::string& mime_type() const { return mime_type_; }
86 91
87 private: 92 private:
88 friend class DocumentEntry; 93 friend class DocumentEntry;
89 // Converts value of link.rel into LinkType. Outputs to |result| and 94 // Converts value of link.rel into LinkType. Outputs to |type| and returns
90 // returns true when |rel| has a valid value. Otherwise does nothing 95 // true when |rel| has a valid value. Otherwise does nothing and returns
91 // and returns false. 96 // false.
92 static bool GetLinkType(const base::StringPiece& rel, LinkType* result); 97 static bool GetLinkType(const base::StringPiece& rel, LinkType* type);
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
93 104
94 LinkType type_; 105 LinkType type_;
95 GURL href_; 106 GURL href_;
96 string16 title_; 107 string16 title_;
108 std::string app_id_;
97 std::string mime_type_; 109 std::string mime_type_;
98 110
99 DISALLOW_COPY_AND_ASSIGN(Link); 111 DISALLOW_COPY_AND_ASSIGN(Link);
100 }; 112 };
101 113
102 // Feed links define links (URLs) to special list of entries (i.e. list of 114 // Feed links define links (URLs) to special list of entries (i.e. list of
103 // previous document revisions). 115 // previous document revisions).
104 class FeedLink { 116 class FeedLink {
105 public: 117 public:
106 enum FeedLinkType { 118 enum FeedLinkType {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 int largest_changestamp_; 625 int largest_changestamp_;
614 ScopedVector<InstalledApp> installed_apps_; 626 ScopedVector<InstalledApp> installed_apps_;
615 627
616 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed); 628 DISALLOW_COPY_AND_ASSIGN(AccountMetadataFeed);
617 }; 629 };
618 630
619 631
620 } // namespace gdata 632 } // namespace gdata
621 633
622 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_ 634 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698