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 "components/nacl/renderer/json_manifest.h" | 5 #include "components/nacl/renderer/json_manifest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 urlSpecPlusOptional, urlSpecPlusOptionalLength, | 193 urlSpecPlusOptional, urlSpecPlusOptionalLength, |
194 kManifestUrlSpecRequired, | 194 kManifestUrlSpecRequired, |
195 arraysize(kManifestUrlSpecRequired), error_string)) { | 195 arraysize(kManifestUrlSpecRequired), error_string)) { |
196 return false; | 196 return false; |
197 } | 197 } |
198 // Verify the correct types of the fields if they exist. | 198 // Verify the correct types of the fields if they exist. |
199 const base::Value* url = nullptr; | 199 const base::Value* url = nullptr; |
200 // URL was already verified above by IsValidDictionary to be required. | 200 // URL was already verified above by IsValidDictionary to be required. |
201 url_dict->GetWithoutPathExpansion(kUrlKey, &url); | 201 url_dict->GetWithoutPathExpansion(kUrlKey, &url); |
202 DCHECK(url); | 202 DCHECK(url); |
203 if (!url->IsType(base::Value::TYPE_STRING)) { | 203 if (!url->IsType(base::Value::Type::STRING)) { |
204 std::stringstream error_stream; | 204 std::stringstream error_stream; |
205 error_stream << parent_key << " property '" << container_key | 205 error_stream << parent_key << " property '" << container_key |
206 << "' has non-string value '" << *url << "' for key '" | 206 << "' has non-string value '" << *url << "' for key '" |
207 << kUrlKey << "'."; | 207 << kUrlKey << "'."; |
208 *error_string = error_stream.str(); | 208 *error_string = error_stream.str(); |
209 return false; | 209 return false; |
210 } | 210 } |
211 if (url_dict->HasKey(kOptLevelKey)) { | 211 if (url_dict->HasKey(kOptLevelKey)) { |
212 const base::Value* opt_level = nullptr; | 212 const base::Value* opt_level = nullptr; |
213 url_dict->GetWithoutPathExpansion(kOptLevelKey, &opt_level); | 213 url_dict->GetWithoutPathExpansion(kOptLevelKey, &opt_level); |
214 DCHECK(opt_level); | 214 DCHECK(opt_level); |
215 if (!opt_level->IsType(base::Value::TYPE_INTEGER)) { | 215 if (!opt_level->IsType(base::Value::Type::INTEGER)) { |
216 std::stringstream error_stream; | 216 std::stringstream error_stream; |
217 error_stream << parent_key << " property '" << container_key | 217 error_stream << parent_key << " property '" << container_key |
218 << "' has non-numeric value '" << *opt_level << "' for key '" | 218 << "' has non-numeric value '" << *opt_level << "' for key '" |
219 << kOptLevelKey << "'."; | 219 << kOptLevelKey << "'."; |
220 *error_string = error_stream.str(); | 220 *error_string = error_stream.str(); |
221 return false; | 221 return false; |
222 } | 222 } |
223 } | 223 } |
224 return true; | 224 return true; |
225 } | 225 } |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 kUrlKey + "'s value is not a string."; | 702 kUrlKey + "'s value is not a string."; |
703 return false; | 703 return false; |
704 } | 704 } |
705 pnacl_options->translate = PP_FALSE; | 705 pnacl_options->translate = PP_FALSE; |
706 } | 706 } |
707 | 707 |
708 return true; | 708 return true; |
709 } | 709 } |
710 | 710 |
711 } // namespace nacl | 711 } // namespace nacl |
OLD | NEW |