| 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 "content/child/plugin_param_traits.h" | 5 #include "content/child/plugin_param_traits.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "ipc/ipc_message_utils.h" | 8 #include "ipc/ipc_message_utils.h" |
| 9 #include "third_party/WebKit/public/web/WebBindings.h" | 9 #include "third_party/WebKit/public/web/WebBindings.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // This is a routing Id used to identify the plugin instance that owns | 55 // This is a routing Id used to identify the plugin instance that owns |
| 56 // the object, for ownership-tracking purposes. | 56 // the object, for ownership-tracking purposes. |
| 57 WriteParam(m, p.npobject_owner_id); | 57 WriteParam(m, p.npobject_owner_id); |
| 58 } else { | 58 } else { |
| 59 DCHECK(p.type == content::NPVARIANT_PARAM_VOID || | 59 DCHECK(p.type == content::NPVARIANT_PARAM_VOID || |
| 60 p.type == content::NPVARIANT_PARAM_NULL); | 60 p.type == content::NPVARIANT_PARAM_NULL); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool ParamTraits<NPVariant_Param>::Read(const Message* m, | 64 bool ParamTraits<NPVariant_Param>::Read(const Message* m, |
| 65 PickleIterator* iter, | 65 base::PickleIterator* iter, |
| 66 param_type* r) { | 66 param_type* r) { |
| 67 int type; | 67 int type; |
| 68 if (!ReadParam(m, iter, &type)) | 68 if (!ReadParam(m, iter, &type)) |
| 69 return false; | 69 return false; |
| 70 | 70 |
| 71 bool result = false; | 71 bool result = false; |
| 72 r->type = static_cast<content::NPVariant_ParamEnum>(type); | 72 r->type = static_cast<content::NPVariant_ParamEnum>(type); |
| 73 if (r->type == content::NPVARIANT_PARAM_BOOL) { | 73 if (r->type == content::NPVARIANT_PARAM_BOOL) { |
| 74 result = ReadParam(m, iter, &r->bool_value); | 74 result = ReadParam(m, iter, &r->bool_value); |
| 75 } else if (r->type == content::NPVARIANT_PARAM_INT) { | 75 } else if (r->type == content::NPVARIANT_PARAM_INT) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 l->append("<none>"); | 110 l->append("<none>"); |
| 111 } | 111 } |
| 112 l->append(")"); | 112 l->append(")"); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) { | 115 void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) { |
| 116 content::SerializeNPIdentifier(p.identifier, m); | 116 content::SerializeNPIdentifier(p.identifier, m); |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool ParamTraits<NPIdentifier_Param>::Read(const Message* m, | 119 bool ParamTraits<NPIdentifier_Param>::Read(const Message* m, |
| 120 PickleIterator* iter, | 120 base::PickleIterator* iter, |
| 121 param_type* r) { | 121 param_type* r) { |
| 122 return content::DeserializeNPIdentifier(iter, &r->identifier); | 122 return content::DeserializeNPIdentifier(iter, &r->identifier); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) { | 125 void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) { |
| 126 if (blink::WebBindings::identifierIsString(p.identifier)) { | 126 if (blink::WebBindings::identifierIsString(p.identifier)) { |
| 127 NPUTF8* str = blink::WebBindings::utf8FromIdentifier(p.identifier); | 127 NPUTF8* str = blink::WebBindings::utf8FromIdentifier(p.identifier); |
| 128 l->append(str); | 128 l->append(str); |
| 129 free(str); | 129 free(str); |
| 130 } else { | 130 } else { |
| 131 l->append(base::IntToString( | 131 l->append(base::IntToString( |
| 132 blink::WebBindings::intFromIdentifier(p.identifier))); | 132 blink::WebBindings::intFromIdentifier(p.identifier))); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace IPC | 136 } // namespace IPC |
| OLD | NEW |