| 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 "webkit/plugins/ppapi/message_channel.h" | 5 #include "webkit/plugins/ppapi/message_channel.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 case PP_VARTYPE_BOOL: | 62 case PP_VARTYPE_BOOL: |
| 63 BOOLEAN_TO_NPVARIANT(var.value.as_bool, *result); | 63 BOOLEAN_TO_NPVARIANT(var.value.as_bool, *result); |
| 64 break; | 64 break; |
| 65 case PP_VARTYPE_INT32: | 65 case PP_VARTYPE_INT32: |
| 66 INT32_TO_NPVARIANT(var.value.as_int, *result); | 66 INT32_TO_NPVARIANT(var.value.as_int, *result); |
| 67 break; | 67 break; |
| 68 case PP_VARTYPE_DOUBLE: | 68 case PP_VARTYPE_DOUBLE: |
| 69 DOUBLE_TO_NPVARIANT(var.value.as_double, *result); | 69 DOUBLE_TO_NPVARIANT(var.value.as_double, *result); |
| 70 break; | 70 break; |
| 71 case PP_VARTYPE_STRING: { | 71 case PP_VARTYPE_STRING: { |
| 72 scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); | 72 StringVar* string = StringVar::FromPPVar(var); |
| 73 if (!string) { | 73 if (!string) { |
| 74 VOID_TO_NPVARIANT(*result); | 74 VOID_TO_NPVARIANT(*result); |
| 75 return false; | 75 return false; |
| 76 } | 76 } |
| 77 const std::string& value = string->value(); | 77 const std::string& value = string->value(); |
| 78 STRINGN_TO_NPVARIANT(value.c_str(), value.size(), *result); | 78 STRINGN_TO_NPVARIANT(value.c_str(), value.size(), *result); |
| 79 break; | 79 break; |
| 80 } | 80 } |
| 81 case PP_VARTYPE_OBJECT: | 81 case PP_VARTYPE_OBJECT: |
| 82 // Objects are not currently supported. | 82 // Objects are not currently supported. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 95 // PP_Var with the a copy of |var|'s string contents and a reference count of 1. | 95 // PP_Var with the a copy of |var|'s string contents and a reference count of 1. |
| 96 // | 96 // |
| 97 // TODO(dmichael): We need to do structured clone eventually to copy a object | 97 // TODO(dmichael): We need to do structured clone eventually to copy a object |
| 98 // structure. The details and PPAPI changes for this are TBD. | 98 // structure. The details and PPAPI changes for this are TBD. |
| 99 PP_Var CopyPPVar(const PP_Var& var) { | 99 PP_Var CopyPPVar(const PP_Var& var) { |
| 100 if (var.type == PP_VARTYPE_OBJECT) { | 100 if (var.type == PP_VARTYPE_OBJECT) { |
| 101 // Objects are not currently supported. | 101 // Objects are not currently supported. |
| 102 NOTIMPLEMENTED(); | 102 NOTIMPLEMENTED(); |
| 103 return PP_MakeUndefined(); | 103 return PP_MakeUndefined(); |
| 104 } else if (var.type == PP_VARTYPE_STRING) { | 104 } else if (var.type == PP_VARTYPE_STRING) { |
| 105 scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); | 105 StringVar* string = StringVar::FromPPVar(var); |
| 106 if (!string) | 106 if (!string) |
| 107 return PP_MakeUndefined(); | 107 return PP_MakeUndefined(); |
| 108 return StringVar::StringToPPVar(string->pp_module(), string->value()); | 108 return StringVar::StringToPPVar(string->pp_module(), string->value()); |
| 109 } else { | 109 } else { |
| 110 return var; | 110 return var; |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 //------------------------------------------------------------------------------ | 114 //------------------------------------------------------------------------------ |
| 115 // Implementations of NPClass functions. These are here to: | 115 // Implementations of NPClass functions. These are here to: |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // SetPassthroughObject(passthrough_object()); | 423 // SetPassthroughObject(passthrough_object()); |
| 424 if (passthrough_object_) | 424 if (passthrough_object_) |
| 425 WebBindings::releaseObject(passthrough_object_); | 425 WebBindings::releaseObject(passthrough_object_); |
| 426 | 426 |
| 427 passthrough_object_ = passthrough; | 427 passthrough_object_ = passthrough; |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace ppapi | 430 } // namespace ppapi |
| 431 } // namespace webkit | 431 } // namespace webkit |
| 432 | 432 |
| OLD | NEW |