OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
6 | 6 |
7 #include <numeric> | 7 #include <numeric> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 return PP_FALSE; | 1183 return PP_FALSE; |
1184 } | 1184 } |
1185 | 1185 |
1186 // Null-terminate the bytes we we read from the file. | 1186 // Null-terminate the bytes we we read from the file. |
1187 buffer.get()[rc] = 0; | 1187 buffer.get()[rc] = 0; |
1188 | 1188 |
1189 // Expect the JSON file to contain a top-level object (dictionary). | 1189 // Expect the JSON file to contain a top-level object (dictionary). |
1190 base::JSONReader json_reader; | 1190 base::JSONReader json_reader; |
1191 int json_read_error_code; | 1191 int json_read_error_code; |
1192 std::string json_read_error_msg; | 1192 std::string json_read_error_msg; |
1193 base::Value* json_data = json_reader.ReadAndReturnError( | 1193 scoped_ptr<base::Value> json_data(json_reader.ReadAndReturnError( |
1194 buffer.get(), | 1194 buffer.get(), |
1195 base::JSON_PARSE_RFC, | 1195 base::JSON_PARSE_RFC, |
1196 &json_read_error_code, | 1196 &json_read_error_code, |
1197 &json_read_error_msg); | 1197 &json_read_error_msg)); |
1198 if (json_data == NULL) { | 1198 if (!json_data) { |
1199 load_manager->ReportLoadError( | 1199 load_manager->ReportLoadError( |
1200 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, | 1200 PP_NACL_ERROR_PNACL_RESOURCE_FETCH, |
1201 std::string("Parsing resource info failed: JSON parse error: ") + | 1201 std::string("Parsing resource info failed: JSON parse error: ") + |
1202 json_read_error_msg); | 1202 json_read_error_msg); |
1203 return PP_FALSE; | 1203 return PP_FALSE; |
1204 } | 1204 } |
1205 | 1205 |
1206 base::DictionaryValue* json_dict; | 1206 base::DictionaryValue* json_dict; |
1207 if (!json_data->GetAsDictionary(&json_dict)) { | 1207 if (!json_data->GetAsDictionary(&json_dict)) { |
1208 load_manager->ReportLoadError( | 1208 load_manager->ReportLoadError( |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 &StreamPexe | 1716 &StreamPexe |
1717 }; | 1717 }; |
1718 | 1718 |
1719 } // namespace | 1719 } // namespace |
1720 | 1720 |
1721 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1721 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
1722 return &nacl_interface; | 1722 return &nacl_interface; |
1723 } | 1723 } |
1724 | 1724 |
1725 } // namespace nacl | 1725 } // namespace nacl |
OLD | NEW |