Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/plugin/npobject_stub.cc

Issue 6562: This fixes http://code.google.com/p/chromium/issues/detail?id=2472, which... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/npobject_stub.h ('k') | third_party/npapi/bindings/npruntime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_stub.h" 5 #include "chrome/plugin/npobject_stub.h"
6 6
7 #include "chrome/common/plugin_messages.h" 7 #include "chrome/common/plugin_messages.h"
8 #include "chrome/plugin/npobject_util.h" 8 #include "chrome/plugin/npobject_util.h"
9 #include "chrome/plugin/plugin_channel_base.h" 9 #include "chrome/plugin/plugin_channel_base.h"
10 #include "chrome/renderer/webplugin_delegate_proxy.h" 10 #include "chrome/renderer/webplugin_delegate_proxy.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 for (unsigned int i = 0; i < count; ++i) { 253 for (unsigned int i = 0; i < count; ++i) {
254 NPIdentifier_Param param; 254 NPIdentifier_Param param;
255 CreateNPIdentifierParam(value_np[i], &param); 255 CreateNPIdentifierParam(value_np[i], &param);
256 value->push_back(param); 256 value->push_back(param);
257 } 257 }
258 258
259 NPN_MemFree(value_np); 259 NPN_MemFree(value_np);
260 } 260 }
261 261
262 void NPObjectStub::OnEvaluate(const std::string& script, 262 void NPObjectStub::OnEvaluate(const std::string& script,
263 bool popups_allowed,
263 IPC::Message* reply_msg) { 264 IPC::Message* reply_msg) {
264 if (IsPluginProcess()) { 265 if (IsPluginProcess()) {
265 NOTREACHED() << "Should only be called on NPObjects in the renderer"; 266 NOTREACHED() << "Should only be called on NPObjects in the renderer";
266 return; 267 return;
267 } 268 }
268 269
269 // Grab a reference to the underlying channel, as the NPObjectStub 270 // Grab a reference to the underlying channel, as the NPObjectStub
270 // instance can be destroyed in the context of NPN_Evaluate. This 271 // instance can be destroyed in the context of NPN_Evaluate. This
271 // can happen if the containing plugin instance is destroyed in 272 // can happen if the containing plugin instance is destroyed in
272 // NPN_Evaluate. 273 // NPN_Evaluate.
273 scoped_refptr<PluginChannelBase> local_channel = channel_; 274 scoped_refptr<PluginChannelBase> local_channel = channel_;
274 275
275 NPVariant result_var; 276 NPVariant result_var;
276 NPString script_string; 277 NPString script_string;
277 script_string.UTF8Characters = script.c_str(); 278 script_string.UTF8Characters = script.c_str();
278 script_string.UTF8Length = static_cast<unsigned int>(script.length()); 279 script_string.UTF8Length = static_cast<unsigned int>(script.length());
279 280
280 bool return_value = NPN_Evaluate(0, npobject_, &script_string, &result_var); 281 bool return_value = NPN_EvaluateHelper(0, popups_allowed, npobject_,
282 &script_string, &result_var);
281 283
282 NPVariant_Param result_param; 284 NPVariant_Param result_param;
283 CreateNPVariantParam(result_var, local_channel, &result_param, true); 285 CreateNPVariantParam(result_var, local_channel, &result_param, true);
284 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); 286 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value);
285 local_channel->Send(reply_msg); 287 local_channel->Send(reply_msg);
286 } 288 }
287 289
288 void NPObjectStub::OnSetException(const std::string& message) { 290 void NPObjectStub::OnSetException(const std::string& message) {
289 if (IsPluginProcess()) { 291 if (IsPluginProcess()) {
290 NOTREACHED() << "Should only be called on NPObjects in the renderer"; 292 NOTREACHED() << "Should only be called on NPObjects in the renderer";
291 return; 293 return;
292 } 294 }
293 295
294 NPN_SetException(npobject_, message.c_str()); 296 NPN_SetException(npobject_, message.c_str());
295 } 297 }
296 298
OLDNEW
« no previous file with comments | « chrome/plugin/npobject_stub.h ('k') | third_party/npapi/bindings/npruntime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698