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/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 window->parent() == view_->window_->GetRootWindow()) { | 551 window->parent() == view_->window_->GetRootWindow()) { |
552 UpdateConstrainedWindows(NULL); | 552 UpdateConstrainedWindows(NULL); |
553 } | 553 } |
554 } | 554 } |
555 #endif | 555 #endif |
556 | 556 |
557 virtual void OnWindowParentChanged(aura::Window* window, | 557 virtual void OnWindowParentChanged(aura::Window* window, |
558 aura::Window* parent) OVERRIDE { | 558 aura::Window* parent) OVERRIDE { |
559 if (window != view_->window_) | 559 if (window != view_->window_) |
560 return; | 560 return; |
561 | |
562 // Since all native views are hosted inside a clipping window, the actual | |
563 // parent that we care about is the clipping window's parent. | |
564 if (parent) | |
sky
2014/06/16 17:11:03
That a different parent exists is an implementatio
calamity
2014/06/17 05:01:12
Since this operates at the window level, I don't t
sky
2014/06/17 16:25:25
Neither of these options work since this code shou
| |
565 parent = parent->parent(); | |
566 | |
561 if (parent_) | 567 if (parent_) |
562 parent_->RemoveObserver(this); | 568 parent_->RemoveObserver(this); |
563 | 569 |
564 #if defined(OS_WIN) | 570 #if defined(OS_WIN) |
565 if (parent_) { | 571 if (parent_) { |
566 const aura::Window::Windows& children = parent_->children(); | 572 const aura::Window::Windows& children = parent_->children(); |
567 for (size_t i = 0; i < children.size(); ++i) | 573 for (size_t i = 0; i < children.size(); ++i) |
568 children[i]->RemoveObserver(this); | 574 children[i]->RemoveObserver(this); |
569 | 575 |
570 RenderWidgetHostViewAura* view = ToRenderWidgetHostViewAura( | 576 RenderWidgetHostViewAura* view = ToRenderWidgetHostViewAura( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 void UpdateConstrainedWindows(aura::Window* exclude) { | 672 void UpdateConstrainedWindows(aura::Window* exclude) { |
667 RenderWidgetHostViewAura* view = ToRenderWidgetHostViewAura( | 673 RenderWidgetHostViewAura* view = ToRenderWidgetHostViewAura( |
668 view_->web_contents_->GetRenderWidgetHostView()); | 674 view_->web_contents_->GetRenderWidgetHostView()); |
669 if (!view) | 675 if (!view) |
670 return; | 676 return; |
671 | 677 |
672 std::vector<gfx::Rect> constrained_windows; | 678 std::vector<gfx::Rect> constrained_windows; |
673 if (parent_) { | 679 if (parent_) { |
674 const aura::Window::Windows& children = parent_->children(); | 680 const aura::Window::Windows& children = parent_->children(); |
675 for (size_t i = 0; i < children.size(); ++i) { | 681 for (size_t i = 0; i < children.size(); ++i) { |
676 if (children[i] != view_->window_ && | 682 if (children[i] != view_->window_->parent() && |
677 children[i] != exclude && | 683 children[i] != exclude && |
678 children[i]->IsVisible()) { | 684 children[i]->IsVisible()) { |
679 constrained_windows.push_back(children[i]->GetBoundsInRootWindow()); | 685 constrained_windows.push_back(children[i]->GetBoundsInRootWindow()); |
680 } | 686 } |
681 } | 687 } |
682 } | 688 } |
683 | 689 |
684 aura::Window* root_window = view_->window_->GetRootWindow(); | 690 aura::Window* root_window = view_->window_->GetRootWindow(); |
685 const aura::Window::Windows& root_children = root_window->children(); | 691 const aura::Window::Windows& root_children = root_window->children(); |
686 if (root_window) { | 692 if (root_window) { |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1571 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, | 1577 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, |
1572 bool visible) { | 1578 bool visible) { |
1573 // Ignore any visibility changes in the hierarchy below. | 1579 // Ignore any visibility changes in the hierarchy below. |
1574 if (window != window_.get() && window_->Contains(window)) | 1580 if (window != window_.get() && window_->Contains(window)) |
1575 return; | 1581 return; |
1576 | 1582 |
1577 UpdateWebContentsVisibility(web_contents_, visible); | 1583 UpdateWebContentsVisibility(web_contents_, visible); |
1578 } | 1584 } |
1579 | 1585 |
1580 } // namespace content | 1586 } // namespace content |
OLD | NEW |