| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 WebApplicationInfo* web_app, | 211 WebApplicationInfo* web_app, |
| 212 string16* error) { | 212 string16* error) { |
| 213 DCHECK(web_app->manifest_url.is_valid()); | 213 DCHECK(web_app->manifest_url.is_valid()); |
| 214 | 214 |
| 215 int error_code = 0; | 215 int error_code = 0; |
| 216 std::string error_message; | 216 std::string error_message; |
| 217 scoped_ptr<Value> schema( | 217 scoped_ptr<Value> schema( |
| 218 base::JSONReader::ReadAndReturnError( | 218 base::JSONReader::ReadAndReturnError( |
| 219 ResourceBundle::GetSharedInstance().GetRawDataResource( | 219 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 220 IDR_WEB_APP_SCHEMA, | 220 IDR_WEB_APP_SCHEMA, |
| 221 ui::SCALE_FACTOR_NONE).as_string(), | 221 ui::SCALE_FACTOR_NONE), |
| 222 base::JSON_PARSE_RFC, // options | 222 base::JSON_PARSE_RFC, // options |
| 223 &error_code, | 223 &error_code, |
| 224 &error_message)); | 224 &error_message)); |
| 225 DCHECK(schema.get()) | 225 DCHECK(schema.get()) |
| 226 << "Error parsing JSON schema: " << error_code << ": " << error_message; | 226 << "Error parsing JSON schema: " << error_code << ": " << error_message; |
| 227 DCHECK(schema->IsType(Value::TYPE_DICTIONARY)) | 227 DCHECK(schema->IsType(Value::TYPE_DICTIONARY)) |
| 228 << "schema root must be dictionary."; | 228 << "schema root must be dictionary."; |
| 229 | 229 |
| 230 JSONSchemaValidator validator(static_cast<DictionaryValue*>(schema.get())); | 230 JSONSchemaValidator validator(static_cast<DictionaryValue*>(schema.get())); |
| 231 | 231 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 web_app->app_url = app_url; | 322 web_app->app_url = app_url; |
| 323 web_app->urls = urls; | 323 web_app->urls = urls; |
| 324 web_app->permissions = permissions; | 324 web_app->permissions = permissions; |
| 325 web_app->icons = icons; | 325 web_app->icons = icons; |
| 326 | 326 |
| 327 return true; | 327 return true; |
| 328 | 328 |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace web_apps | 331 } // namespace web_apps |
| OLD | NEW |