| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ | 5 #ifndef CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ | 6 #define CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| 7 | 7 |
| 8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // by gfx::Size(0, 0). | 117 // by gfx::Size(0, 0). |
| 118 std::vector<gfx::Size> ParseIconSizes(const base::DictionaryValue& icon); | 118 std::vector<gfx::Size> ParseIconSizes(const base::DictionaryValue& icon); |
| 119 | 119 |
| 120 // Parses the 'icons' field of a Manifest, as defined in: | 120 // Parses the 'icons' field of a Manifest, as defined in: |
| 121 // http://w3c.github.io/manifest/#dfn-steps-for-processing-the-icons-member | 121 // http://w3c.github.io/manifest/#dfn-steps-for-processing-the-icons-member |
| 122 // Returns a vector of Manifest::Icon with the successfully parsed icons, if | 122 // Returns a vector of Manifest::Icon with the successfully parsed icons, if |
| 123 // any. An empty vector if the field was not present or empty. | 123 // any. An empty vector if the field was not present or empty. |
| 124 std::vector<Manifest::Icon> ParseIcons( | 124 std::vector<Manifest::Icon> ParseIcons( |
| 125 const base::DictionaryValue& dictionary); | 125 const base::DictionaryValue& dictionary); |
| 126 | 126 |
| 127 // Parses the 'platform' field of a related application, as defined in: |
| 128 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-platform-membe
r-of-an-application |
| 129 // Returns the parsed string if any, a null string if the parsing failed. |
| 130 base::NullableString16 ParseRelatedApplicationPlatform( |
| 131 const base::DictionaryValue& application); |
| 132 |
| 133 // Parses the 'url' field of a related application, as defined in: |
| 134 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-url-member-of-
an-application |
| 135 // Returns the paresed GURL if any, an empty GURL if the parsing failed. |
| 136 GURL ParseRelatedApplicationURL(const base::DictionaryValue& application); |
| 137 |
| 138 // Parses the 'id' field of a related application, as defined in: |
| 139 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-id-member-of-a
n-application |
| 140 // Returns the parsed string if any, a null string if the parsing failed. |
| 141 base::NullableString16 ParseRelatedApplicationId( |
| 142 const base::DictionaryValue& application); |
| 143 |
| 144 // Parses the 'related_applications' field of the manifest, as defined in: |
| 145 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-related_applic
ations-member |
| 146 // Returns a vector of Manifest::RelatedApplication with the successfully |
| 147 // parsed applications, if any. An empty vector if the field was not present |
| 148 // or empty. |
| 149 std::vector<Manifest::RelatedApplication> ParseRelatedApplications( |
| 150 const base::DictionaryValue& dictionary); |
| 151 |
| 152 // Parses the 'prefer_related_applications' field on the manifest, as defined |
| 153 // in: |
| 154 // https://w3c.github.io/manifest/#dfn-steps-for-processing-the-prefer_related
_applications-member |
| 155 // returns true iff the field could be parsed as the boolean true. |
| 156 bool ParsePreferRelatedApplications(const base::DictionaryValue& dictionary); |
| 157 |
| 127 // Parses the 'gcm_sender_id' field of the manifest. | 158 // Parses the 'gcm_sender_id' field of the manifest. |
| 128 // This is a proprietary extension of the Web Manifest specification. | 159 // This is a proprietary extension of the Web Manifest specification. |
| 129 // Returns the parsed string if any, a null string if the parsing failed. | 160 // Returns the parsed string if any, a null string if the parsing failed. |
| 130 base::NullableString16 ParseGCMSenderID( | 161 base::NullableString16 ParseGCMSenderID( |
| 131 const base::DictionaryValue& dictionary); | 162 const base::DictionaryValue& dictionary); |
| 132 | 163 |
| 133 // Parses the 'gcm_user_visible_only' field of the manifest. | 164 // Parses the 'gcm_user_visible_only' field of the manifest. |
| 134 // This is a proprietary extension of the Web Manifest specification. | 165 // This is a proprietary extension of the Web Manifest specification. |
| 135 // Returns true iff the string could be parsed as the boolean true. | 166 // Returns true iff the string could be parsed as the boolean true. |
| 136 bool ParseGCMUserVisibleOnly(const base::DictionaryValue& dictionary); | 167 bool ParseGCMUserVisibleOnly(const base::DictionaryValue& dictionary); |
| 137 | 168 |
| 138 const base::StringPiece& data_; | 169 const base::StringPiece& data_; |
| 139 GURL manifest_url_; | 170 GURL manifest_url_; |
| 140 GURL document_url_; | 171 GURL document_url_; |
| 141 | 172 |
| 142 bool failed_; | 173 bool failed_; |
| 143 Manifest manifest_; | 174 Manifest manifest_; |
| 144 std::vector<std::string> errors_; | 175 std::vector<std::string> errors_; |
| 145 | 176 |
| 146 DISALLOW_COPY_AND_ASSIGN(ManifestParser); | 177 DISALLOW_COPY_AND_ASSIGN(ManifestParser); |
| 147 }; | 178 }; |
| 148 | 179 |
| 149 } // namespace content | 180 } // namespace content |
| 150 | 181 |
| 151 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ | 182 #endif // CONTENT_RENDERER_MANIFEST_MANIFEST_PARSER_H_ |
| OLD | NEW |