Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 554773002: BrowserPlugin: Remove BrowserPluginGuest::ToGuestRect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 copy_request_id_, 282 copy_request_id_,
283 src_subrect, 283 src_subrect,
284 dst_size)); 284 dst_size));
285 } 285 }
286 286
287 BrowserPluginGuestManager* 287 BrowserPluginGuestManager*
288 BrowserPluginGuest::GetBrowserPluginGuestManager() const { 288 BrowserPluginGuest::GetBrowserPluginGuestManager() const {
289 return GetWebContents()->GetBrowserContext()->GetGuestManager(); 289 return GetWebContents()->GetBrowserContext()->GetGuestManager();
290 } 290 }
291 291
292 // screen.
293 gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) {
294 gfx::Rect guest_rect(bounds);
295 guest_rect.Offset(guest_window_rect_.OffsetFromOrigin());
296 if (embedder_web_contents()->GetBrowserPluginGuest()) {
297 BrowserPluginGuest* embedder_guest =
298 embedder_web_contents()->GetBrowserPluginGuest();
299 guest_rect.Offset(embedder_guest->guest_window_rect_.OffsetFromOrigin());
300 }
301 return guest_rect;
302 }
303
304 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) { 292 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) {
305 embedder_visible_ = visible; 293 embedder_visible_ = visible;
306 UpdateVisibility(); 294 UpdateVisibility();
307 } 295 }
308 296
309 void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) { 297 void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) {
310 SendMessageToEmbedder( 298 SendMessageToEmbedder(
311 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), allow)); 299 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), allow));
312 } 300 }
313 301
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 RenderWidgetHostImpl::SendReclaimCompositorResources(params.route_id, 628 RenderWidgetHostImpl::SendReclaimCompositorResources(params.route_id,
641 params.output_surface_id, 629 params.output_surface_id,
642 params.renderer_host_id, 630 params.renderer_host_id,
643 params.ack); 631 params.ack);
644 } 632 }
645 633
646 void BrowserPluginGuest::OnHandleInputEvent( 634 void BrowserPluginGuest::OnHandleInputEvent(
647 int browser_plugin_instance_id, 635 int browser_plugin_instance_id,
648 const gfx::Rect& guest_window_rect, 636 const gfx::Rect& guest_window_rect,
649 const blink::WebInputEvent* event) { 637 const blink::WebInputEvent* event) {
650 guest_window_rect_ = guest_window_rect;
651 // If the embedder's RWHV is destroyed then that means that the embedder's
652 // window has been closed but the embedder's WebContents has not yet been
653 // destroyed. Computing screen coordinates of a BrowserPlugin only makes sense
654 // if there is a visible embedder.
655 if (embedder_web_contents_->GetRenderWidgetHostView()) {
656 guest_screen_rect_ = guest_window_rect;
657 guest_screen_rect_.Offset(
658 embedder_web_contents_->GetRenderWidgetHostView()->
659 GetViewBounds().OffsetFromOrigin());
660 }
661 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( 638 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>(
662 GetWebContents()->GetRenderViewHost()); 639 GetWebContents()->GetRenderViewHost());
663 640
664 if (blink::WebInputEvent::isMouseEventType(event->type)) { 641 if (blink::WebInputEvent::isMouseEventType(event->type)) {
665 guest_rvh->ForwardMouseEvent( 642 guest_rvh->ForwardMouseEvent(
666 *static_cast<const blink::WebMouseEvent*>(event)); 643 *static_cast<const blink::WebMouseEvent*>(event));
667 return; 644 return;
668 } 645 }
669 646
670 if (event->type == blink::WebInputEvent::MouseWheel) { 647 if (event->type == blink::WebInputEvent::MouseWheel) {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 void BrowserPluginGuest::OnImeCompositionRangeChanged( 869 void BrowserPluginGuest::OnImeCompositionRangeChanged(
893 const gfx::Range& range, 870 const gfx::Range& range,
894 const std::vector<gfx::Rect>& character_bounds) { 871 const std::vector<gfx::Rect>& character_bounds) {
895 static_cast<RenderWidgetHostViewBase*>( 872 static_cast<RenderWidgetHostViewBase*>(
896 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 873 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
897 range, character_bounds); 874 range, character_bounds);
898 } 875 }
899 #endif 876 #endif
900 877
901 } // namespace content 878 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/frame_host/render_widget_host_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698