| 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/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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 return static_cast<WebContentsImpl*>(web_contents()); | 468 return static_cast<WebContentsImpl*>(web_contents()); |
| 469 } | 469 } |
| 470 | 470 |
| 471 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 471 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
| 472 const gfx::Point& relative_position) const { | 472 const gfx::Point& relative_position) const { |
| 473 if (!attached()) | 473 if (!attached()) |
| 474 return relative_position; | 474 return relative_position; |
| 475 | 475 |
| 476 gfx::Point screen_pos(relative_position); | 476 gfx::Point screen_pos(relative_position); |
| 477 screen_pos += guest_window_rect_.OffsetFromOrigin(); | 477 screen_pos += guest_window_rect_.OffsetFromOrigin(); |
| 478 if (embedder_web_contents()->GetBrowserPluginGuest()) { | |
| 479 BrowserPluginGuest* embedder_guest = | |
| 480 embedder_web_contents()->GetBrowserPluginGuest(); | |
| 481 screen_pos += embedder_guest->guest_window_rect_.OffsetFromOrigin(); | |
| 482 } | |
| 483 return screen_pos; | 478 return screen_pos; |
| 484 } | 479 } |
| 485 | 480 |
| 486 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { | 481 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { |
| 487 // During tests, attache() may be true when there is no owner_web_contents_; | 482 // During tests, attache() may be true when there is no owner_web_contents_; |
| 488 // in this case just queue any messages we receive. | 483 // in this case just queue any messages we receive. |
| 489 if (!attached() || !owner_web_contents_) { | 484 if (!attached() || !owner_web_contents_) { |
| 490 // Some pages such as data URLs, javascript URLs, and about:blank | 485 // Some pages such as data URLs, javascript URLs, and about:blank |
| 491 // do not load external resources and so they load prior to attachment. | 486 // do not load external resources and so they load prior to attachment. |
| 492 // As a result, we must save all these IPCs until attachment and then | 487 // As a result, we must save all these IPCs until attachment and then |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 983 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
| 989 const gfx::Range& range, | 984 const gfx::Range& range, |
| 990 const std::vector<gfx::Rect>& character_bounds) { | 985 const std::vector<gfx::Rect>& character_bounds) { |
| 991 static_cast<RenderWidgetHostViewBase*>( | 986 static_cast<RenderWidgetHostViewBase*>( |
| 992 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 987 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
| 993 range, character_bounds); | 988 range, character_bounds); |
| 994 } | 989 } |
| 995 #endif | 990 #endif |
| 996 | 991 |
| 997 } // namespace content | 992 } // namespace content |
| OLD | NEW |