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

Side by Side Diff: content/common_child/npobject_stub.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | « content/common_child/npobject_proxy.cc ('k') | content/common_child/webblobregistry_impl.cc » ('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) 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 "content/common_child/npobject_stub.h" 5 #include "content/common_child/npobject_stub.h"
6 6
7 #include "content/common_child/np_channel_base.h" 7 #include "content/common_child/np_channel_base.h"
8 #include "content/common_child/npobject_util.h" 8 #include "content/common_child/npobject_util.h"
9 #include "content/common_child/plugin_messages.h" 9 #include "content/common_child/plugin_messages.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bool return_value = false; 141 bool return_value = false;
142 NPVariant_Param result_param; 142 NPVariant_Param result_param;
143 NPVariant result_var; 143 NPVariant result_var;
144 144
145 VOID_TO_NPVARIANT(result_var); 145 VOID_TO_NPVARIANT(result_var);
146 result_param.type = NPVARIANT_PARAM_VOID; 146 result_param.type = NPVARIANT_PARAM_VOID;
147 147
148 int arg_count = static_cast<int>(args.size()); 148 int arg_count = static_cast<int>(args.size());
149 NPVariant* args_var = new NPVariant[arg_count]; 149 NPVariant* args_var = new NPVariant[arg_count];
150 for (int i = 0; i < arg_count; ++i) { 150 for (int i = 0; i < arg_count; ++i) {
151 if (!CreateNPVariant( 151 if (!CreateNPVariant(args[i],
152 args[i], channel_, &(args_var[i]), render_view_id_, page_url_)) { 152 channel_.get(),
153 NPObjectMsg_Invoke::WriteReplyParams(reply_msg, result_param, 153 &(args_var[i]),
154 return_value); 154 render_view_id_,
155 page_url_)) {
156 NPObjectMsg_Invoke::WriteReplyParams(
157 reply_msg, result_param, return_value);
155 channel_->Send(reply_msg); 158 channel_->Send(reply_msg);
156 delete[] args_var; 159 delete[] args_var;
157 return; 160 return;
158 } 161 }
159 } 162 }
160 163
161 if (is_default) { 164 if (is_default) {
162 if (IsPluginProcess()) { 165 if (IsPluginProcess()) {
163 if (npobject_->_class->invokeDefault) { 166 if (npobject_->_class->invokeDefault) {
164 return_value = npobject_->_class->invokeDefault( 167 return_value = npobject_->_class->invokeDefault(
(...skipping 18 matching lines...) Expand all
183 return_value = WebBindings::invoke( 186 return_value = WebBindings::invoke(
184 0, npobject_, id, args_var, arg_count, &result_var); 187 0, npobject_, id, args_var, arg_count, &result_var);
185 } 188 }
186 } 189 }
187 190
188 for (int i = 0; i < arg_count; ++i) 191 for (int i = 0; i < arg_count; ++i)
189 WebBindings::releaseVariantValue(&(args_var[i])); 192 WebBindings::releaseVariantValue(&(args_var[i]));
190 193
191 delete[] args_var; 194 delete[] args_var;
192 195
193 CreateNPVariantParam( 196 CreateNPVariantParam(result_var,
194 result_var, channel_, &result_param, true, render_view_id_, page_url_); 197 channel_.get(),
198 &result_param,
199 true,
200 render_view_id_,
201 page_url_);
195 NPObjectMsg_Invoke::WriteReplyParams(reply_msg, result_param, return_value); 202 NPObjectMsg_Invoke::WriteReplyParams(reply_msg, result_param, return_value);
196 channel_->Send(reply_msg); 203 channel_->Send(reply_msg);
197 } 204 }
198 205
199 void NPObjectStub::OnHasProperty(const NPIdentifier_Param& name, 206 void NPObjectStub::OnHasProperty(const NPIdentifier_Param& name,
200 bool* result) { 207 bool* result) {
201 NPIdentifier id = CreateNPIdentifier(name); 208 NPIdentifier id = CreateNPIdentifier(name);
202 if (IsPluginProcess()) { 209 if (IsPluginProcess()) {
203 if (npobject_->_class->hasProperty) { 210 if (npobject_->_class->hasProperty) {
204 *result = npobject_->_class->hasProperty(npobject_, id); 211 *result = npobject_->_class->hasProperty(npobject_, id);
(...skipping 16 matching lines...) Expand all
221 if (npobject_->_class->getProperty) { 228 if (npobject_->_class->getProperty) {
222 *result = npobject_->_class->getProperty(npobject_, id, &result_var); 229 *result = npobject_->_class->getProperty(npobject_, id, &result_var);
223 } else { 230 } else {
224 *result = false; 231 *result = false;
225 } 232 }
226 } else { 233 } else {
227 *result = WebBindings::getProperty(0, npobject_, id, &result_var); 234 *result = WebBindings::getProperty(0, npobject_, id, &result_var);
228 } 235 }
229 236
230 CreateNPVariantParam( 237 CreateNPVariantParam(
231 result_var, channel_, property, true, render_view_id_, page_url_); 238 result_var, channel_.get(), property, true, render_view_id_, page_url_);
232 } 239 }
233 240
234 void NPObjectStub::OnSetProperty(const NPIdentifier_Param& name, 241 void NPObjectStub::OnSetProperty(const NPIdentifier_Param& name,
235 const NPVariant_Param& property, 242 const NPVariant_Param& property,
236 IPC::Message* reply_msg) { 243 IPC::Message* reply_msg) {
237 bool result = false; 244 bool result = false;
238 NPIdentifier id = CreateNPIdentifier(name); 245 NPIdentifier id = CreateNPIdentifier(name);
239 NPVariant property_var; 246 NPVariant property_var;
240 if (!CreateNPVariant( 247 if (!CreateNPVariant(property,
241 property, channel_, &property_var, render_view_id_, page_url_)) { 248 channel_.get(),
249 &property_var,
250 render_view_id_,
251 page_url_)) {
242 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, result); 252 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, result);
243 channel_->Send(reply_msg); 253 channel_->Send(reply_msg);
244 return; 254 return;
245 } 255 }
246 256
247 if (IsPluginProcess()) { 257 if (IsPluginProcess()) {
248 if (npobject_->_class->setProperty) { 258 if (npobject_->_class->setProperty) {
249 #if defined(OS_WIN) 259 #if defined(OS_WIN)
250 static base::FilePath plugin_path = 260 static base::FilePath plugin_path =
251 CommandLine::ForCurrentProcess()->GetSwitchValuePath( 261 CommandLine::ForCurrentProcess()->GetSwitchValuePath(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 IPC::Message* reply_msg) { 346 IPC::Message* reply_msg) {
337 bool return_value = false; 347 bool return_value = false;
338 NPVariant_Param result_param; 348 NPVariant_Param result_param;
339 NPVariant result_var; 349 NPVariant result_var;
340 350
341 VOID_TO_NPVARIANT(result_var); 351 VOID_TO_NPVARIANT(result_var);
342 352
343 int arg_count = static_cast<int>(args.size()); 353 int arg_count = static_cast<int>(args.size());
344 NPVariant* args_var = new NPVariant[arg_count]; 354 NPVariant* args_var = new NPVariant[arg_count];
345 for (int i = 0; i < arg_count; ++i) { 355 for (int i = 0; i < arg_count; ++i) {
346 if (!CreateNPVariant( 356 if (!CreateNPVariant(args[i],
347 args[i], channel_, &(args_var[i]), render_view_id_, page_url_)) { 357 channel_.get(),
348 NPObjectMsg_Invoke::WriteReplyParams(reply_msg, result_param, 358 &(args_var[i]),
349 return_value); 359 render_view_id_,
360 page_url_)) {
361 NPObjectMsg_Invoke::WriteReplyParams(
362 reply_msg, result_param, return_value);
350 channel_->Send(reply_msg); 363 channel_->Send(reply_msg);
351 delete[] args_var; 364 delete[] args_var;
352 return; 365 return;
353 } 366 }
354 } 367 }
355 368
356 if (IsPluginProcess()) { 369 if (IsPluginProcess()) {
357 if (npobject_->_class->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR && 370 if (npobject_->_class->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR &&
358 npobject_->_class->construct) { 371 npobject_->_class->construct) {
359 return_value = npobject_->_class->construct( 372 return_value = npobject_->_class->construct(
360 npobject_, args_var, arg_count, &result_var); 373 npobject_, args_var, arg_count, &result_var);
361 } else { 374 } else {
362 return_value = false; 375 return_value = false;
363 } 376 }
364 } else { 377 } else {
365 return_value = WebBindings::construct( 378 return_value = WebBindings::construct(
366 0, npobject_, args_var, arg_count, &result_var); 379 0, npobject_, args_var, arg_count, &result_var);
367 } 380 }
368 381
369 for (int i = 0; i < arg_count; ++i) 382 for (int i = 0; i < arg_count; ++i)
370 WebBindings::releaseVariantValue(&(args_var[i])); 383 WebBindings::releaseVariantValue(&(args_var[i]));
371 384
372 delete[] args_var; 385 delete[] args_var;
373 386
374 CreateNPVariantParam( 387 CreateNPVariantParam(result_var,
375 result_var, channel_, &result_param, true, render_view_id_, page_url_); 388 channel_.get(),
389 &result_param,
390 true,
391 render_view_id_,
392 page_url_);
376 NPObjectMsg_Invoke::WriteReplyParams(reply_msg, result_param, return_value); 393 NPObjectMsg_Invoke::WriteReplyParams(reply_msg, result_param, return_value);
377 channel_->Send(reply_msg); 394 channel_->Send(reply_msg);
378 } 395 }
379 396
380 void NPObjectStub::OnEvaluate(const std::string& script, 397 void NPObjectStub::OnEvaluate(const std::string& script,
381 bool popups_allowed, 398 bool popups_allowed,
382 IPC::Message* reply_msg) { 399 IPC::Message* reply_msg) {
383 if (IsPluginProcess()) { 400 if (IsPluginProcess()) {
384 NOTREACHED() << "Should only be called on NPObjects in the renderer"; 401 NOTREACHED() << "Should only be called on NPObjects in the renderer";
385 return; 402 return;
386 } 403 }
387 404
388 NPVariant result_var; 405 NPVariant result_var;
389 NPString script_string; 406 NPString script_string;
390 script_string.UTF8Characters = script.c_str(); 407 script_string.UTF8Characters = script.c_str();
391 script_string.UTF8Length = static_cast<unsigned int>(script.length()); 408 script_string.UTF8Length = static_cast<unsigned int>(script.length());
392 409
393 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, 410 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_,
394 &script_string, &result_var); 411 &script_string, &result_var);
395 412
396 NPVariant_Param result_param; 413 NPVariant_Param result_param;
397 CreateNPVariantParam( 414 CreateNPVariantParam(result_var,
398 result_var, channel_, &result_param, true, render_view_id_, page_url_); 415 channel_.get(),
416 &result_param,
417 true,
418 render_view_id_,
419 page_url_);
399 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); 420 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value);
400 channel_->Send(reply_msg); 421 channel_->Send(reply_msg);
401 } 422 }
402 423
403 } // namespace content 424 } // namespace content
OLDNEW
« no previous file with comments | « content/common_child/npobject_proxy.cc ('k') | content/common_child/webblobregistry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698