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

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

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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') | chrome/plugin/plugin_channel.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/child_process_logging.h" 7 #include "chrome/common/child_process_logging.h"
8 #include "chrome/common/plugin_messages.h" 8 #include "chrome/common/plugin_messages.h"
9 #include "chrome/plugin/npobject_util.h" 9 #include "chrome/plugin/npobject_util.h"
10 #include "chrome/plugin/plugin_channel_base.h" 10 #include "chrome/plugin/plugin_channel_base.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 NPObject* NPObjectStub::GetUnderlyingNPObject() { 57 NPObject* NPObjectStub::GetUnderlyingNPObject() {
58 return npobject_; 58 return npobject_;
59 } 59 }
60 60
61 IPC::Channel::Listener* NPObjectStub::GetChannelListener() { 61 IPC::Channel::Listener* NPObjectStub::GetChannelListener() {
62 return static_cast<IPC::Channel::Listener*>(this); 62 return static_cast<IPC::Channel::Listener*>(this);
63 } 63 }
64 64
65 void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { 65 bool NPObjectStub::OnMessageReceived(const IPC::Message& msg) {
66 child_process_logging::SetActiveURL(page_url_); 66 child_process_logging::SetActiveURL(page_url_);
67 67
68 if (!npobject_) { 68 if (!npobject_) {
69 if (msg.is_sync()) { 69 if (msg.is_sync()) {
70 // The object could be garbage because the frame has gone away, so 70 // The object could be garbage because the frame has gone away, so
71 // just send an error reply to the caller. 71 // just send an error reply to the caller.
72 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); 72 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);
73 reply->set_reply_error(); 73 reply->set_reply_error();
74 Send(reply); 74 Send(reply);
75 } 75 }
76 76
77 return; 77 return true;
78 } 78 }
79 79
80 bool handled = true;
80 IPC_BEGIN_MESSAGE_MAP(NPObjectStub, msg) 81 IPC_BEGIN_MESSAGE_MAP(NPObjectStub, msg)
81 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Release, OnRelease); 82 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Release, OnRelease);
82 IPC_MESSAGE_HANDLER(NPObjectMsg_HasMethod, OnHasMethod); 83 IPC_MESSAGE_HANDLER(NPObjectMsg_HasMethod, OnHasMethod);
83 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Invoke, OnInvoke); 84 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Invoke, OnInvoke);
84 IPC_MESSAGE_HANDLER(NPObjectMsg_HasProperty, OnHasProperty); 85 IPC_MESSAGE_HANDLER(NPObjectMsg_HasProperty, OnHasProperty);
85 IPC_MESSAGE_HANDLER(NPObjectMsg_GetProperty, OnGetProperty); 86 IPC_MESSAGE_HANDLER(NPObjectMsg_GetProperty, OnGetProperty);
86 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_SetProperty, OnSetProperty); 87 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_SetProperty, OnSetProperty);
87 IPC_MESSAGE_HANDLER(NPObjectMsg_RemoveProperty, OnRemoveProperty); 88 IPC_MESSAGE_HANDLER(NPObjectMsg_RemoveProperty, OnRemoveProperty);
88 IPC_MESSAGE_HANDLER(NPObjectMsg_Invalidate, OnInvalidate); 89 IPC_MESSAGE_HANDLER(NPObjectMsg_Invalidate, OnInvalidate);
89 IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration); 90 IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration);
90 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct); 91 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct);
91 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate); 92 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate);
92 IPC_MESSAGE_UNHANDLED_ERROR() 93 IPC_MESSAGE_UNHANDLED(handled = false)
93 IPC_END_MESSAGE_MAP() 94 IPC_END_MESSAGE_MAP()
95 DCHECK(handled);
96 return handled;
94 } 97 }
95 98
96 void NPObjectStub::OnChannelError() { 99 void NPObjectStub::OnChannelError() {
97 // If npobject_ is NULLed out, that means a DeleteSoon is happening. 100 // If npobject_ is NULLed out, that means a DeleteSoon is happening.
98 if (npobject_) 101 if (npobject_)
99 delete this; 102 delete this;
100 } 103 }
101 104
102 void NPObjectStub::OnRelease(IPC::Message* reply_msg) { 105 void NPObjectStub::OnRelease(IPC::Message* reply_msg) {
103 Send(reply_msg); 106 Send(reply_msg);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, 393 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_,
391 &script_string, &result_var); 394 &script_string, &result_var);
392 395
393 NPVariant_Param result_param; 396 NPVariant_Param result_param;
394 CreateNPVariantParam( 397 CreateNPVariantParam(
395 result_var, local_channel, &result_param, true, containing_window_, 398 result_var, local_channel, &result_param, true, containing_window_,
396 page_url_); 399 page_url_);
397 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); 400 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value);
398 local_channel->Send(reply_msg); 401 local_channel->Send(reply_msg);
399 } 402 }
OLDNEW
« no previous file with comments | « chrome/plugin/npobject_stub.h ('k') | chrome/plugin/plugin_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698