| 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 #include "content/renderer/manifest/manifest_parser.h" | 5 #include "content/renderer/manifest/manifest_parser.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 manifest_.name = ParseName(*dictionary); | 123 manifest_.name = ParseName(*dictionary); |
| 124 manifest_.short_name = ParseShortName(*dictionary); | 124 manifest_.short_name = ParseShortName(*dictionary); |
| 125 manifest_.start_url = ParseStartURL(*dictionary); | 125 manifest_.start_url = ParseStartURL(*dictionary); |
| 126 manifest_.display = ParseDisplay(*dictionary); | 126 manifest_.display = ParseDisplay(*dictionary); |
| 127 manifest_.orientation = ParseOrientation(*dictionary); | 127 manifest_.orientation = ParseOrientation(*dictionary); |
| 128 manifest_.icons = ParseIcons(*dictionary); | 128 manifest_.icons = ParseIcons(*dictionary); |
| 129 manifest_.related_applications = ParseRelatedApplications(*dictionary); | 129 manifest_.related_applications = ParseRelatedApplications(*dictionary); |
| 130 manifest_.prefer_related_applications = | 130 manifest_.prefer_related_applications = |
| 131 ParsePreferRelatedApplications(*dictionary); | 131 ParsePreferRelatedApplications(*dictionary); |
| 132 manifest_.gcm_sender_id = ParseGCMSenderID(*dictionary); | 132 manifest_.gcm_sender_id = ParseGCMSenderID(*dictionary); |
| 133 manifest_.gcm_user_visible_only = ParseGCMUserVisibleOnly(*dictionary); | |
| 134 | 133 |
| 135 ManifestUmaUtil::ParseSucceeded(manifest_); | 134 ManifestUmaUtil::ParseSucceeded(manifest_); |
| 136 } | 135 } |
| 137 | 136 |
| 138 const Manifest& ManifestParser::manifest() const { | 137 const Manifest& ManifestParser::manifest() const { |
| 139 return manifest_; | 138 return manifest_; |
| 140 } | 139 } |
| 141 | 140 |
| 142 const std::vector<std::string>& ManifestParser::errors() const { | 141 const std::vector<std::string>& ManifestParser::errors() const { |
| 143 return errors_; | 142 return errors_; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 bool ManifestParser::ParsePreferRelatedApplications( | 401 bool ManifestParser::ParsePreferRelatedApplications( |
| 403 const base::DictionaryValue& dictionary) { | 402 const base::DictionaryValue& dictionary) { |
| 404 return ParseBoolean(dictionary, "prefer_related_applications", false); | 403 return ParseBoolean(dictionary, "prefer_related_applications", false); |
| 405 } | 404 } |
| 406 | 405 |
| 407 base::NullableString16 ManifestParser::ParseGCMSenderID( | 406 base::NullableString16 ManifestParser::ParseGCMSenderID( |
| 408 const base::DictionaryValue& dictionary) { | 407 const base::DictionaryValue& dictionary) { |
| 409 return ParseString(dictionary, "gcm_sender_id", Trim); | 408 return ParseString(dictionary, "gcm_sender_id", Trim); |
| 410 } | 409 } |
| 411 | 410 |
| 412 bool ManifestParser::ParseGCMUserVisibleOnly( | |
| 413 const base::DictionaryValue& dictionary) { | |
| 414 return ParseBoolean(dictionary, "gcm_user_visible_only", false); | |
| 415 } | |
| 416 | |
| 417 } // namespace content | 411 } // namespace content |
| OLD | NEW |