| 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 "native_client/tests/ppapi_geturl/module.h" | 5 #include "native_client/tests/ppapi_geturl/module.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 return str; | 215 return str; |
| 216 } | 216 } |
| 217 | 217 |
| 218 PP_Var Module::StrToVar(const char* str) { | 218 PP_Var Module::StrToVar(const char* str) { |
| 219 Module* module = Get(); | 219 Module* module = Get(); |
| 220 if (NULL == module) | 220 if (NULL == module) |
| 221 return PP_MakeUndefined(); | 221 return PP_MakeUndefined(); |
| 222 const PPB_Var* ppb_var = module->ppb_var_interface(); | 222 const PPB_Var* ppb_var = module->ppb_var_interface(); |
| 223 if (NULL != ppb_var) | 223 if (NULL != ppb_var) |
| 224 return ppb_var->VarFromUtf8(module->module_id(), str, strlen(str)); | 224 return ppb_var->VarFromUtf8(str, strlen(str)); |
| 225 return PP_MakeUndefined(); | 225 return PP_MakeUndefined(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 PP_Var Module::StrToVar(const std::string& str) { | 228 PP_Var Module::StrToVar(const std::string& str) { |
| 229 return Module::StrToVar(str.c_str()); | 229 return Module::StrToVar(str.c_str()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 std::string Module::ErrorCodeToStr(int32_t error_code) { | 232 std::string Module::ErrorCodeToStr(int32_t error_code) { |
| 233 switch (error_code) { | 233 switch (error_code) { |
| 234 case PP_OK: return "PP_OK"; | 234 case PP_OK: return "PP_OK"; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 printf("--- ReportResult posts result string:\n\t%s\n", result.c_str()); | 270 printf("--- ReportResult posts result string:\n\t%s\n", result.c_str()); |
| 271 struct PP_Var var_result = StrToVar(result); | 271 struct PP_Var var_result = StrToVar(result); |
| 272 ppb_messaging_interface()->PostMessage(pp_instance, var_result); | 272 ppb_messaging_interface()->PostMessage(pp_instance, var_result); |
| 273 // If the message was created using VarFromUtf8() it needs to be released. | 273 // If the message was created using VarFromUtf8() it needs to be released. |
| 274 // See the comments about VarFromUtf8() in ppapi/c/ppb_var.h for more | 274 // See the comments about VarFromUtf8() in ppapi/c/ppb_var.h for more |
| 275 // information. | 275 // information. |
| 276 if (var_result.type == PP_VARTYPE_STRING) { | 276 if (var_result.type == PP_VARTYPE_STRING) { |
| 277 ppb_var_interface()->Release(var_result); | 277 ppb_var_interface()->Release(var_result); |
| 278 } | 278 } |
| 279 } | 279 } |
| OLD | NEW |