OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/web_apps.h" | 5 #include "chrome/common/web_apps.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 WebApplicationInfo* web_app, | 210 WebApplicationInfo* web_app, |
211 string16* error) { | 211 string16* error) { |
212 DCHECK(web_app->manifest_url.is_valid()); | 212 DCHECK(web_app->manifest_url.is_valid()); |
213 | 213 |
214 int error_code = 0; | 214 int error_code = 0; |
215 std::string error_message; | 215 std::string error_message; |
216 scoped_ptr<Value> schema( | 216 scoped_ptr<Value> schema( |
217 base::JSONReader::ReadAndReturnError( | 217 base::JSONReader::ReadAndReturnError( |
218 ResourceBundle::GetSharedInstance().GetRawDataResource( | 218 ResourceBundle::GetSharedInstance().GetRawDataResource( |
219 IDR_WEB_APP_SCHEMA).as_string(), | 219 IDR_WEB_APP_SCHEMA).as_string(), |
220 false, // disallow trailing comma | 220 base::JSON_PARSE_RFC, // options |
221 &error_code, | 221 &error_code, |
222 &error_message)); | 222 &error_message)); |
223 DCHECK(schema.get()) | 223 DCHECK(schema.get()) |
224 << "Error parsing JSON schema: " << error_code << ": " << error_message; | 224 << "Error parsing JSON schema: " << error_code << ": " << error_message; |
225 DCHECK(schema->IsType(Value::TYPE_DICTIONARY)) | 225 DCHECK(schema->IsType(Value::TYPE_DICTIONARY)) |
226 << "schema root must be dictionary."; | 226 << "schema root must be dictionary."; |
227 | 227 |
228 JSONSchemaValidator validator(static_cast<DictionaryValue*>(schema.get())); | 228 JSONSchemaValidator validator(static_cast<DictionaryValue*>(schema.get())); |
229 | 229 |
230 // We allow extra properties in the schema for easy compat with other systems, | 230 // We allow extra properties in the schema for easy compat with other systems, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 web_app->app_url = app_url; | 320 web_app->app_url = app_url; |
321 web_app->urls = urls; | 321 web_app->urls = urls; |
322 web_app->permissions = permissions; | 322 web_app->permissions = permissions; |
323 web_app->icons = icons; | 323 web_app->icons = icons; |
324 | 324 |
325 return true; | 325 return true; |
326 | 326 |
327 } | 327 } |
328 | 328 |
329 } // namespace web_apps | 329 } // namespace web_apps |
OLD | NEW |