| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "cc/surfaces/surface.h" |
| 13 #include "content/common/browser_plugin/browser_plugin_constants.h" | 14 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 14 #include "content/common/browser_plugin/browser_plugin_messages.h" | 15 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 15 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
| 16 #include "content/public/common/content_client.h" | 17 #include "content/public/common/content_client.h" |
| 17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/renderer/browser_plugin_delegate.h" | 19 #include "content/public/renderer/browser_plugin_delegate.h" |
| 19 #include "content/public/renderer/content_renderer_client.h" | 20 #include "content/public/renderer/content_renderer_client.h" |
| 20 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 21 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 21 #include "content/renderer/child_frame_compositing_helper.h" | 22 #include "content/renderer/child_frame_compositing_helper.h" |
| 22 #include "content/renderer/cursor_utils.h" | 23 #include "content/renderer/cursor_utils.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) | 100 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) |
| 100 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginMsg_CompositorFrameSwapped, | 101 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginMsg_CompositorFrameSwapped, |
| 101 OnCompositorFrameSwapped(message)) | 102 OnCompositorFrameSwapped(message)) |
| 102 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestGone, OnGuestGone) | 103 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestGone, OnGuestGone) |
| 103 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetContentsOpaque, OnSetContentsOpaque) | 104 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetContentsOpaque, OnSetContentsOpaque) |
| 104 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor) | 105 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor) |
| 105 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetMouseLock, OnSetMouseLock) | 106 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetMouseLock, OnSetMouseLock) |
| 106 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetTooltipText, OnSetTooltipText) | 107 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetTooltipText, OnSetTooltipText) |
| 107 IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents, | 108 IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents, |
| 108 OnShouldAcceptTouchEvents) | 109 OnShouldAcceptTouchEvents) |
| 110 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetChildFrameSurface, |
| 111 OnSetChildFrameSurface) |
| 109 IPC_END_MESSAGE_MAP() | 112 IPC_END_MESSAGE_MAP() |
| 110 return handled; | 113 return handled; |
| 111 } | 114 } |
| 112 | 115 |
| 116 void BrowserPlugin::OnSetChildFrameSurface( |
| 117 int browser_plugin_instance_id, |
| 118 const cc::SurfaceId& surface_id, |
| 119 const gfx::Size& frame_size, |
| 120 float scale_factor, |
| 121 const cc::SurfaceSequence& sequence) { |
| 122 if (!attached()) |
| 123 return; |
| 124 |
| 125 EnableCompositing(true); |
| 126 DCHECK(compositing_helper_.get()); |
| 127 |
| 128 compositing_helper_->OnSetSurface(surface_id, frame_size, scale_factor, |
| 129 sequence); |
| 130 } |
| 131 |
| 132 void BrowserPlugin::SendSatisfySequence(const cc::SurfaceSequence& sequence) { |
| 133 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SatisfySequence( |
| 134 render_frame_routing_id_, browser_plugin_instance_id_, sequence)); |
| 135 } |
| 136 |
| 113 void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name, | 137 void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name, |
| 114 const base::string16& attribute_value) { | 138 const base::string16& attribute_value) { |
| 115 if (!container()) | 139 if (!container()) |
| 116 return; | 140 return; |
| 117 | 141 |
| 118 blink::WebElement element = container()->element(); | 142 blink::WebElement element = container()->element(); |
| 119 blink::WebString web_attribute_name = | 143 blink::WebString web_attribute_name = |
| 120 blink::WebString::fromUTF8(attribute_name); | 144 blink::WebString::fromUTF8(attribute_name); |
| 121 element.setAttribute(web_attribute_name, attribute_value); | 145 element.setAttribute(web_attribute_name, attribute_value); |
| 122 } | 146 } |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 bool BrowserPlugin::HandleMouseLockedInputEvent( | 637 bool BrowserPlugin::HandleMouseLockedInputEvent( |
| 614 const blink::WebMouseEvent& event) { | 638 const blink::WebMouseEvent& event) { |
| 615 BrowserPluginManager::Get()->Send( | 639 BrowserPluginManager::Get()->Send( |
| 616 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 640 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
| 617 view_rect_, | 641 view_rect_, |
| 618 &event)); | 642 &event)); |
| 619 return true; | 643 return true; |
| 620 } | 644 } |
| 621 | 645 |
| 622 } // namespace content | 646 } // namespace content |
| OLD | NEW |