Index: content/renderer/manifest/manifest_parser.h |
diff --git a/content/renderer/manifest/manifest_parser.h b/content/renderer/manifest/manifest_parser.h |
index 13e330b0ddbb18ca0cc78dcc98199d027f290015..a4b72e47fa0036aa4e14325d9913ffac8aa421c6 100644 |
--- a/content/renderer/manifest/manifest_parser.h |
+++ b/content/renderer/manifest/manifest_parser.h |
@@ -14,6 +14,7 @@ class GURL; |
namespace base { |
class DictionaryValue; |
+class Value; |
} |
namespace content { |
@@ -43,56 +44,63 @@ class CONTENT_EXPORT ManifestParser { |
NoTrim |
}; |
+ // Internal parse method that checks whether the |key| is known and call the |
+ // appropriate algorithm depending on it. |
+ // Returns whether the |key| is known to the parser. |
+ bool Parse(const std::string& key, const base::Value& value); |
+ |
// Helper function to parse booleans present on a given |dictionary| in a |
// given field identified by its |key|. |
// Returns the parsed boolean if any, or |default_value| if parsing failed. |
- bool ParseBoolean(const base::DictionaryValue& dictionary, |
- const std::string& key, |
+ bool ParseBoolean(const std::string& key, |
+ const base::Value& value, |
bool default_value); |
// Helper function to parse strings present on a given |dictionary| in a given |
// field identified by its |key|. |
// Returns the parsed string if any, a null string if the parsing failed. |
- base::NullableString16 ParseString(const base::DictionaryValue& dictionary, |
- const std::string& key, |
+ base::NullableString16 ParseString(const std::string& key, |
+ const base::Value& value, |
TrimType trim); |
// Helper function to parse URLs present on a given |dictionary| in a given |
// field identified by its |key|. The URL is first parsed as a string then |
// resolved using |base_url|. |
// Returns a GURL. If the parsing failed, the GURL will not be valid. |
- GURL ParseURL(const base::DictionaryValue& dictionary, |
- const std::string& key, |
+ GURL ParseURL(const std::string& key, |
+ const base::Value& value, |
const GURL& base_url); |
// Parses the 'name' field of the manifest, as defined in: |
// http://w3c.github.io/manifest/#dfn-steps-for-processing-the-name-member |
// Returns the parsed string if any, a null string if the parsing failed. |
- base::NullableString16 ParseName(const base::DictionaryValue& dictionary); |
+ base::NullableString16 ParseName(const std::string& key, |
+ const base::Value& value); |
// Parses the 'short_name' field of the manifest, as defined in: |
// http://w3c.github.io/manifest/#dfn-steps-for-processing-the-short-name-member |
// Returns the parsed string if any, a null string if the parsing failed. |
- base::NullableString16 ParseShortName( |
- const base::DictionaryValue& dictionary); |
+ base::NullableString16 ParseShortName(const std::string& key, |
+ const base::Value& value); |
// Parses the 'start_url' field of the manifest, as defined in: |
// http://w3c.github.io/manifest/#dfn-steps-for-processing-the-start_url-member |
// Returns the parsed GURL if any, an empty GURL if the parsing failed. |
- GURL ParseStartURL(const base::DictionaryValue& dictionary); |
+ GURL ParseStartURL(const std::string& key, const base::Value& value); |
// Parses the 'display' field of the manifest, as defined in: |
// http://w3c.github.io/manifest/#dfn-steps-for-processing-the-display-member |
// Returns the parsed DisplayMode if any, DISPLAY_MODE_UNSPECIFIED if the |
// parsing failed. |
- Manifest::DisplayMode ParseDisplay(const base::DictionaryValue& dictionary); |
+ Manifest::DisplayMode ParseDisplay(const std::string& key, |
+ const base::Value& value); |
// Parses the 'orientation' field of the manifest, as defined in: |
// http://w3c.github.io/manifest/#dfn-steps-for-processing-the-orientation-member |
// Returns the parsed WebScreenOrientationLockType if any, |
// WebScreenOrientationLockDefault if the parsing failed. |
blink::WebScreenOrientationLockType ParseOrientation( |
- const base::DictionaryValue& dictionary); |
+ const std::string& key, const base::Value& value); |
// Parses the 'src' field of an icon, as defined in: |
// http://w3c.github.io/manifest/#dfn-steps-for-processing-the-src-member-of-an-icon |
@@ -121,19 +129,8 @@ class CONTENT_EXPORT ManifestParser { |
// http://w3c.github.io/manifest/#dfn-steps-for-processing-the-icons-member |
// Returns a vector of Manifest::Icon with the successfully parsed icons, if |
// any. An empty vector if the field was not present or empty. |
- std::vector<Manifest::Icon> ParseIcons( |
- const base::DictionaryValue& dictionary); |
- |
- // Parses the 'gcm_sender_id' field of the manifest. |
- // This is a proprietary extension of the Web Manifest specification. |
- // Returns the parsed string if any, a null string if the parsing failed. |
- base::NullableString16 ParseGCMSenderID( |
- const base::DictionaryValue& dictionary); |
- |
- // Parses the 'gcm_user_visible_only' field of the manifest. |
- // This is a proprietary extension of the Web Manifest specification. |
- // Returns true iff the string could be parsed as the boolean true. |
- bool ParseGCMUserVisibleOnly(const base::DictionaryValue& dictionary); |
+ std::vector<Manifest::Icon> ParseIcons(const std::string& key, |
+ const base::Value& value); |
const base::StringPiece& data_; |
GURL manifest_url_; |
@@ -143,6 +140,7 @@ class CONTENT_EXPORT ManifestParser { |
Manifest manifest_; |
std::vector<std::string> errors_; |
+ private: |
Avi (use Gerrit)
2015/02/23 17:30:25
Why this? We're already in a private section from
|
DISALLOW_COPY_AND_ASSIGN(ManifestParser); |
}; |