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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 757 |
758 // Overridden from aura::WindowObserver: | 758 // Overridden from aura::WindowObserver: |
759 #if defined(OS_WIN) | 759 #if defined(OS_WIN) |
760 // Constrained windows are added as children of the parent's parent's view | 760 // Constrained windows are added as children of the parent's parent's view |
761 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV | 761 // which may overlap with windowed NPAPI plugins. In that case, tell the RWHV |
762 // so that it can update the plugins' cutout rects accordingly. | 762 // so that it can update the plugins' cutout rects accordingly. |
763 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is | 763 // Note: this is hard coding how Chrome layer adds its dialogs. Since NPAPI is |
764 // going to be deprecated in a year, this is ok for now. The test for this is | 764 // going to be deprecated in a year, this is ok for now. The test for this is |
765 // PrintPreviewTest.WindowedNPAPIPluginHidden. | 765 // PrintPreviewTest.WindowedNPAPIPluginHidden. |
766 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE { | 766 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE { |
767 if (new_window == view_->window_) | 767 if (new_window != view_->window_) { |
768 return; | 768 // Skip the case when the parent moves to the root window. |
| 769 if (new_window != parent_) { |
| 770 // Observe sibling windows of the WebContents, or children of the root |
| 771 // window. |
| 772 if (new_window->parent() == parent_ || |
| 773 new_window->parent() == view_->window_->GetRootWindow()) { |
| 774 new_window->AddObserver(this); |
| 775 } |
| 776 } |
| 777 } |
769 | 778 |
770 if (new_window == parent_) | 779 if (new_window->parent() == parent_) { |
771 return; // This happens if the parent moves to the root window. | |
772 | |
773 // Observe sibling windows of the WebContents, or children of the root | |
774 // window. | |
775 if (new_window->parent() == parent_ || | |
776 new_window->parent() == view_->window_->GetRootWindow()) { | |
777 new_window->AddObserver(this); | |
778 UpdateConstrainedWindows(NULL); | 780 UpdateConstrainedWindows(NULL); |
779 } | 781 } |
780 } | 782 } |
781 | 783 |
782 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE { | 784 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE { |
783 if (window == view_->window_) | 785 if (window == view_->window_) |
784 return; | 786 return; |
785 | 787 |
786 window->RemoveObserver(this); | 788 window->RemoveObserver(this); |
787 UpdateConstrainedWindows(window); | 789 UpdateConstrainedWindows(window); |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 event.location(), | 1792 event.location(), |
1791 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1793 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1792 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1794 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1793 if (drag_dest_delegate_) | 1795 if (drag_dest_delegate_) |
1794 drag_dest_delegate_->OnDrop(); | 1796 drag_dest_delegate_->OnDrop(); |
1795 current_drop_data_.reset(); | 1797 current_drop_data_.reset(); |
1796 return current_drag_op_; | 1798 return current_drag_op_; |
1797 } | 1799 } |
1798 | 1800 |
1799 } // namespace content | 1801 } // namespace content |
OLD | NEW |