| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 AddRef(); | 92 AddRef(); |
| 93 | 93 |
| 94 bool handled = true; | 94 bool handled = true; |
| 95 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg) | 95 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg) |
| 96 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) | 96 IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) |
| 97 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) | 97 IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) |
| 98 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) | 98 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveResponse, OnDidReceiveResponse) |
| 99 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) | 99 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveData, OnDidReceiveData) |
| 100 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) | 100 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoading, OnDidFinishLoading) |
| 101 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) | 101 IPC_MESSAGE_HANDLER(PluginMsg_DidFail, OnDidFail) |
| 102 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishLoadWithReason, | |
| 103 OnDidFinishLoadWithReason) | |
| 104 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) | 102 IPC_MESSAGE_HANDLER(PluginMsg_SetFocus, OnSetFocus) |
| 105 IPC_MESSAGE_HANDLER(PluginMsg_HandleInputEvent, OnHandleInputEvent) | 103 IPC_MESSAGE_HANDLER(PluginMsg_HandleInputEvent, OnHandleInputEvent) |
| 106 IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint) | 104 IPC_MESSAGE_HANDLER(PluginMsg_Paint, OnPaint) |
| 107 IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint) | 105 IPC_MESSAGE_HANDLER(PluginMsg_DidPaint, OnDidPaint) |
| 108 IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject, | 106 IPC_MESSAGE_HANDLER(PluginMsg_GetPluginScriptableObject, |
| 109 OnGetPluginScriptableObject) | 107 OnGetPluginScriptableObject) |
| 110 IPC_MESSAGE_HANDLER(PluginMsg_GetFormValue, OnGetFormValue) | 108 IPC_MESSAGE_HANDLER(PluginMsg_GetFormValue, OnGetFormValue) |
| 111 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry) | 109 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometry, OnUpdateGeometry) |
| 112 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry) | 110 IPC_MESSAGE_HANDLER(PluginMsg_UpdateGeometrySync, OnUpdateGeometry) |
| 113 IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream, | 111 IPC_MESSAGE_HANDLER(PluginMsg_SendJavaScriptStream, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 238 } |
| 241 | 239 |
| 242 void WebPluginDelegateStub::OnDidFail(int id) { | 240 void WebPluginDelegateStub::OnDidFail(int id) { |
| 243 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); | 241 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); |
| 244 if (!client) | 242 if (!client) |
| 245 return; | 243 return; |
| 246 | 244 |
| 247 client->DidFail(id); | 245 client->DidFail(id); |
| 248 } | 246 } |
| 249 | 247 |
| 250 void WebPluginDelegateStub::OnDidFinishLoadWithReason( | |
| 251 const GURL& url, int reason, int notify_id) { | |
| 252 delegate_->DidFinishLoadWithReason(url, reason, notify_id); | |
| 253 } | |
| 254 | |
| 255 void WebPluginDelegateStub::OnSetFocus(bool focused) { | 248 void WebPluginDelegateStub::OnSetFocus(bool focused) { |
| 256 delegate_->SetFocus(focused); | 249 delegate_->SetFocus(focused); |
| 257 #if defined(OS_WIN) && !defined(USE_AURA) | 250 #if defined(OS_WIN) && !defined(USE_AURA) |
| 258 if (focused) | 251 if (focused) |
| 259 webplugin_->UpdateIMEStatus(); | 252 webplugin_->UpdateIMEStatus(); |
| 260 #endif | 253 #endif |
| 261 } | 254 } |
| 262 | 255 |
| 263 void WebPluginDelegateStub::OnHandleInputEvent( | 256 void WebPluginDelegateStub::OnHandleInputEvent( |
| 264 const blink::WebInputEvent *event, | 257 const blink::WebInputEvent *event, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 void WebPluginDelegateStub::OnGetFormValue(base::string16* value, | 301 void WebPluginDelegateStub::OnGetFormValue(base::string16* value, |
| 309 bool* success) { | 302 bool* success) { |
| 310 *success = false; | 303 *success = false; |
| 311 if (!delegate_) | 304 if (!delegate_) |
| 312 return; | 305 return; |
| 313 *success = delegate_->GetFormValue(value); | 306 *success = delegate_->GetFormValue(value); |
| 314 } | 307 } |
| 315 | 308 |
| 316 void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url, | 309 void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url, |
| 317 const std::string& result, | 310 const std::string& result, |
| 318 bool success, | 311 bool success) { |
| 319 int notify_id) { | 312 delegate_->SendJavaScriptStream(url, result, success); |
| 320 delegate_->SendJavaScriptStream(url, result, success, notify_id); | |
| 321 } | 313 } |
| 322 | 314 |
| 323 void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) { | 315 void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) { |
| 324 if (delegate_) | 316 if (delegate_) |
| 325 delegate_->SetContentAreaHasFocus(has_focus); | 317 delegate_->SetContentAreaHasFocus(has_focus); |
| 326 } | 318 } |
| 327 | 319 |
| 328 #if defined(OS_WIN) && !defined(USE_AURA) | 320 #if defined(OS_WIN) && !defined(USE_AURA) |
| 329 void WebPluginDelegateStub::OnImeCompositionUpdated( | 321 void WebPluginDelegateStub::OnImeCompositionUpdated( |
| 330 const base::string16& text, | 322 const base::string16& text, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 385 |
| 394 void WebPluginDelegateStub::OnDidFinishManualLoading() { | 386 void WebPluginDelegateStub::OnDidFinishManualLoading() { |
| 395 delegate_->DidFinishManualLoading(); | 387 delegate_->DidFinishManualLoading(); |
| 396 } | 388 } |
| 397 | 389 |
| 398 void WebPluginDelegateStub::OnDidManualLoadFail() { | 390 void WebPluginDelegateStub::OnDidManualLoadFail() { |
| 399 delegate_->DidManualLoadFail(); | 391 delegate_->DidManualLoadFail(); |
| 400 } | 392 } |
| 401 | 393 |
| 402 void WebPluginDelegateStub::OnHandleURLRequestReply( | 394 void WebPluginDelegateStub::OnHandleURLRequestReply( |
| 403 unsigned long resource_id, const GURL& url, int notify_id) { | 395 unsigned long resource_id, const GURL& url) { |
| 404 WebPluginResourceClient* resource_client = | 396 WebPluginResourceClient* resource_client = |
| 405 delegate_->CreateResourceClient(resource_id, url, notify_id); | 397 delegate_->CreateResourceClient(resource_id, url); |
| 406 webplugin_->OnResourceCreated(resource_id, resource_client); | 398 webplugin_->OnResourceCreated(resource_id, resource_client); |
| 407 } | 399 } |
| 408 | 400 |
| 409 void WebPluginDelegateStub::OnHTTPRangeRequestReply( | 401 void WebPluginDelegateStub::OnHTTPRangeRequestReply( |
| 410 unsigned long resource_id, int range_request_id) { | 402 unsigned long resource_id, int range_request_id) { |
| 411 WebPluginResourceClient* resource_client = | 403 WebPluginResourceClient* resource_client = |
| 412 delegate_->CreateSeekableResourceClient(resource_id, range_request_id); | 404 delegate_->CreateSeekableResourceClient(resource_id, range_request_id); |
| 413 webplugin_->OnResourceCreated(resource_id, resource_client); | 405 webplugin_->OnResourceCreated(resource_id, resource_client); |
| 414 } | 406 } |
| 415 | 407 |
| 416 void WebPluginDelegateStub::OnFetchURL( | 408 void WebPluginDelegateStub::OnFetchURL( |
| 417 const PluginMsg_FetchURL_Params& params) { | 409 const PluginMsg_FetchURL_Params& params) { |
| 418 const char* data = NULL; | 410 const char* data = NULL; |
| 419 if (params.post_data.size()) | 411 if (params.post_data.size()) |
| 420 data = ¶ms.post_data[0]; | 412 data = ¶ms.post_data[0]; |
| 421 | 413 |
| 422 delegate_->FetchURL(params.resource_id, | 414 delegate_->FetchURL(params.resource_id, |
| 423 params.notify_id, | |
| 424 params.url, | 415 params.url, |
| 425 params.first_party_for_cookies, | 416 params.first_party_for_cookies, |
| 426 params.method, | 417 params.method, |
| 427 data, | 418 data, |
| 428 static_cast<unsigned int>(params.post_data.size()), | 419 static_cast<unsigned int>(params.post_data.size()), |
| 429 Referrer(params.referrer, params.referrer_policy), | 420 Referrer(params.referrer, params.referrer_policy), |
| 430 params.notify_redirect, | 421 params.notify_redirect, |
| 431 params.is_plugin_src_load, | 422 params.is_plugin_src_load, |
| 432 channel_->renderer_id(), | 423 channel_->renderer_id(), |
| 433 params.render_frame_id, | 424 params.render_frame_id, |
| 434 webplugin_->host_render_view_routing_id()); | 425 webplugin_->host_render_view_routing_id()); |
| 435 } | 426 } |
| 436 | 427 |
| 437 } // namespace content | 428 } // namespace content |
| OLD | NEW |