Index: content/browser/web_contents/web_contents_view_aura.cc |
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc |
index a05111f2d7507dc6f6c8af26c4139dafa3cd06fc..1b767fb454834a9564df35a0b5dd68a4684fc88d 100644 |
--- a/content/browser/web_contents/web_contents_view_aura.cc |
+++ b/content/browser/web_contents/web_contents_view_aura.cc |
@@ -764,17 +764,19 @@ class WebContentsViewAura::WindowObserver |
// going to be deprecated in a year, this is ok for now. The test for this is |
// PrintPreviewTest.WindowedNPAPIPluginHidden. |
virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE { |
- if (new_window == view_->window_) |
- return; |
- |
- if (new_window == parent_) |
- return; // This happens if the parent moves to the root window. |
+ if (new_window != view_->window_) { |
+ // Skip the case when the parent moves to the root window. |
+ if (new_window != parent_) { |
+ // Observe sibling windows of the WebContents, or children of the root |
+ // window. |
+ if (new_window->parent() == parent_ || |
+ new_window->parent() == view_->window_->GetRootWindow()) { |
+ new_window->AddObserver(this); |
+ } |
+ } |
+ } |
- // Observe sibling windows of the WebContents, or children of the root |
- // window. |
- if (new_window->parent() == parent_ || |
- new_window->parent() == view_->window_->GetRootWindow()) { |
- new_window->AddObserver(this); |
+ if (new_window->parent() == parent_) { |
UpdateConstrainedWindows(NULL); |
} |
} |