Index: content/browser/browser_plugin/browser_plugin_guest.cc |
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc |
index a5b7a189f03f484d1eadeb238fa53c09d1913e26..e17b12e83132a877362a2b17ed5787ca895b5d8d 100644 |
--- a/content/browser/browser_plugin/browser_plugin_guest.cc |
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc |
@@ -169,6 +169,10 @@ void BrowserPluginGuest::Initialize( |
const BrowserPluginHostMsg_Attach_Params& params, |
WebContentsImpl* embedder_web_contents, |
const base::DictionaryValue& extra_params) { |
+ // Once a BrowserPluginGuest has an embedder WebContents, it's considered to |
lazyboy
2014/07/07 21:34:45
Was there any particular reason to move this earli
Fady Samuel
2014/07/08 15:47:09
Done.
|
+ // be attached. |
+ embedder_web_contents_ = embedder_web_contents; |
+ |
focused_ = params.focused; |
guest_visible_ = params.visible; |
guest_opaque_ = params.opaque; |
@@ -179,10 +183,6 @@ void BrowserPluginGuest::Initialize( |
max_auto_size_ = params.auto_size_params.max_size; |
min_auto_size_ = params.auto_size_params.min_size; |
- // Once a BrowserPluginGuest has an embedder WebContents, it's considered to |
- // be attached. |
- embedder_web_contents_ = embedder_web_contents; |
- |
WebContentsViewGuest* new_view = |
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
new_view->OnGuestInitialized(embedder_web_contents->GetView()); |
@@ -292,6 +292,11 @@ BrowserPluginGuest::GetBrowserPluginGuestManager() const { |
gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) { |
gfx::Rect guest_rect(bounds); |
guest_rect.Offset(guest_window_rect_.OffsetFromOrigin()); |
+ if (embedder_web_contents()->GetBrowserPluginGuest()) { |
+ BrowserPluginGuest* embedder_guest = |
+ embedder_web_contents()->GetBrowserPluginGuest(); |
+ guest_rect.Offset(embedder_guest->guest_window_rect_.OffsetFromOrigin()); |
+ } |
return guest_rect; |
} |
@@ -311,8 +316,16 @@ WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
const gfx::Point& relative_position) const { |
+ if (!attached()) |
+ return gfx::Point(); |
lazyboy
2014/07/07 21:34:45
return relative_position;
Fady Samuel
2014/07/08 15:47:09
Done.
|
+ |
gfx::Point screen_pos(relative_position); |
screen_pos += guest_window_rect_.OffsetFromOrigin(); |
+ if (embedder_web_contents()->GetBrowserPluginGuest()) { |
+ BrowserPluginGuest* embedder_guest = |
+ embedder_web_contents()->GetBrowserPluginGuest(); |
+ screen_pos += embedder_guest->guest_window_rect_.OffsetFromOrigin(); |
+ } |
return screen_pos; |
} |