| 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 52e7b01a0bf7d459a45660fa93bac65330671570..db7b056258fd12016931be08ab10bd15306b8836 100644
|
| --- a/content/browser/web_contents/web_contents_view_aura.cc
|
| +++ b/content/browser/web_contents/web_contents_view_aura.cc
|
| @@ -477,7 +477,7 @@
|
| public:
|
| explicit WindowObserver(WebContentsViewAura* view)
|
| : view_(view),
|
| - host_window_(NULL) {
|
| + parent_(NULL) {
|
| view_->window_->AddObserver(this);
|
|
|
| #if defined(OS_WIN)
|
| @@ -490,11 +490,12 @@
|
| view_->window_->RemoveObserver(this);
|
| if (view_->window_->GetHost())
|
| view_->window_->GetHost()->RemoveObserver(this);
|
| - if (host_window_)
|
| - host_window_->RemoveObserver(this);
|
| + if (parent_)
|
| + parent_->RemoveObserver(this);
|
| +
|
| #if defined(OS_WIN)
|
| - if (host_window_) {
|
| - const aura::Window::Windows& children = host_window_->children();
|
| + if (parent_) {
|
| + const aura::Window::Windows& children = parent_->children();
|
| for (size_t i = 0; i < children.size(); ++i)
|
| children[i]->RemoveObserver(this);
|
| }
|
| @@ -518,19 +519,19 @@
|
| // 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->Contains(view_->window_.get())) {
|
| + if (new_window != view_->window_) {
|
| // Skip the case when the parent moves to the root window.
|
| - if (new_window != host_window_) {
|
| + if (new_window != parent_) {
|
| // Observe sibling windows of the WebContents, or children of the root
|
| // window.
|
| - if (new_window->parent() == host_window_ ||
|
| + if (new_window->parent() == parent_ ||
|
| new_window->parent() == view_->window_->GetRootWindow()) {
|
| new_window->AddObserver(this);
|
| }
|
| }
|
| }
|
|
|
| - if (new_window->parent() == host_window_) {
|
| + if (new_window->parent() == parent_) {
|
| UpdateConstrainedWindows(NULL);
|
| }
|
| }
|
| @@ -546,7 +547,7 @@
|
| virtual void OnWindowVisibilityChanged(aura::Window* window,
|
| bool visible) OVERRIDE {
|
| if (window == view_->window_ ||
|
| - window->parent() == host_window_ ||
|
| + window->parent() == parent_ ||
|
| window->parent() == view_->window_->GetRootWindow()) {
|
| UpdateConstrainedWindows(NULL);
|
| }
|
| @@ -557,18 +558,12 @@
|
| aura::Window* parent) OVERRIDE {
|
| if (window != view_->window_)
|
| return;
|
| -
|
| - aura::Window* host_window =
|
| - window->GetProperty(aura::client::kHostWindowKey);
|
| - if (!host_window)
|
| - host_window = parent;
|
| -
|
| - if (host_window_)
|
| - host_window_->RemoveObserver(this);
|
| + if (parent_)
|
| + parent_->RemoveObserver(this);
|
|
|
| #if defined(OS_WIN)
|
| - if (host_window_) {
|
| - const aura::Window::Windows& children = host_window_->children();
|
| + if (parent_) {
|
| + const aura::Window::Windows& children = parent_->children();
|
| for (size_t i = 0; i < children.size(); ++i)
|
| children[i]->RemoveObserver(this);
|
|
|
| @@ -579,29 +574,29 @@
|
| }
|
|
|
| // When we get parented to the root window, the code below will watch the
|
| - // host window, aka root window. Since we already watch the root window on
|
| + // parent, aka root window. Since we already watch the root window on
|
| // Windows, unregister first so that the debug check doesn't fire.
|
| - if (host_window && host_window == window->GetRootWindow())
|
| - host_window->RemoveObserver(this);
|
| + if (parent && parent == window->GetRootWindow())
|
| + parent->RemoveObserver(this);
|
|
|
| // We need to undo the above if we were parented to the root window and then
|
| // got parented to another window. At that point, the code before the ifdef
|
| // would have stopped watching the root window.
|
| if (window->GetRootWindow() &&
|
| - host_window != window->GetRootWindow() &&
|
| + parent != window->GetRootWindow() &&
|
| !window->GetRootWindow()->HasObserver(this)) {
|
| window->GetRootWindow()->AddObserver(this);
|
| }
|
| #endif
|
|
|
| - host_window_ = host_window;
|
| - if (host_window) {
|
| - host_window->AddObserver(this);
|
| + parent_ = parent;
|
| + if (parent) {
|
| + parent->AddObserver(this);
|
| #if defined(OS_WIN)
|
| - if (host_window != window->GetRootWindow()) {
|
| - const aura::Window::Windows& children = host_window->children();
|
| + if (parent != window->GetRootWindow()) {
|
| + const aura::Window::Windows& children = parent->children();
|
| for (size_t i = 0; i < children.size(); ++i) {
|
| - if (!children[i]->Contains(view_->window_.get()))
|
| + if (children[i] != view_->window_)
|
| children[i]->AddObserver(this);
|
| }
|
| }
|
| @@ -612,7 +607,7 @@
|
| virtual void OnWindowBoundsChanged(aura::Window* window,
|
| const gfx::Rect& old_bounds,
|
| const gfx::Rect& new_bounds) OVERRIDE {
|
| - if (window == host_window_ || window == view_->window_) {
|
| + if (window == parent_ || window == view_->window_) {
|
| SendScreenRects();
|
| if (view_->touch_editable_)
|
| view_->touch_editable_->UpdateEditingController();
|
| @@ -643,10 +638,8 @@
|
| const aura::Window::Windows& root_children =
|
| window->GetRootWindow()->children();
|
| for (size_t i = 0; i < root_children.size(); ++i) {
|
| - if (root_children[i] != view_->window_ &&
|
| - root_children[i] != host_window_) {
|
| + if (root_children[i] != view_->window_ && root_children[i] != parent_)
|
| root_children[i]->RemoveObserver(this);
|
| - }
|
| }
|
| #endif
|
| }
|
| @@ -677,10 +670,10 @@
|
| return;
|
|
|
| std::vector<gfx::Rect> constrained_windows;
|
| - if (host_window_) {
|
| - const aura::Window::Windows& children = host_window_->children();
|
| + if (parent_) {
|
| + const aura::Window::Windows& children = parent_->children();
|
| for (size_t i = 0; i < children.size(); ++i) {
|
| - if (!children[i]->Contains(view_->window_.get()) &&
|
| + if (children[i] != view_->window_ &&
|
| children[i] != exclude &&
|
| children[i]->IsVisible()) {
|
| constrained_windows.push_back(children[i]->GetBoundsInRootWindow());
|
| @@ -706,9 +699,9 @@
|
|
|
| WebContentsViewAura* view_;
|
|
|
| - // The parent window that hosts the constrained windows. We cache the old host
|
| - // view so that we can unregister when it's not the parent anymore.
|
| - aura::Window* host_window_;
|
| + // We cache the old parent so that we can unregister when it's not the parent
|
| + // anymore.
|
| + aura::Window* parent_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WindowObserver);
|
| };
|
|
|