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/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 if (GetProp(window, kWidgetOwnerProperty) == widget) | 141 if (GetProp(window, kWidgetOwnerProperty) == widget) |
142 SetParent(window, ui::GetHiddenWindow()); | 142 SetParent(window, ui::GetHiddenWindow()); |
143 return TRUE; | 143 return TRUE; |
144 } | 144 } |
145 | 145 |
146 BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { | 146 BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { |
147 RenderWidgetHostViewAura* widget = | 147 RenderWidgetHostViewAura* widget = |
148 reinterpret_cast<RenderWidgetHostViewAura*>(param); | 148 reinterpret_cast<RenderWidgetHostViewAura*>(param); |
149 | 149 |
150 if (GetProp(window, kWidgetOwnerProperty) == widget && | 150 if (GetProp(window, kWidgetOwnerProperty) == widget && |
151 widget->GetNativeView()->GetDispatcher()) { | 151 widget->GetNativeView()->GetHost()) { |
152 HWND parent = widget->GetNativeView()->GetDispatcher()->host()-> | 152 HWND parent = widget->GetNativeView()->GetHost()->GetAcceleratedWidget(); |
153 GetAcceleratedWidget(); | |
154 SetParent(window, parent); | 153 SetParent(window, parent); |
155 } | 154 } |
156 return TRUE; | 155 return TRUE; |
157 } | 156 } |
158 | 157 |
159 struct CutoutRectsParams { | 158 struct CutoutRectsParams { |
160 RenderWidgetHostViewAura* widget; | 159 RenderWidgetHostViewAura* widget; |
161 std::vector<gfx::Rect> cutout_rects; | 160 std::vector<gfx::Rect> cutout_rects; |
162 std::map<HWND, WebPluginGeometry>* geometry; | 161 std::map<HWND, WebPluginGeometry>* geometry; |
163 }; | 162 }; |
164 | 163 |
165 // Used to update the region for the windowed plugin to draw in. We start with | 164 // Used to update the region for the windowed plugin to draw in. We start with |
166 // the clip rect from the renderer, then remove the cutout rects from the | 165 // the clip rect from the renderer, then remove the cutout rects from the |
167 // renderer, and then remove the transient windows from the root window and the | 166 // renderer, and then remove the transient windows from the root window and the |
168 // constrained windows from the parent window. | 167 // constrained windows from the parent window. |
169 BOOL CALLBACK SetCutoutRectsCallback(HWND window, LPARAM param) { | 168 BOOL CALLBACK SetCutoutRectsCallback(HWND window, LPARAM param) { |
170 CutoutRectsParams* params = reinterpret_cast<CutoutRectsParams*>(param); | 169 CutoutRectsParams* params = reinterpret_cast<CutoutRectsParams*>(param); |
171 | 170 |
172 if (GetProp(window, kWidgetOwnerProperty) == params->widget) { | 171 if (GetProp(window, kWidgetOwnerProperty) == params->widget) { |
173 // First calculate the offset of this plugin from the root window, since | 172 // First calculate the offset of this plugin from the root window, since |
174 // the cutouts are relative to the root window. | 173 // the cutouts are relative to the root window. |
175 HWND parent = params->widget->GetNativeView()->GetDispatcher()-> | 174 HWND parent = |
176 host()->GetAcceleratedWidget(); | 175 params->widget->GetNativeView()->GetHost()->GetAcceleratedWidget(); |
177 POINT offset; | 176 POINT offset; |
178 offset.x = offset.y = 0; | 177 offset.x = offset.y = 0; |
179 MapWindowPoints(window, parent, &offset, 1); | 178 MapWindowPoints(window, parent, &offset, 1); |
180 | 179 |
181 // Now get the cached clip rect and cutouts for this plugin window that came | 180 // Now get the cached clip rect and cutouts for this plugin window that came |
182 // from the renderer. | 181 // from the renderer. |
183 std::map<HWND, WebPluginGeometry>::iterator i = params->geometry->begin(); | 182 std::map<HWND, WebPluginGeometry>::iterator i = params->geometry->begin(); |
184 while (i != params->geometry->end() && | 183 while (i != params->geometry->end() && |
185 i->second.window != window && | 184 i->second.window != window && |
186 GetParent(i->second.window) != window) { | 185 GetParent(i->second.window) != window) { |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 released_front_lock_ = compositor->GetCompositorLock(); | 614 released_front_lock_ = compositor->GetCompositorLock(); |
616 } | 615 } |
617 | 616 |
618 #if defined(OS_WIN) | 617 #if defined(OS_WIN) |
619 if (legacy_render_widget_host_HWND_) { | 618 if (legacy_render_widget_host_HWND_) { |
620 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent | 619 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent |
621 // window before reparenting any plugins. This ensures that the plugin | 620 // window before reparenting any plugins. This ensures that the plugin |
622 // windows stay on top of the child Zorder in the parent and receive | 621 // windows stay on top of the child Zorder in the parent and receive |
623 // mouse events, etc. | 622 // mouse events, etc. |
624 legacy_render_widget_host_HWND_->UpdateParent( | 623 legacy_render_widget_host_HWND_->UpdateParent( |
625 GetNativeView()->GetDispatcher()->host()->GetAcceleratedWidget()); | 624 GetNativeView()->GetHost()->GetAcceleratedWidget()); |
626 legacy_render_widget_host_HWND_->SetBounds( | 625 legacy_render_widget_host_HWND_->SetBounds( |
627 window_->GetBoundsInRootWindow()); | 626 window_->GetBoundsInRootWindow()); |
628 } | 627 } |
629 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 628 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
630 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 629 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
631 #endif | 630 #endif |
632 } | 631 } |
633 | 632 |
634 void RenderWidgetHostViewAura::WasHidden() { | 633 void RenderWidgetHostViewAura::WasHidden() { |
635 if (!host_ || host_->is_hidden()) | 634 if (!host_ || host_->is_hidden()) |
636 return; | 635 return; |
637 host_->WasHidden(); | 636 host_->WasHidden(); |
638 software_frame_manager_->SetVisibility(false); | 637 software_frame_manager_->SetVisibility(false); |
639 delegated_frame_evictor_->SetVisible(false); | 638 delegated_frame_evictor_->SetVisible(false); |
640 released_front_lock_ = NULL; | 639 released_front_lock_ = NULL; |
641 | 640 |
642 #if defined(OS_WIN) | 641 #if defined(OS_WIN) |
643 constrained_rects_.clear(); | 642 constrained_rects_.clear(); |
644 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 643 aura::WindowTreeHost* host = window_->GetHost(); |
645 if (dispatcher) { | 644 if (host) { |
646 HWND parent = dispatcher->host()->GetAcceleratedWidget(); | 645 HWND parent = host->GetAcceleratedWidget(); |
647 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 646 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
648 EnumChildWindows(parent, HideWindowsCallback, lparam); | 647 EnumChildWindows(parent, HideWindowsCallback, lparam); |
649 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global | 648 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global |
650 // hidden window on the same lines as Windowed plugin windows. | 649 // hidden window on the same lines as Windowed plugin windows. |
651 if (legacy_render_widget_host_HWND_) | 650 if (legacy_render_widget_host_HWND_) |
652 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); | 651 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); |
653 } | 652 } |
654 #endif | 653 #endif |
655 } | 654 } |
656 | 655 |
(...skipping 18 matching lines...) Expand all Loading... |
675 window_->parent(), &relative_origin); | 674 window_->parent(), &relative_origin); |
676 } | 675 } |
677 } | 676 } |
678 | 677 |
679 InternalSetBounds(gfx::Rect(relative_origin, rect.size())); | 678 InternalSetBounds(gfx::Rect(relative_origin, rect.size())); |
680 } | 679 } |
681 | 680 |
682 void RenderWidgetHostViewAura::MaybeCreateResizeLock() { | 681 void RenderWidgetHostViewAura::MaybeCreateResizeLock() { |
683 if (!ShouldCreateResizeLock()) | 682 if (!ShouldCreateResizeLock()) |
684 return; | 683 return; |
685 DCHECK(window_->GetDispatcher()); | 684 DCHECK(window_->GetHost()); |
686 DCHECK(window_->GetDispatcher()->host()->compositor()); | 685 DCHECK(window_->GetHost()->compositor()); |
687 | 686 |
688 // Listen to changes in the compositor lock state. | 687 // Listen to changes in the compositor lock state. |
689 ui::Compositor* compositor = window_->GetDispatcher()->host()->compositor(); | 688 ui::Compositor* compositor = window_->GetHost()->compositor(); |
690 if (!compositor->HasObserver(this)) | 689 if (!compositor->HasObserver(this)) |
691 compositor->AddObserver(this); | 690 compositor->AddObserver(this); |
692 | 691 |
693 bool defer_compositor_lock = | 692 bool defer_compositor_lock = |
694 can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || | 693 can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
695 can_lock_compositor_ == NO_PENDING_COMMIT; | 694 can_lock_compositor_ == NO_PENDING_COMMIT; |
696 | 695 |
697 if (can_lock_compositor_ == YES) | 696 if (can_lock_compositor_ == YES) |
698 can_lock_compositor_ = YES_DID_LOCK; | 697 can_lock_compositor_ = YES_DID_LOCK; |
699 | 698 |
(...skipping 17 matching lines...) Expand all Loading... |
717 | 716 |
718 if (host_->should_auto_resize()) | 717 if (host_->should_auto_resize()) |
719 return false; | 718 return false; |
720 if (!host_->is_accelerated_compositing_active()) | 719 if (!host_->is_accelerated_compositing_active()) |
721 return false; | 720 return false; |
722 | 721 |
723 gfx::Size desired_size = window_->bounds().size(); | 722 gfx::Size desired_size = window_->bounds().size(); |
724 if (desired_size == current_frame_size_) | 723 if (desired_size == current_frame_size_) |
725 return false; | 724 return false; |
726 | 725 |
727 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 726 aura::WindowTreeHost* host = window_->GetHost(); |
728 if (!dispatcher) | 727 if (!host) |
729 return false; | 728 return false; |
730 | 729 |
731 ui::Compositor* compositor = dispatcher->host()->compositor(); | 730 ui::Compositor* compositor = host->compositor(); |
732 if (!compositor) | 731 if (!compositor) |
733 return false; | 732 return false; |
734 | 733 |
735 return true; | 734 return true; |
736 } | 735 } |
737 | 736 |
738 scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( | 737 scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( |
739 bool defer_compositor_lock) { | 738 bool defer_compositor_lock) { |
740 gfx::Size desired_size = window_->bounds().size(); | 739 gfx::Size desired_size = window_->bounds().size(); |
741 return scoped_ptr<ResizeLock>(new CompositorResizeLock( | 740 return scoped_ptr<ResizeLock>(new CompositorResizeLock( |
742 window_->GetDispatcher(), | 741 window_->GetHost()->dispatcher(), |
743 desired_size, | 742 desired_size, |
744 defer_compositor_lock, | 743 defer_compositor_lock, |
745 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); | 744 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); |
746 } | 745 } |
747 | 746 |
748 void RenderWidgetHostViewAura::RequestCopyOfOutput( | 747 void RenderWidgetHostViewAura::RequestCopyOfOutput( |
749 scoped_ptr<cc::CopyOutputRequest> request) { | 748 scoped_ptr<cc::CopyOutputRequest> request) { |
750 window_->layer()->RequestCopyOfOutput(request.Pass()); | 749 window_->layer()->RequestCopyOfOutput(request.Pass()); |
751 } | 750 } |
752 | 751 |
753 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 752 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
754 return window_; | 753 return window_; |
755 } | 754 } |
756 | 755 |
757 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { | 756 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { |
758 #if defined(OS_WIN) | 757 #if defined(OS_WIN) |
759 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 758 aura::WindowTreeHost* host = window_->GetHost(); |
760 if (dispatcher) | 759 if (host) |
761 return reinterpret_cast<gfx::NativeViewId>( | 760 return reinterpret_cast<gfx::NativeViewId>(host->GetAcceleratedWidget()); |
762 dispatcher->host()->GetAcceleratedWidget()); | |
763 #endif | 761 #endif |
764 return static_cast<gfx::NativeViewId>(NULL); | 762 return static_cast<gfx::NativeViewId>(NULL); |
765 } | 763 } |
766 | 764 |
767 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { | 765 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { |
768 #if defined(OS_WIN) | 766 #if defined(OS_WIN) |
769 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 767 aura::WindowTreeHost* host = window_->GetHost(); |
770 if (!dispatcher) | 768 if (!host) |
771 return static_cast<gfx::NativeViewAccessible>(NULL); | 769 return static_cast<gfx::NativeViewAccessible>(NULL); |
772 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); | 770 HWND hwnd = host->GetAcceleratedWidget(); |
773 | 771 |
774 CreateBrowserAccessibilityManagerIfNeeded(); | 772 CreateBrowserAccessibilityManagerIfNeeded(); |
775 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); | 773 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); |
776 if (manager) | 774 if (manager) |
777 return manager->GetRoot()->ToBrowserAccessibilityWin(); | 775 return manager->GetRoot()->ToBrowserAccessibilityWin(); |
778 #endif | 776 #endif |
779 | 777 |
780 NOTIMPLEMENTED(); | 778 NOTIMPLEMENTED(); |
781 return static_cast<gfx::NativeViewAccessible>(NULL); | 779 return static_cast<gfx::NativeViewAccessible>(NULL); |
782 } | 780 } |
783 | 781 |
784 void RenderWidgetHostViewAura::SetKeyboardFocus() { | 782 void RenderWidgetHostViewAura::SetKeyboardFocus() { |
785 #if defined(OS_WIN) | 783 #if defined(OS_WIN) |
786 if (CanFocus()) { | 784 if (CanFocus()) { |
787 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 785 aura::WindowTreeHost* host = window_->GetHost(); |
788 if (dispatcher) | 786 if (host) |
789 ::SetFocus(dispatcher->host()->GetAcceleratedWidget()); | 787 ::SetFocus(host->GetAcceleratedWidget()); |
790 } | 788 } |
791 #endif | 789 #endif |
792 } | 790 } |
793 | 791 |
794 void RenderWidgetHostViewAura::MovePluginWindows( | 792 void RenderWidgetHostViewAura::MovePluginWindows( |
795 const gfx::Vector2d& scroll_offset, | 793 const gfx::Vector2d& scroll_offset, |
796 const std::vector<WebPluginGeometry>& plugin_window_moves) { | 794 const std::vector<WebPluginGeometry>& plugin_window_moves) { |
797 #if defined(OS_WIN) | 795 #if defined(OS_WIN) |
798 // We need to clip the rectangle to the tab's viewport, otherwise we will draw | 796 // We need to clip the rectangle to the tab's viewport, otherwise we will draw |
799 // over the browser UI. | 797 // over the browser UI. |
800 if (!window_->GetRootWindow()) { | 798 if (!window_->GetRootWindow()) { |
801 DCHECK(plugin_window_moves.empty()); | 799 DCHECK(plugin_window_moves.empty()); |
802 return; | 800 return; |
803 } | 801 } |
804 HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); | 802 HWND parent = window_->GetHost()->GetAcceleratedWidget(); |
805 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); | 803 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); |
806 std::vector<WebPluginGeometry> moves = plugin_window_moves; | 804 std::vector<WebPluginGeometry> moves = plugin_window_moves; |
807 | 805 |
808 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), | 806 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), |
809 view_bounds.height()); | 807 view_bounds.height()); |
810 | 808 |
811 for (size_t i = 0; i < moves.size(); ++i) { | 809 for (size_t i = 0; i < moves.size(); ++i) { |
812 gfx::Rect clip(moves[i].clip_rect); | 810 gfx::Rect clip(moves[i].clip_rect); |
813 gfx::Vector2d view_port_offset( | 811 gfx::Vector2d view_port_offset( |
814 moves[i].window_rect.OffsetFromOrigin() + scroll_offset); | 812 moves[i].window_rect.OffsetFromOrigin() + scroll_offset); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 if (paint_canvas_) { | 977 if (paint_canvas_) { |
980 SkRect sk_clip_rect; | 978 SkRect sk_clip_rect; |
981 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) | 979 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) |
982 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect)); | 980 clip_rect = gfx::ToEnclosingRect(gfx::SkRectToRectF(sk_clip_rect)); |
983 } | 981 } |
984 | 982 |
985 if (!scroll_rect.IsEmpty()) | 983 if (!scroll_rect.IsEmpty()) |
986 SchedulePaintIfNotInClip(scroll_rect, clip_rect); | 984 SchedulePaintIfNotInClip(scroll_rect, clip_rect); |
987 | 985 |
988 #if defined(OS_WIN) | 986 #if defined(OS_WIN) |
989 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 987 aura::WindowTreeHost* host = window_->GetHost(); |
990 #endif | 988 #endif |
991 for (size_t i = 0; i < copy_rects.size(); ++i) { | 989 for (size_t i = 0; i < copy_rects.size(); ++i) { |
992 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); | 990 gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); |
993 if (rect.IsEmpty()) | 991 if (rect.IsEmpty()) |
994 continue; | 992 continue; |
995 | 993 |
996 SchedulePaintIfNotInClip(rect, clip_rect); | 994 SchedulePaintIfNotInClip(rect, clip_rect); |
997 | 995 |
998 #if defined(OS_WIN) | 996 #if defined(OS_WIN) |
999 if (dispatcher) { | 997 if (host) { |
1000 // Send the invalid rect in screen coordinates. | 998 // Send the invalid rect in screen coordinates. |
1001 gfx::Rect screen_rect = GetViewBounds(); | 999 gfx::Rect screen_rect = GetViewBounds(); |
1002 gfx::Rect invalid_screen_rect(rect); | 1000 gfx::Rect invalid_screen_rect(rect); |
1003 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); | 1001 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); |
1004 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); | 1002 HWND hwnd = host->GetAcceleratedWidget(); |
1005 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); | 1003 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); |
1006 } | 1004 } |
1007 #endif // defined(OS_WIN) | 1005 #endif // defined(OS_WIN) |
1008 } | 1006 } |
1009 } | 1007 } |
1010 | 1008 |
1011 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, | 1009 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, |
1012 int error_code) { | 1010 int error_code) { |
1013 UpdateCursorIfOverSelf(); | 1011 UpdateCursorIfOverSelf(); |
1014 Destroy(); | 1012 Destroy(); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 base::Bind(callback, present_time)); | 1358 base::Bind(callback, present_time)); |
1361 } | 1359 } |
1362 } | 1360 } |
1363 } | 1361 } |
1364 | 1362 |
1365 #if defined(OS_WIN) | 1363 #if defined(OS_WIN) |
1366 void RenderWidgetHostViewAura::UpdateConstrainedWindowRects( | 1364 void RenderWidgetHostViewAura::UpdateConstrainedWindowRects( |
1367 const std::vector<gfx::Rect>& rects) { | 1365 const std::vector<gfx::Rect>& rects) { |
1368 // Check this before setting constrained_rects_, so that next time they're set | 1366 // Check this before setting constrained_rects_, so that next time they're set |
1369 // and we have a root window we don't early return. | 1367 // and we have a root window we don't early return. |
1370 if (!window_->GetDispatcher()) | 1368 if (!window_->GetHost()) |
1371 return; | 1369 return; |
1372 | 1370 |
1373 if (rects == constrained_rects_) | 1371 if (rects == constrained_rects_) |
1374 return; | 1372 return; |
1375 | 1373 |
1376 constrained_rects_ = rects; | 1374 constrained_rects_ = rects; |
1377 | 1375 |
1378 HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); | 1376 HWND parent = window_->GetHost()->GetAcceleratedWidget(); |
1379 CutoutRectsParams params; | 1377 CutoutRectsParams params; |
1380 params.widget = this; | 1378 params.widget = this; |
1381 params.cutout_rects = constrained_rects_; | 1379 params.cutout_rects = constrained_rects_; |
1382 params.geometry = &plugin_window_moves_; | 1380 params.geometry = &plugin_window_moves_; |
1383 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); | 1381 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); |
1384 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 1382 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
1385 } | 1383 } |
1386 #endif | 1384 #endif |
1387 | 1385 |
1388 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 1386 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2135 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); | 2133 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); |
2136 } | 2134 } |
2137 | 2135 |
2138 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 2136 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
2139 #if defined(OS_WIN) | 2137 #if defined(OS_WIN) |
2140 // aura::Window::GetBoundsInScreen doesn't take non-client area into | 2138 // aura::Window::GetBoundsInScreen doesn't take non-client area into |
2141 // account. | 2139 // account. |
2142 RECT window_rect = {0}; | 2140 RECT window_rect = {0}; |
2143 | 2141 |
2144 aura::Window* top_level = window_->GetToplevelWindow(); | 2142 aura::Window* top_level = window_->GetToplevelWindow(); |
2145 aura::WindowEventDispatcher* dispatcher = top_level->GetDispatcher(); | 2143 aura::WindowTreeHost* host = top_level->GetHost(); |
2146 if (!dispatcher) | 2144 if (!host) |
2147 return top_level->GetBoundsInScreen(); | 2145 return top_level->GetBoundsInScreen(); |
2148 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); | 2146 HWND hwnd = host->GetAcceleratedWidget(); |
2149 ::GetWindowRect(hwnd, &window_rect); | 2147 ::GetWindowRect(hwnd, &window_rect); |
2150 gfx::Rect rect(window_rect); | 2148 gfx::Rect rect(window_rect); |
2151 | 2149 |
2152 // Maximized windows are outdented from the work area by the frame thickness | 2150 // Maximized windows are outdented from the work area by the frame thickness |
2153 // even though this "frame" is not painted. This confuses code (and people) | 2151 // even though this "frame" is not painted. This confuses code (and people) |
2154 // that think of a maximized window as corresponding exactly to the work area. | 2152 // that think of a maximized window as corresponding exactly to the work area. |
2155 // Correct for this by subtracting the frame thickness back off. | 2153 // Correct for this by subtracting the frame thickness back off. |
2156 if (::IsZoomed(hwnd)) { | 2154 if (::IsZoomed(hwnd)) { |
2157 rect.Inset(GetSystemMetrics(SM_CXSIZEFRAME), | 2155 rect.Inset(GetSystemMetrics(SM_CXSIZEFRAME), |
2158 GetSystemMetrics(SM_CYSIZEFRAME)); | 2156 GetSystemMetrics(SM_CYSIZEFRAME)); |
(...skipping 12 matching lines...) Expand all Loading... |
2171 touch_editing_client_->GestureEventAck(event.type); | 2169 touch_editing_client_->GestureEventAck(event.type); |
2172 } | 2170 } |
2173 | 2171 |
2174 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 2172 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
2175 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 2173 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
2176 ScopedVector<ui::TouchEvent> events; | 2174 ScopedVector<ui::TouchEvent> events; |
2177 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, | 2175 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, |
2178 SCREEN_COORDINATES)) | 2176 SCREEN_COORDINATES)) |
2179 return; | 2177 return; |
2180 | 2178 |
2181 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 2179 aura::WindowTreeHost* host = window_->GetHost(); |
2182 // |dispatcher| is NULL during tests. | 2180 // |dispatcher| is NULL during tests. |
2183 if (!dispatcher) | 2181 if (!host) |
2184 return; | 2182 return; |
2185 | 2183 |
2186 ui::EventResult result = (ack_result == | 2184 ui::EventResult result = (ack_result == |
2187 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; | 2185 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; |
2188 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), | 2186 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), |
2189 end = events.end(); iter != end; ++iter) { | 2187 end = events.end(); iter != end; ++iter) { |
2190 dispatcher->ProcessedTouchEvent((*iter), window_, result); | 2188 host->dispatcher()->ProcessedTouchEvent((*iter), window_, result); |
2191 } | 2189 } |
2192 } | 2190 } |
2193 | 2191 |
2194 scoped_ptr<SyntheticGestureTarget> | 2192 scoped_ptr<SyntheticGestureTarget> |
2195 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { | 2193 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { |
2196 return scoped_ptr<SyntheticGestureTarget>( | 2194 return scoped_ptr<SyntheticGestureTarget>( |
2197 new SyntheticGestureTargetAura(host_)); | 2195 new SyntheticGestureTargetAura(host_)); |
2198 } | 2196 } |
2199 | 2197 |
2200 void RenderWidgetHostViewAura::SetHasHorizontalScrollbar( | 2198 void RenderWidgetHostViewAura::SetHasHorizontalScrollbar( |
2201 bool has_horizontal_scrollbar) { | 2199 bool has_horizontal_scrollbar) { |
2202 // Not needed. Mac-only. | 2200 // Not needed. Mac-only. |
2203 } | 2201 } |
2204 | 2202 |
2205 void RenderWidgetHostViewAura::SetScrollOffsetPinning( | 2203 void RenderWidgetHostViewAura::SetScrollOffsetPinning( |
2206 bool is_pinned_to_left, bool is_pinned_to_right) { | 2204 bool is_pinned_to_left, bool is_pinned_to_right) { |
2207 // Not needed. Mac-only. | 2205 // Not needed. Mac-only. |
2208 } | 2206 } |
2209 | 2207 |
2210 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { | 2208 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { |
2211 if (GetBrowserAccessibilityManager()) | 2209 if (GetBrowserAccessibilityManager()) |
2212 return; | 2210 return; |
2213 | 2211 |
2214 BrowserAccessibilityManager* manager = NULL; | 2212 BrowserAccessibilityManager* manager = NULL; |
2215 #if defined(OS_WIN) | 2213 #if defined(OS_WIN) |
2216 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 2214 aura::WindowTreeHost* host = window_->GetHost(); |
2217 if (!dispatcher) | 2215 if (!host) |
2218 return; | 2216 return; |
2219 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); | 2217 HWND hwnd = host->GetAcceleratedWidget(); |
2220 | 2218 |
2221 // The accessible_parent may be NULL at this point. The WebContents will pass | 2219 // The accessible_parent may be NULL at this point. The WebContents will pass |
2222 // it down to this instance (by way of the RenderViewHost and | 2220 // it down to this instance (by way of the RenderViewHost and |
2223 // RenderWidgetHost) when it is known. This instance will then set it on its | 2221 // RenderWidgetHost) when it is known. This instance will then set it on its |
2224 // BrowserAccessibilityManager. | 2222 // BrowserAccessibilityManager. |
2225 gfx::NativeViewAccessible accessible_parent = | 2223 gfx::NativeViewAccessible accessible_parent = |
2226 host_->GetParentNativeViewAccessible(); | 2224 host_->GetParentNativeViewAccessible(); |
2227 | 2225 |
2228 if (legacy_render_widget_host_HWND_) { | 2226 if (legacy_render_widget_host_HWND_) { |
2229 manager = new BrowserAccessibilityManagerWin( | 2227 manager = new BrowserAccessibilityManagerWin( |
(...skipping 29 matching lines...) Expand all Loading... |
2259 cursor_client->HideCursor(); | 2257 cursor_client->HideCursor(); |
2260 cursor_client->LockCursor(); | 2258 cursor_client->LockCursor(); |
2261 } | 2259 } |
2262 | 2260 |
2263 if (ShouldMoveToCenter()) { | 2261 if (ShouldMoveToCenter()) { |
2264 synthetic_move_sent_ = true; | 2262 synthetic_move_sent_ = true; |
2265 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); | 2263 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); |
2266 } | 2264 } |
2267 tooltip_disabler_.reset(new aura::client::ScopedTooltipDisabler(root_window)); | 2265 tooltip_disabler_.reset(new aura::client::ScopedTooltipDisabler(root_window)); |
2268 | 2266 |
2269 root_window->GetDispatcher()->host()->ConfineCursorToRootWindow(); | 2267 root_window->GetHost()->ConfineCursorToRootWindow(); |
2270 return true; | 2268 return true; |
2271 } | 2269 } |
2272 | 2270 |
2273 void RenderWidgetHostViewAura::UnlockMouse() { | 2271 void RenderWidgetHostViewAura::UnlockMouse() { |
2274 tooltip_disabler_.reset(); | 2272 tooltip_disabler_.reset(); |
2275 | 2273 |
2276 aura::Window* root_window = window_->GetRootWindow(); | 2274 aura::Window* root_window = window_->GetRootWindow(); |
2277 if (!mouse_locked_ || !root_window) | 2275 if (!mouse_locked_ || !root_window) |
2278 return; | 2276 return; |
2279 | 2277 |
2280 mouse_locked_ = false; | 2278 mouse_locked_ = false; |
2281 | 2279 |
2282 #if !defined(OS_WIN) | 2280 #if !defined(OS_WIN) |
2283 window_->ReleaseCapture(); | 2281 window_->ReleaseCapture(); |
2284 #endif | 2282 #endif |
2285 window_->MoveCursorTo(unlocked_mouse_position_); | 2283 window_->MoveCursorTo(unlocked_mouse_position_); |
2286 aura::client::CursorClient* cursor_client = | 2284 aura::client::CursorClient* cursor_client = |
2287 aura::client::GetCursorClient(root_window); | 2285 aura::client::GetCursorClient(root_window); |
2288 if (cursor_client) { | 2286 if (cursor_client) { |
2289 cursor_client->UnlockCursor(); | 2287 cursor_client->UnlockCursor(); |
2290 cursor_client->ShowCursor(); | 2288 cursor_client->ShowCursor(); |
2291 } | 2289 } |
2292 | 2290 |
2293 host_->LostMouseLock(); | 2291 host_->LostMouseLock(); |
2294 root_window->GetDispatcher()->host()->UnConfineCursor(); | 2292 root_window->GetHost()->UnConfineCursor(); |
2295 } | 2293 } |
2296 | 2294 |
2297 //////////////////////////////////////////////////////////////////////////////// | 2295 //////////////////////////////////////////////////////////////////////////////// |
2298 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | 2296 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
2299 void RenderWidgetHostViewAura::SetCompositionText( | 2297 void RenderWidgetHostViewAura::SetCompositionText( |
2300 const ui::CompositionText& composition) { | 2298 const ui::CompositionText& composition) { |
2301 if (!host_) | 2299 if (!host_) |
2302 return; | 2300 return; |
2303 | 2301 |
2304 // ui::CompositionUnderline should be identical to | 2302 // ui::CompositionUnderline should be identical to |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 } | 2653 } |
2656 | 2654 |
2657 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { | 2655 void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { |
2658 #if defined(OS_WIN) | 2656 #if defined(OS_WIN) |
2659 HWND parent = NULL; | 2657 HWND parent = NULL; |
2660 // If the tab was hidden and it's closed, host_->is_hidden would have been | 2658 // If the tab was hidden and it's closed, host_->is_hidden would have been |
2661 // reset to false in RenderWidgetHostImpl::RendererExited. | 2659 // reset to false in RenderWidgetHostImpl::RendererExited. |
2662 if (!window_->GetRootWindow() || host_->is_hidden()) { | 2660 if (!window_->GetRootWindow() || host_->is_hidden()) { |
2663 parent = ui::GetHiddenWindow(); | 2661 parent = ui::GetHiddenWindow(); |
2664 } else { | 2662 } else { |
2665 parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); | 2663 parent = window_->GetHost()->GetAcceleratedWidget(); |
2666 } | 2664 } |
2667 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 2665 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
2668 EnumChildWindows(parent, WindowDestroyingCallback, lparam); | 2666 EnumChildWindows(parent, WindowDestroyingCallback, lparam); |
2669 #endif | 2667 #endif |
2670 | 2668 |
2671 // Make sure that the input method no longer references to this object before | 2669 // Make sure that the input method no longer references to this object before |
2672 // this object is removed from the root window (i.e. this object loses access | 2670 // this object is removed from the root window (i.e. this object loses access |
2673 // to the input method). | 2671 // to the input method). |
2674 ui::InputMethod* input_method = GetInputMethod(); | 2672 ui::InputMethod* input_method = GetInputMethod(); |
2675 if (input_method) | 2673 if (input_method) |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2882 event->type() == ui::ET_MOUSE_MOVED)) { | 2880 event->type() == ui::ET_MOUSE_MOVED)) { |
2883 event->StopPropagation(); | 2881 event->StopPropagation(); |
2884 return; | 2882 return; |
2885 } | 2883 } |
2886 | 2884 |
2887 if (event->type() == ui::ET_MOUSEWHEEL) { | 2885 if (event->type() == ui::ET_MOUSEWHEEL) { |
2888 #if defined(OS_WIN) | 2886 #if defined(OS_WIN) |
2889 // We get mouse wheel/scroll messages even if we are not in the foreground. | 2887 // We get mouse wheel/scroll messages even if we are not in the foreground. |
2890 // So here we check if we have any owned popup windows in the foreground and | 2888 // So here we check if we have any owned popup windows in the foreground and |
2891 // dismiss them. | 2889 // dismiss them. |
2892 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 2890 aura::WindowTreeHost* host = window_->GetHost(); |
2893 if (dispatcher) { | 2891 if (host) { |
2894 HWND parent = dispatcher->host()->GetAcceleratedWidget(); | 2892 HWND parent = host->GetAcceleratedWidget(); |
2895 HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); | 2893 HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); |
2896 EnumThreadWindows(GetCurrentThreadId(), | 2894 EnumThreadWindows(GetCurrentThreadId(), |
2897 DismissOwnedPopups, | 2895 DismissOwnedPopups, |
2898 reinterpret_cast<LPARAM>(toplevel_hwnd)); | 2896 reinterpret_cast<LPARAM>(toplevel_hwnd)); |
2899 } | 2897 } |
2900 #endif | 2898 #endif |
2901 blink::WebMouseWheelEvent mouse_wheel_event = | 2899 blink::WebMouseWheelEvent mouse_wheel_event = |
2902 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); | 2900 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); |
2903 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 2901 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
2904 host_->ForwardWheelEvent(mouse_wheel_event); | 2902 host_->ForwardWheelEvent(mouse_wheel_event); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3049 | 3047 |
3050 // If a gesture is not processed by the webpage, then WebKit processes it | 3048 // If a gesture is not processed by the webpage, then WebKit processes it |
3051 // (e.g. generates synthetic mouse events). | 3049 // (e.g. generates synthetic mouse events). |
3052 event->SetHandled(); | 3050 event->SetHandled(); |
3053 } | 3051 } |
3054 | 3052 |
3055 //////////////////////////////////////////////////////////////////////////////// | 3053 //////////////////////////////////////////////////////////////////////////////// |
3056 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: | 3054 // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: |
3057 | 3055 |
3058 bool RenderWidgetHostViewAura::ShouldActivate() const { | 3056 bool RenderWidgetHostViewAura::ShouldActivate() const { |
3059 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 3057 aura::WindowTreeHost* host = window_->GetHost(); |
3060 if (!dispatcher) | 3058 if (!host) |
3061 return true; | 3059 return true; |
3062 const ui::Event* event = dispatcher->current_event(); | 3060 const ui::Event* event = host->dispatcher()->current_event(); |
3063 if (!event) | 3061 if (!event) |
3064 return true; | 3062 return true; |
3065 return is_fullscreen_; | 3063 return is_fullscreen_; |
3066 } | 3064 } |
3067 | 3065 |
3068 //////////////////////////////////////////////////////////////////////////////// | 3066 //////////////////////////////////////////////////////////////////////////////// |
3069 // RenderWidgetHostViewAura, | 3067 // RenderWidgetHostViewAura, |
3070 // aura::client::ActivationChangeObserver implementation: | 3068 // aura::client::ActivationChangeObserver implementation: |
3071 | 3069 |
3072 void RenderWidgetHostViewAura::OnWindowActivated(aura::Window* gained_active, | 3070 void RenderWidgetHostViewAura::OnWindowActivated(aura::Window* gained_active, |
3073 aura::Window* lost_active) { | 3071 aura::Window* lost_active) { |
3074 DCHECK(window_ == gained_active || window_ == lost_active); | 3072 DCHECK(window_ == gained_active || window_ == lost_active); |
3075 if (window_ == gained_active) { | 3073 if (window_ == gained_active) { |
3076 const ui::Event* event = window_->GetDispatcher()->current_event(); | 3074 const ui::Event* event = window_->GetHost()->dispatcher()->current_event(); |
3077 if (event && PointerEventActivates(*event)) | 3075 if (event && PointerEventActivates(*event)) |
3078 host_->OnPointerEventActivate(); | 3076 host_->OnPointerEventActivate(); |
3079 } | 3077 } |
3080 } | 3078 } |
3081 | 3079 |
3082 //////////////////////////////////////////////////////////////////////////////// | 3080 //////////////////////////////////////////////////////////////////////////////// |
3083 // RenderWidgetHostViewAura, aura::client::CursorClientObserver implementation: | 3081 // RenderWidgetHostViewAura, aura::client::CursorClientObserver implementation: |
3084 | 3082 |
3085 void RenderWidgetHostViewAura::OnCursorVisibilityChanged(bool is_visible) { | 3083 void RenderWidgetHostViewAura::OnCursorVisibilityChanged(bool is_visible) { |
3086 NotifyRendererOfCursorVisibilityState(is_visible); | 3084 NotifyRendererOfCursorVisibilityState(is_visible); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3303 //////////////////////////////////////////////////////////////////////////////// | 3301 //////////////////////////////////////////////////////////////////////////////// |
3304 // RenderWidgetHostViewAura, private: | 3302 // RenderWidgetHostViewAura, private: |
3305 | 3303 |
3306 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 3304 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
3307 if (touch_editing_client_) | 3305 if (touch_editing_client_) |
3308 touch_editing_client_->OnViewDestroyed(); | 3306 touch_editing_client_->OnViewDestroyed(); |
3309 | 3307 |
3310 ImageTransportFactory::GetInstance()->RemoveObserver(this); | 3308 ImageTransportFactory::GetInstance()->RemoveObserver(this); |
3311 | 3309 |
3312 window_observer_.reset(); | 3310 window_observer_.reset(); |
3313 if (window_->GetDispatcher()) | 3311 if (window_->GetHost()) |
3314 window_->GetDispatcher()->RemoveRootWindowObserver(this); | 3312 window_->GetHost()->dispatcher()->RemoveRootWindowObserver(this); |
3315 UnlockMouse(); | 3313 UnlockMouse(); |
3316 if (popup_parent_host_view_) { | 3314 if (popup_parent_host_view_) { |
3317 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 3315 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
3318 popup_parent_host_view_->popup_child_host_view_ == this); | 3316 popup_parent_host_view_->popup_child_host_view_ == this); |
3319 popup_parent_host_view_->popup_child_host_view_ = NULL; | 3317 popup_parent_host_view_->popup_child_host_view_ = NULL; |
3320 } | 3318 } |
3321 if (popup_child_host_view_) { | 3319 if (popup_child_host_view_) { |
3322 DCHECK(popup_child_host_view_->popup_parent_host_view_ == NULL || | 3320 DCHECK(popup_child_host_view_->popup_parent_host_view_ == NULL || |
3323 popup_child_host_view_->popup_parent_host_view_ == this); | 3321 popup_child_host_view_->popup_parent_host_view_ == this); |
3324 popup_child_host_view_->popup_parent_host_view_ = NULL; | 3322 popup_child_host_view_->popup_parent_host_view_ = NULL; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3487 DCHECK(compositor); | 3485 DCHECK(compositor); |
3488 | 3486 |
3489 if (!compositor->HasObserver(this)) | 3487 if (!compositor->HasObserver(this)) |
3490 compositor->AddObserver(this); | 3488 compositor->AddObserver(this); |
3491 | 3489 |
3492 can_lock_compositor_ = NO_PENDING_COMMIT; | 3490 can_lock_compositor_ = NO_PENDING_COMMIT; |
3493 on_compositing_did_commit_callbacks_.push_back(callback); | 3491 on_compositing_did_commit_callbacks_.push_back(callback); |
3494 } | 3492 } |
3495 | 3493 |
3496 void RenderWidgetHostViewAura::AddedToRootWindow() { | 3494 void RenderWidgetHostViewAura::AddedToRootWindow() { |
3497 window_->GetDispatcher()->AddRootWindowObserver(this); | 3495 window_->GetHost()->dispatcher()->AddRootWindowObserver(this); |
3498 UpdateScreenInfo(window_); | 3496 UpdateScreenInfo(window_); |
3499 | 3497 |
3500 aura::client::CursorClient* cursor_client = | 3498 aura::client::CursorClient* cursor_client = |
3501 aura::client::GetCursorClient(window_->GetRootWindow()); | 3499 aura::client::GetCursorClient(window_->GetRootWindow()); |
3502 if (cursor_client) { | 3500 if (cursor_client) { |
3503 cursor_client->AddObserver(this); | 3501 cursor_client->AddObserver(this); |
3504 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 3502 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
3505 } | 3503 } |
3506 if (current_surface_.get()) | 3504 if (current_surface_.get()) |
3507 UpdateExternalTexture(); | 3505 UpdateExternalTexture(); |
(...skipping 20 matching lines...) Expand all Loading... |
3528 } | 3526 } |
3529 | 3527 |
3530 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 3528 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
3531 aura::client::CursorClient* cursor_client = | 3529 aura::client::CursorClient* cursor_client = |
3532 aura::client::GetCursorClient(window_->GetRootWindow()); | 3530 aura::client::GetCursorClient(window_->GetRootWindow()); |
3533 if (cursor_client) | 3531 if (cursor_client) |
3534 cursor_client->RemoveObserver(this); | 3532 cursor_client->RemoveObserver(this); |
3535 | 3533 |
3536 DetachFromInputMethod(); | 3534 DetachFromInputMethod(); |
3537 | 3535 |
3538 window_->GetDispatcher()->RemoveRootWindowObserver(this); | 3536 window_->GetHost()->dispatcher()->RemoveRootWindowObserver(this); |
3539 ui::Compositor* compositor = GetCompositor(); | 3537 ui::Compositor* compositor = GetCompositor(); |
3540 if (current_surface_.get()) { | 3538 if (current_surface_.get()) { |
3541 // We can't get notification for commits after this point, which would | 3539 // We can't get notification for commits after this point, which would |
3542 // guarantee that the compositor isn't using an old texture any more, so | 3540 // guarantee that the compositor isn't using an old texture any more, so |
3543 // instead we force the layer to stop using any external resources which | 3541 // instead we force the layer to stop using any external resources which |
3544 // synchronizes with the compositor thread, and makes it safe to run the | 3542 // synchronizes with the compositor thread, and makes it safe to run the |
3545 // callback. | 3543 // callback. |
3546 window_->layer()->SetShowPaintedContent(); | 3544 window_->layer()->SetShowPaintedContent(); |
3547 } | 3545 } |
3548 RunOnCommitCallbacks(); | 3546 RunOnCommitCallbacks(); |
(...skipping 10 matching lines...) Expand all Loading... |
3559 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); | 3557 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); |
3560 #endif | 3558 #endif |
3561 | 3559 |
3562 if (vsync_manager_) { | 3560 if (vsync_manager_) { |
3563 vsync_manager_->RemoveObserver(this); | 3561 vsync_manager_->RemoveObserver(this); |
3564 vsync_manager_ = NULL; | 3562 vsync_manager_ = NULL; |
3565 } | 3563 } |
3566 } | 3564 } |
3567 | 3565 |
3568 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { | 3566 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { |
3569 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 3567 aura::WindowTreeHost* host = window_->GetHost(); |
3570 return dispatcher ? dispatcher->host()->compositor() : NULL; | 3568 return host ? host->compositor() : NULL; |
3571 } | 3569 } |
3572 | 3570 |
3573 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 3571 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
3574 ui::InputMethod* input_method = GetInputMethod(); | 3572 ui::InputMethod* input_method = GetInputMethod(); |
3575 if (input_method && input_method->GetTextInputClient() == this) | 3573 if (input_method && input_method->GetTextInputClient() == this) |
3576 input_method->SetFocusedTextInputClient(NULL); | 3574 input_method->SetFocusedTextInputClient(NULL); |
3577 } | 3575 } |
3578 | 3576 |
3579 void RenderWidgetHostViewAura::LockResources() { | 3577 void RenderWidgetHostViewAura::LockResources() { |
3580 DCHECK(frame_provider_); | 3578 DCHECK(frame_provider_); |
(...skipping 13 matching lines...) Expand all Loading... |
3594 RenderWidgetHost* widget) { | 3592 RenderWidgetHost* widget) { |
3595 return new RenderWidgetHostViewAura(widget); | 3593 return new RenderWidgetHostViewAura(widget); |
3596 } | 3594 } |
3597 | 3595 |
3598 // static | 3596 // static |
3599 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3597 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3600 GetScreenInfoForWindow(results, NULL); | 3598 GetScreenInfoForWindow(results, NULL); |
3601 } | 3599 } |
3602 | 3600 |
3603 } // namespace content | 3601 } // namespace content |
OLD | NEW |