OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/webplugin_delegate_stub.h" | 5 #include "chrome/plugin/webplugin_delegate_stub.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/common/child_process_logging.h" | 10 #include "chrome/common/child_process_logging.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 new FinishDestructionTask(delegate_, webplugin_)); | 81 new FinishDestructionTask(delegate_, webplugin_)); |
82 } else { | 82 } else { |
83 // Safe to delete right away. | 83 // Safe to delete right away. |
84 if (delegate_) | 84 if (delegate_) |
85 delegate_->PluginDestroyed(); | 85 delegate_->PluginDestroyed(); |
86 | 86 |
87 delete webplugin_; | 87 delete webplugin_; |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { | 91 bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { |
92 child_process_logging::SetActiveURL(page_url_); | 92 child_process_logging::SetActiveURL(page_url_); |
93 | 93 |
94 // A plugin can execute a script to delete itself in any of its NPP methods. | 94 // A plugin can execute a script to delete itself in any of its NPP methods. |
95 // Hold an extra reference to ourself so that if this does occur and we're | 95 // Hold an extra reference to ourself so that if this does occur and we're |
96 // handling a sync message, we don't crash when attempting to send a reply. | 96 // handling a sync message, we don't crash when attempting to send a reply. |
97 // The exception to this is when we're already in the destructor. | 97 // The exception to this is when we're already in the destructor. |
98 if (!in_destructor_) | 98 if (!in_destructor_) |
99 AddRef(); | 99 AddRef(); |
100 | 100 |
| 101 bool handled = true; |
101 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg) | 102 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg) |
102 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) | 103 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) |
103 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) | 104 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) |
104 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) | 105 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) |
105 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) | 106 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) |
106 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) | 107 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) |
107 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) | 108 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) |
108 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason, | 109 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason, |
109 OnDidFinishLoadWithReason) | 110 OnDidFinishLoadWithReason) |
110 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) | 111 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) |
(...skipping 28 matching lines...) Expand all Loading... |
139 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, | 140 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, |
140 OnHTTPRangeRequestReply) | 141 OnHTTPRangeRequestReply) |
141 IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer, | 142 IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer, |
142 OnCreateCommandBuffer) | 143 OnCreateCommandBuffer) |
143 IPC_MESSAGE_HANDLER(PluginMsg_DestroyCommandBuffer, | 144 IPC_MESSAGE_HANDLER(PluginMsg_DestroyCommandBuffer, |
144 OnDestroyCommandBuffer) | 145 OnDestroyCommandBuffer) |
145 #if defined(OS_MACOSX) | 146 #if defined(OS_MACOSX) |
146 IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, | 147 IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, |
147 OnSetFakeAcceleratedSurfaceWindowHandle) | 148 OnSetFakeAcceleratedSurfaceWindowHandle) |
148 #endif | 149 #endif |
149 IPC_MESSAGE_UNHANDLED_ERROR() | 150 IPC_MESSAGE_UNHANDLED(handled = false) |
150 IPC_END_MESSAGE_MAP() | 151 IPC_END_MESSAGE_MAP() |
151 | 152 |
152 if (!in_destructor_) | 153 if (!in_destructor_) |
153 Release(); | 154 Release(); |
| 155 |
| 156 DCHECK(handled); |
| 157 return handled; |
154 } | 158 } |
155 | 159 |
156 bool WebPluginDelegateStub::Send(IPC::Message* msg) { | 160 bool WebPluginDelegateStub::Send(IPC::Message* msg) { |
157 return channel_->Send(msg); | 161 return channel_->Send(msg); |
158 } | 162 } |
159 | 163 |
160 void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, | 164 void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, |
161 bool* result) { | 165 bool* result) { |
162 page_url_ = params.page_url; | 166 page_url_ = params.page_url; |
163 child_process_logging::SetActiveURL(page_url_); | 167 child_process_logging::SetActiveURL(page_url_); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 webplugin_->OnResourceCreated(resource_id, resource_client); | 474 webplugin_->OnResourceCreated(resource_id, resource_client); |
471 } | 475 } |
472 | 476 |
473 #if defined(OS_MACOSX) | 477 #if defined(OS_MACOSX) |
474 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( | 478 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( |
475 gfx::PluginWindowHandle window) { | 479 gfx::PluginWindowHandle window) { |
476 delegate_->set_windowed_handle(window); | 480 delegate_->set_windowed_handle(window); |
477 } | 481 } |
478 #endif | 482 #endif |
479 | 483 |
OLD | NEW |