| OLD | NEW |
| 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/plugin/webplugin_delegate_stub.h" | 5 #include "content/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 "base/string_number_conversions.h" |
| 10 #include "content/common/content_client.h" | 11 #include "content/common/content_client.h" |
| 12 #include "content/common/content_constants.h" |
| 11 #include "content/common/content_switches.h" | 13 #include "content/common/content_switches.h" |
| 12 #include "content/common/plugin_messages.h" | 14 #include "content/common/plugin_messages.h" |
| 13 #include "content/plugin/npobject_stub.h" | 15 #include "content/plugin/npobject_stub.h" |
| 14 #include "content/plugin/plugin_channel.h" | 16 #include "content/plugin/plugin_channel.h" |
| 15 #include "content/plugin/plugin_thread.h" | 17 #include "content/plugin/plugin_thread.h" |
| 16 #include "content/plugin/webplugin_proxy.h" | 18 #include "content/plugin/webplugin_proxy.h" |
| 17 #include "third_party/npapi/bindings/npapi.h" | 19 #include "third_party/npapi/bindings/npapi.h" |
| 18 #include "third_party/npapi/bindings/npruntime.h" | 20 #include "third_party/npapi/bindings/npruntime.h" |
| 19 #include "skia/ext/platform_device.h" | 21 #include "skia/ext/platform_device.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 IPC_MESSAGE_HANDLER(PluginMsg_WindowFrameChanged, OnWindowFrameChanged) | 117 IPC_MESSAGE_HANDLER(PluginMsg_WindowFrameChanged, OnWindowFrameChanged) |
| 116 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted, | 118 IPC_MESSAGE_HANDLER(PluginMsg_ImeCompositionCompleted, |
| 117 OnImeCompositionCompleted) | 119 OnImeCompositionCompleted) |
| 118 #endif | 120 #endif |
| 119 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, | 121 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, |
| 120 OnDidReceiveManualResponse) | 122 OnDidReceiveManualResponse) |
| 121 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) | 123 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) |
| 122 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, | 124 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, |
| 123 OnDidFinishManualLoading) | 125 OnDidFinishManualLoading) |
| 124 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) | 126 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) |
| 125 IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin) | |
| 126 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, | 127 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, |
| 127 OnHandleURLRequestReply) | 128 OnHandleURLRequestReply) |
| 128 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, | 129 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, |
| 129 OnHTTPRangeRequestReply) | 130 OnHTTPRangeRequestReply) |
| 130 #if defined(OS_MACOSX) | 131 #if defined(OS_MACOSX) |
| 131 IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, | 132 IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, |
| 132 OnSetFakeAcceleratedSurfaceWindowHandle) | 133 OnSetFakeAcceleratedSurfaceWindowHandle) |
| 133 #endif | 134 #endif |
| 134 IPC_MESSAGE_UNHANDLED(handled = false) | 135 IPC_MESSAGE_UNHANDLED(handled = false) |
| 135 IPC_END_MESSAGE_MAP() | 136 IPC_END_MESSAGE_MAP() |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // params.containing_window, &parent)); | 173 // params.containing_window, &parent)); |
| 173 #endif | 174 #endif |
| 174 | 175 |
| 175 webplugin_ = new WebPluginProxy( | 176 webplugin_ = new WebPluginProxy( |
| 176 channel_, instance_id_, page_url_, params.containing_window, | 177 channel_, instance_id_, page_url_, params.containing_window, |
| 177 params.host_render_view_routing_id); | 178 params.host_render_view_routing_id); |
| 178 delegate_ = webkit::npapi::WebPluginDelegateImpl::Create( | 179 delegate_ = webkit::npapi::WebPluginDelegateImpl::Create( |
| 179 path, mime_type_, parent); | 180 path, mime_type_, parent); |
| 180 if (delegate_) { | 181 if (delegate_) { |
| 181 webplugin_->set_delegate(delegate_); | 182 webplugin_->set_delegate(delegate_); |
| 183 std::vector<std::string> arg_names = params.arg_names; |
| 184 std::vector<std::string> arg_values = params.arg_values; |
| 185 |
| 186 if (path.value() == webkit::npapi::kDefaultPluginLibraryName) { |
| 187 // Add the renderer process id and Render view routing id to the list of |
| 188 // parameters passed to the plugin. |
| 189 arg_names.push_back(content::kDefaultPluginRenderViewId); |
| 190 arg_values.push_back(base::IntToString( |
| 191 params.host_render_view_routing_id)); |
| 192 |
| 193 arg_names.push_back(content::kDefaultPluginRenderProcessId); |
| 194 arg_values.push_back(base::IntToString(channel_->renderer_id())); |
| 195 } |
| 182 *result = delegate_->Initialize(params.url, | 196 *result = delegate_->Initialize(params.url, |
| 183 params.arg_names, | 197 arg_names, |
| 184 params.arg_values, | 198 arg_values, |
| 185 webplugin_, | 199 webplugin_, |
| 186 params.load_manually); | 200 params.load_manually); |
| 187 } | 201 } |
| 188 } | 202 } |
| 189 | 203 |
| 190 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url, | 204 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url, |
| 191 int http_status_code) { | 205 int http_status_code) { |
| 192 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); | 206 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); |
| 193 if (!client) | 207 if (!client) |
| 194 return; | 208 return; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 370 } |
| 357 | 371 |
| 358 void WebPluginDelegateStub::OnDidFinishManualLoading() { | 372 void WebPluginDelegateStub::OnDidFinishManualLoading() { |
| 359 delegate_->DidFinishManualLoading(); | 373 delegate_->DidFinishManualLoading(); |
| 360 } | 374 } |
| 361 | 375 |
| 362 void WebPluginDelegateStub::OnDidManualLoadFail() { | 376 void WebPluginDelegateStub::OnDidManualLoadFail() { |
| 363 delegate_->DidManualLoadFail(); | 377 delegate_->DidManualLoadFail(); |
| 364 } | 378 } |
| 365 | 379 |
| 366 void WebPluginDelegateStub::OnInstallMissingPlugin() { | |
| 367 delegate_->InstallMissingPlugin(); | |
| 368 } | |
| 369 | |
| 370 void WebPluginDelegateStub::OnHandleURLRequestReply( | 380 void WebPluginDelegateStub::OnHandleURLRequestReply( |
| 371 unsigned long resource_id, const GURL& url, int notify_id) { | 381 unsigned long resource_id, const GURL& url, int notify_id) { |
| 372 WebPluginResourceClient* resource_client = | 382 WebPluginResourceClient* resource_client = |
| 373 delegate_->CreateResourceClient(resource_id, url, notify_id); | 383 delegate_->CreateResourceClient(resource_id, url, notify_id); |
| 374 webplugin_->OnResourceCreated(resource_id, resource_client); | 384 webplugin_->OnResourceCreated(resource_id, resource_client); |
| 375 } | 385 } |
| 376 | 386 |
| 377 void WebPluginDelegateStub::OnHTTPRangeRequestReply( | 387 void WebPluginDelegateStub::OnHTTPRangeRequestReply( |
| 378 unsigned long resource_id, int range_request_id) { | 388 unsigned long resource_id, int range_request_id) { |
| 379 WebPluginResourceClient* resource_client = | 389 WebPluginResourceClient* resource_client = |
| 380 delegate_->CreateSeekableResourceClient(resource_id, range_request_id); | 390 delegate_->CreateSeekableResourceClient(resource_id, range_request_id); |
| 381 webplugin_->OnResourceCreated(resource_id, resource_client); | 391 webplugin_->OnResourceCreated(resource_id, resource_client); |
| 382 } | 392 } |
| 383 | 393 |
| 384 #if defined(OS_MACOSX) | 394 #if defined(OS_MACOSX) |
| 385 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( | 395 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( |
| 386 gfx::PluginWindowHandle window) { | 396 gfx::PluginWindowHandle window) { |
| 387 delegate_->set_windowed_handle(window); | 397 delegate_->set_windowed_handle(window); |
| 388 } | 398 } |
| 389 #endif | 399 #endif |
| OLD | NEW |