| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 int browser_plugin_instance_id, | 122 int browser_plugin_instance_id, |
| 123 const cc::SurfaceId& surface_id, | 123 const cc::SurfaceId& surface_id, |
| 124 const gfx::Size& frame_size, | 124 const gfx::Size& frame_size, |
| 125 float scale_factor, | 125 float scale_factor, |
| 126 const cc::SurfaceSequence& sequence) { | 126 const cc::SurfaceSequence& sequence) { |
| 127 if (!attached()) | 127 if (!attached()) |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 EnableCompositing(true); | 130 EnableCompositing(true); |
| 131 DCHECK(compositing_helper_.get()); | 131 DCHECK(compositing_helper_.get()); |
| 132 | |
| 133 compositing_helper_->OnSetSurface(surface_id, frame_size, scale_factor, | 132 compositing_helper_->OnSetSurface(surface_id, frame_size, scale_factor, |
| 134 sequence); | 133 sequence); |
| 135 } | 134 } |
| 136 | 135 |
| 137 void BrowserPlugin::SendSatisfySequence(const cc::SurfaceSequence& sequence) { | 136 void BrowserPlugin::SendSatisfySequence(const cc::SurfaceSequence& sequence) { |
| 138 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SatisfySequence( | 137 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SatisfySequence( |
| 139 render_frame_routing_id_, browser_plugin_instance_id_, sequence)); | 138 render_frame_routing_id_, browser_plugin_instance_id_, sequence)); |
| 140 } | 139 } |
| 141 | 140 |
| 142 void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name, | 141 void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name, |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE); | 426 paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE); |
| 428 canvas->drawRect(image_data_rect, paint); | 427 canvas->drawRect(image_data_rect, paint); |
| 429 } | 428 } |
| 430 | 429 |
| 431 // static | 430 // static |
| 432 bool BrowserPlugin::ShouldForwardToBrowserPlugin( | 431 bool BrowserPlugin::ShouldForwardToBrowserPlugin( |
| 433 const IPC::Message& message) { | 432 const IPC::Message& message) { |
| 434 return IPC_MESSAGE_CLASS(message) == BrowserPluginMsgStart; | 433 return IPC_MESSAGE_CLASS(message) == BrowserPluginMsgStart; |
| 435 } | 434 } |
| 436 | 435 |
| 437 void BrowserPlugin::updateGeometry(const WebRect& window_rect, | 436 void BrowserPlugin::updateGeometry(const WebRect& plugin_rect_in_viewport, |
| 438 const WebRect& clip_rect, | 437 const WebRect& clip_rect, |
| 439 const WebRect& unobscured_rect, | 438 const WebRect& unobscured_rect, |
| 440 const WebVector<WebRect>& cut_outs_rects, | 439 const WebVector<WebRect>& cut_outs_rects, |
| 441 bool is_visible) { | 440 bool is_visible) { |
| 442 gfx::Rect old_view_rect = view_rect_; | 441 gfx::Rect old_view_rect = view_rect_; |
| 443 view_rect_ = window_rect; | 442 // Convert the plugin_rect_in_viewport to window coordinates, which is css. |
| 443 WebRect rect_in_css(plugin_rect_in_viewport); |
| 444 blink::WebView* webview = container()->element().document().frame()->view(); |
| 445 RenderView::FromWebView(webview)->convertViewportToWindow(&rect_in_css); |
| 446 view_rect_ = rect_in_css; |
| 444 | 447 |
| 445 if (!ready_) { | 448 if (!ready_) { |
| 446 if (delegate_) | 449 if (delegate_) |
| 447 delegate_->Ready(); | 450 delegate_->Ready(); |
| 448 ready_ = true; | 451 ready_ = true; |
| 449 } | 452 } |
| 450 | 453 |
| 451 if (delegate_ && (view_rect_.size() != old_view_rect.size())) | 454 if (delegate_ && (view_rect_.size() != old_view_rect.size())) |
| 452 delegate_->DidResizeElement(view_rect_.size()); | 455 delegate_->DidResizeElement(view_rect_.size()); |
| 453 | 456 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 bool BrowserPlugin::HandleMouseLockedInputEvent( | 648 bool BrowserPlugin::HandleMouseLockedInputEvent( |
| 646 const blink::WebMouseEvent& event) { | 649 const blink::WebMouseEvent& event) { |
| 647 BrowserPluginManager::Get()->Send( | 650 BrowserPluginManager::Get()->Send( |
| 648 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 651 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
| 649 view_rect_, | 652 view_rect_, |
| 650 &event)); | 653 &event)); |
| 651 return true; | 654 return true; |
| 652 } | 655 } |
| 653 | 656 |
| 654 } // namespace content | 657 } // namespace content |
| OLD | NEW |