| 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/renderer/webplugin_delegate_proxy.h" | 5 #include "content/renderer/webplugin_delegate_proxy.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #elif defined(USE_X11) | 9 #elif defined(USE_X11) |
| 10 #include <cairo/cairo.h> | 10 #include <cairo/cairo.h> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "content/public/common/sandbox_init.h" | 65 #include "content/public/common/sandbox_init.h" |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 using WebKit::WebBindings; | 68 using WebKit::WebBindings; |
| 69 using WebKit::WebCursorInfo; | 69 using WebKit::WebCursorInfo; |
| 70 using WebKit::WebDragData; | 70 using WebKit::WebDragData; |
| 71 using WebKit::WebInputEvent; | 71 using WebKit::WebInputEvent; |
| 72 using WebKit::WebString; | 72 using WebKit::WebString; |
| 73 using WebKit::WebView; | 73 using WebKit::WebView; |
| 74 | 74 |
| 75 namespace content { |
| 76 |
| 75 namespace { | 77 namespace { |
| 76 | 78 |
| 77 class ScopedLogLevel { | 79 class ScopedLogLevel { |
| 78 public: | 80 public: |
| 79 explicit ScopedLogLevel(int level); | 81 explicit ScopedLogLevel(int level); |
| 80 ~ScopedLogLevel(); | 82 ~ScopedLogLevel(); |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 int old_level_; | 85 int old_level_; |
| 84 | 86 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 453 |
| 452 void WebPluginDelegateProxy::DidFinishManualLoading() { | 454 void WebPluginDelegateProxy::DidFinishManualLoading() { |
| 453 Send(new PluginMsg_DidFinishManualLoading(instance_id_)); | 455 Send(new PluginMsg_DidFinishManualLoading(instance_id_)); |
| 454 } | 456 } |
| 455 | 457 |
| 456 void WebPluginDelegateProxy::DidManualLoadFail() { | 458 void WebPluginDelegateProxy::DidManualLoadFail() { |
| 457 Send(new PluginMsg_DidManualLoadFail(instance_id_)); | 459 Send(new PluginMsg_DidManualLoadFail(instance_id_)); |
| 458 } | 460 } |
| 459 | 461 |
| 460 bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { | 462 bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { |
| 461 content::GetContentClient()->SetActiveURL(page_url_); | 463 GetContentClient()->SetActiveURL(page_url_); |
| 462 | 464 |
| 463 bool handled = true; | 465 bool handled = true; |
| 464 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg) | 466 IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg) |
| 465 IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindow, OnSetWindow) | 467 IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindow, OnSetWindow) |
| 466 #if defined(OS_WIN) | 468 #if defined(OS_WIN) |
| 467 IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindowlessPumpEvent, | 469 IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindowlessPumpEvent, |
| 468 OnSetWindowlessPumpEvent) | 470 OnSetWindowlessPumpEvent) |
| 469 IPC_MESSAGE_HANDLER(PluginHostMsg_NotifyIMEStatus, | 471 IPC_MESSAGE_HANDLER(PluginHostMsg_NotifyIMEStatus, |
| 470 OnNotifyIMEStatus) | 472 OnNotifyIMEStatus) |
| 471 #endif | 473 #endif |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 // FileDescriptor message fields needs to remain valid until the message is | 550 // FileDescriptor message fields needs to remain valid until the message is |
| 549 // sent or else the sendmsg() call will fail. | 551 // sent or else the sendmsg() call will fail. |
| 550 if ((handle_out->fd = HANDLE_EINTR(dup(handle_in.fd))) < 0) { | 552 if ((handle_out->fd = HANDLE_EINTR(dup(handle_in.fd))) < 0) { |
| 551 PLOG(ERROR) << "dup()"; | 553 PLOG(ERROR) << "dup()"; |
| 552 return; | 554 return; |
| 553 } | 555 } |
| 554 handle_out->auto_close = true; | 556 handle_out->auto_close = true; |
| 555 #elif defined(OS_WIN) | 557 #elif defined(OS_WIN) |
| 556 // On Windows we need to duplicate the handle for the plugin process. | 558 // On Windows we need to duplicate the handle for the plugin process. |
| 557 *handle_out = NULL; | 559 *handle_out = NULL; |
| 558 content::BrokerDuplicateHandle(handle_in, peer_pid, handle_out, | 560 BrokerDuplicateHandle(handle_in, peer_pid, handle_out, |
| 559 FILE_MAP_READ | FILE_MAP_WRITE, 0); | 561 FILE_MAP_READ | FILE_MAP_WRITE, 0); |
| 560 DCHECK(*handle_out != NULL); | 562 DCHECK(*handle_out != NULL); |
| 561 #else | 563 #else |
| 562 // Don't need to do anything special for other platforms. | 564 // Don't need to do anything special for other platforms. |
| 563 *handle_out = handle_in; | 565 *handle_out = handle_in; |
| 564 #endif | 566 #endif |
| 565 } | 567 } |
| 566 | 568 |
| 567 void WebPluginDelegateProxy::SendUpdateGeometry( | 569 void WebPluginDelegateProxy::SendUpdateGeometry( |
| 568 bool bitmaps_changed) { | 570 bool bitmaps_changed) { |
| 569 PluginMsg_UpdateGeometry_Param param; | 571 PluginMsg_UpdateGeometry_Param param; |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 std::string* cookies) { | 1250 std::string* cookies) { |
| 1249 DCHECK(cookies); | 1251 DCHECK(cookies); |
| 1250 if (plugin_) | 1252 if (plugin_) |
| 1251 *cookies = plugin_->GetCookies(url, first_party_for_cookies); | 1253 *cookies = plugin_->GetCookies(url, first_party_for_cookies); |
| 1252 } | 1254 } |
| 1253 | 1255 |
| 1254 void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context, | 1256 void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context, |
| 1255 const gfx::Rect& rect) { | 1257 const gfx::Rect& rect) { |
| 1256 // Lazily load the sad plugin image. | 1258 // Lazily load the sad plugin image. |
| 1257 if (!sad_plugin_) | 1259 if (!sad_plugin_) |
| 1258 sad_plugin_ = content::GetContentClient()->renderer()->GetSadPluginBitmap(); | 1260 sad_plugin_ = GetContentClient()->renderer()->GetSadPluginBitmap(); |
| 1259 if (sad_plugin_) | 1261 if (sad_plugin_) |
| 1260 webkit::PaintSadPlugin(native_context, plugin_rect_, *sad_plugin_); | 1262 webkit::PaintSadPlugin(native_context, plugin_rect_, *sad_plugin_); |
| 1261 } | 1263 } |
| 1262 | 1264 |
| 1263 void WebPluginDelegateProxy::CopyFromBackBufferToFrontBuffer( | 1265 void WebPluginDelegateProxy::CopyFromBackBufferToFrontBuffer( |
| 1264 const gfx::Rect& rect) { | 1266 const gfx::Rect& rect) { |
| 1265 #if defined(OS_MACOSX) | 1267 #if defined(OS_MACOSX) |
| 1266 // Blitting the bits directly is much faster than going through CG, and since | 1268 // Blitting the bits directly is much faster than going through CG, and since |
| 1267 // the goal is just to move the raw pixels between two bitmaps with the same | 1269 // the goal is just to move the raw pixels between two bitmaps with the same |
| 1268 // pixel format (no compositing, color correction, etc.), it's safe. | 1270 // pixel format (no compositing, color correction, etc.), it's safe. |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 } | 1527 } |
| 1526 #endif | 1528 #endif |
| 1527 | 1529 |
| 1528 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1530 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
| 1529 int resource_id) { | 1531 int resource_id) { |
| 1530 if (!plugin_) | 1532 if (!plugin_) |
| 1531 return; | 1533 return; |
| 1532 | 1534 |
| 1533 plugin_->URLRedirectResponse(allow, resource_id); | 1535 plugin_->URLRedirectResponse(allow, resource_id); |
| 1534 } | 1536 } |
| 1537 |
| 1538 } // namespace content |
| OLD | NEW |