| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/plugin/npobject_util.h" | 5 #include "chrome/plugin/npobject_util.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
| 9 #include "chrome/common/win_util.h" | 9 #include "chrome/common/win_util.h" |
| 10 #endif | 10 #endif |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 param->identifier = id; | 132 param->identifier = id; |
| 133 } | 133 } |
| 134 | 134 |
| 135 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) { | 135 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) { |
| 136 return param.identifier; | 136 return param.identifier; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void CreateNPVariantParam(const NPVariant& variant, | 139 void CreateNPVariantParam(const NPVariant& variant, |
| 140 PluginChannelBase* channel, | 140 PluginChannelBase* channel, |
| 141 NPVariant_Param* param, | 141 NPVariant_Param* param, |
| 142 bool release) { | 142 bool release, |
| 143 base::WaitableEvent* modal_dialog_event) { |
| 143 switch (variant.type) { | 144 switch (variant.type) { |
| 144 case NPVariantType_Void: | 145 case NPVariantType_Void: |
| 145 param->type = NPVARIANT_PARAM_VOID; | 146 param->type = NPVARIANT_PARAM_VOID; |
| 146 break; | 147 break; |
| 147 case NPVariantType_Null: | 148 case NPVariantType_Null: |
| 148 param->type = NPVARIANT_PARAM_NULL; | 149 param->type = NPVARIANT_PARAM_NULL; |
| 149 break; | 150 break; |
| 150 case NPVariantType_Bool: | 151 case NPVariantType_Bool: |
| 151 param->type = NPVARIANT_PARAM_BOOL; | 152 param->type = NPVARIANT_PARAM_BOOL; |
| 152 param->bool_value = variant.value.boolValue; | 153 param->bool_value = variant.value.boolValue; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 177 } else { | 178 } else { |
| 178 // The channel could be NULL if there was a channel error. The caller's | 179 // The channel could be NULL if there was a channel error. The caller's |
| 179 // Send call will fail anyways. | 180 // Send call will fail anyways. |
| 180 if (channel) { | 181 if (channel) { |
| 181 // NPObjectStub adds its own reference to the NPObject it owns, so if | 182 // NPObjectStub adds its own reference to the NPObject it owns, so if |
| 182 // we were supposed to release the corresponding variant | 183 // we were supposed to release the corresponding variant |
| 183 // (release==true), we should still do that. | 184 // (release==true), we should still do that. |
| 184 param->type = NPVARIANT_PARAM_OBJECT_ROUTING_ID; | 185 param->type = NPVARIANT_PARAM_OBJECT_ROUTING_ID; |
| 185 int route_id = channel->GenerateRouteID(); | 186 int route_id = channel->GenerateRouteID(); |
| 186 NPObjectStub* object_stub = new NPObjectStub( | 187 NPObjectStub* object_stub = new NPObjectStub( |
| 187 variant.value.objectValue, channel, route_id); | 188 variant.value.objectValue, channel, route_id, modal_dialog_event); |
| 188 param->npobject_routing_id = route_id; | 189 param->npobject_routing_id = route_id; |
| 189 param->npobject_pointer = variant.value.objectValue; | 190 param->npobject_pointer = variant.value.objectValue; |
| 190 } else { | 191 } else { |
| 191 param->type = NPVARIANT_PARAM_VOID; | 192 param->type = NPVARIANT_PARAM_VOID; |
| 192 } | 193 } |
| 193 } | 194 } |
| 194 break; | 195 break; |
| 195 } | 196 } |
| 196 default: | 197 default: |
| 197 NOTREACHED(); | 198 NOTREACHED(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 case NPVARIANT_PARAM_OBJECT_POINTER: | 242 case NPVARIANT_PARAM_OBJECT_POINTER: |
| 242 result->type = NPVariantType_Object; | 243 result->type = NPVariantType_Object; |
| 243 result->value.objectValue = static_cast<NPObject*>(param.npobject_pointer)
; | 244 result->value.objectValue = static_cast<NPObject*>(param.npobject_pointer)
; |
| 244 NPN_RetainObject(result->value.objectValue); | 245 NPN_RetainObject(result->value.objectValue); |
| 245 break; | 246 break; |
| 246 default: | 247 default: |
| 247 NOTREACHED(); | 248 NOTREACHED(); |
| 248 } | 249 } |
| 249 } | 250 } |
| 250 #endif | 251 #endif |
| OLD | NEW |