| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 OnSendJavaScriptStream) | 123 OnSendJavaScriptStream) |
| 124 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, | 124 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, |
| 125 OnDidReceiveManualResponse) | 125 OnDidReceiveManualResponse) |
| 126 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) | 126 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) |
| 127 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, | 127 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, |
| 128 OnDidFinishManualLoading) | 128 OnDidFinishManualLoading) |
| 129 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) | 129 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) |
| 130 IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin) | 130 IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
| 131 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, | 131 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, |
| 132 OnHandleURLRequestReply) | 132 OnHandleURLRequestReply) |
| 133 IPC_MESSAGE_HANDLER(PluginMsg_CreateCommandBuffer, |
| 134 OnCreateCommandBuffer) |
| 133 IPC_MESSAGE_UNHANDLED_ERROR() | 135 IPC_MESSAGE_UNHANDLED_ERROR() |
| 134 IPC_END_MESSAGE_MAP() | 136 IPC_END_MESSAGE_MAP() |
| 135 | 137 |
| 136 if (!in_destructor_) | 138 if (!in_destructor_) |
| 137 Release(); | 139 Release(); |
| 138 } | 140 } |
| 139 | 141 |
| 140 bool WebPluginDelegateStub::Send(IPC::Message* msg) { | 142 bool WebPluginDelegateStub::Send(IPC::Message* msg) { |
| 141 return channel_->Send(msg); | 143 return channel_->Send(msg); |
| 142 } | 144 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 webplugin_->UpdateGeometry( | 297 webplugin_->UpdateGeometry( |
| 296 param.window_rect, param.clip_rect, | 298 param.window_rect, param.clip_rect, |
| 297 param.windowless_buffer, param.background_buffer | 299 param.windowless_buffer, param.background_buffer |
| 298 #if defined(OS_MACOSX) | 300 #if defined(OS_MACOSX) |
| 299 , | 301 , |
| 300 param.ack_key | 302 param.ack_key |
| 301 #endif | 303 #endif |
| 302 ); | 304 ); |
| 303 } | 305 } |
| 304 | 306 |
| 305 void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id, | 307 void WebPluginDelegateStub::OnGetPluginScriptableObject( |
| 306 intptr_t* npobject_ptr)
{ | 308 int* route_id, |
| 309 intptr_t* npobject_ptr) { |
| 307 NPObject* object = delegate_->GetPluginScriptableObject(); | 310 NPObject* object = delegate_->GetPluginScriptableObject(); |
| 308 if (!object) { | 311 if (!object) { |
| 309 *route_id = MSG_ROUTING_NONE; | 312 *route_id = MSG_ROUTING_NONE; |
| 310 return; | 313 return; |
| 311 } | 314 } |
| 312 | 315 |
| 313 *route_id = channel_->GenerateRouteID(); | 316 *route_id = channel_->GenerateRouteID(); |
| 314 *npobject_ptr = reinterpret_cast<intptr_t>(object); | 317 *npobject_ptr = reinterpret_cast<intptr_t>(object); |
| 315 // The stub will delete itself when the proxy tells it that it's released, or | 318 // The stub will delete itself when the proxy tells it that it's released, or |
| 316 // otherwise when the channel is closed. | 319 // otherwise when the channel is closed. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 353 } |
| 351 | 354 |
| 352 void WebPluginDelegateStub::OnDidManualLoadFail() { | 355 void WebPluginDelegateStub::OnDidManualLoadFail() { |
| 353 delegate_->DidManualLoadFail(); | 356 delegate_->DidManualLoadFail(); |
| 354 } | 357 } |
| 355 | 358 |
| 356 void WebPluginDelegateStub::OnInstallMissingPlugin() { | 359 void WebPluginDelegateStub::OnInstallMissingPlugin() { |
| 357 delegate_->InstallMissingPlugin(); | 360 delegate_->InstallMissingPlugin(); |
| 358 } | 361 } |
| 359 | 362 |
| 363 void WebPluginDelegateStub::OnCreateCommandBuffer(int* route_id) { |
| 364 #if defined(ENABLE_GPU) |
| 365 command_buffer_stub_.reset(new CommandBufferStub( |
| 366 static_cast<PluginChannel*>(PluginChannelBase::GetCurrentChannel()), |
| 367 delegate_->windowed_handle())); |
| 368 |
| 369 *route_id = command_buffer_stub_->route_id(); |
| 370 #endif |
| 371 } |
| 372 |
| 360 void WebPluginDelegateStub::CreateSharedBuffer( | 373 void WebPluginDelegateStub::CreateSharedBuffer( |
| 361 size_t size, | 374 size_t size, |
| 362 base::SharedMemory* shared_buf, | 375 base::SharedMemory* shared_buf, |
| 363 base::SharedMemoryHandle* remote_handle) { | 376 base::SharedMemoryHandle* remote_handle) { |
| 364 if (!shared_buf->Create(std::wstring(), false, false, size)) { | 377 if (!shared_buf->Create(std::wstring(), false, false, size)) { |
| 365 NOTREACHED(); | 378 NOTREACHED(); |
| 366 return; | 379 return; |
| 367 } | 380 } |
| 368 if (!shared_buf->Map(size)) { | 381 if (!shared_buf->Map(size)) { |
| 369 NOTREACHED(); | 382 NOTREACHED(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 390 | 403 |
| 391 void WebPluginDelegateStub::OnHandleURLRequestReply( | 404 void WebPluginDelegateStub::OnHandleURLRequestReply( |
| 392 const PluginMsg_URLRequestReply_Params& params) { | 405 const PluginMsg_URLRequestReply_Params& params) { |
| 393 WebPluginResourceClient* resource_client = | 406 WebPluginResourceClient* resource_client = |
| 394 delegate_->CreateResourceClient(params.resource_id, params.url, | 407 delegate_->CreateResourceClient(params.resource_id, params.url, |
| 395 params.notify_needed, | 408 params.notify_needed, |
| 396 params.notify_data, | 409 params.notify_data, |
| 397 params.stream); | 410 params.stream); |
| 398 webplugin_->OnResourceCreated(params.resource_id, resource_client); | 411 webplugin_->OnResourceCreated(params.resource_id, resource_client); |
| 399 } | 412 } |
| OLD | NEW |