| 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 if (GetProp(window, kWidgetOwnerProperty) == widget) | 137 if (GetProp(window, kWidgetOwnerProperty) == widget) |
| 138 SetParent(window, ui::GetHiddenWindow()); | 138 SetParent(window, ui::GetHiddenWindow()); |
| 139 return TRUE; | 139 return TRUE; |
| 140 } | 140 } |
| 141 | 141 |
| 142 BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { | 142 BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { |
| 143 RenderWidgetHostViewAura* widget = | 143 RenderWidgetHostViewAura* widget = |
| 144 reinterpret_cast<RenderWidgetHostViewAura*>(param); | 144 reinterpret_cast<RenderWidgetHostViewAura*>(param); |
| 145 | 145 |
| 146 if (GetProp(window, kWidgetOwnerProperty) == widget) { | 146 if (GetProp(window, kWidgetOwnerProperty) == widget) { |
| 147 HWND parent = | 147 HWND parent = widget->GetNativeView()->GetDispatcher()->host()-> |
| 148 widget->GetNativeView()->GetDispatcher()->GetAcceleratedWidget(); | 148 GetAcceleratedWidget(); |
| 149 SetParent(window, parent); | 149 SetParent(window, parent); |
| 150 } | 150 } |
| 151 return TRUE; | 151 return TRUE; |
| 152 } | 152 } |
| 153 | 153 |
| 154 struct CutoutRectsParams { | 154 struct CutoutRectsParams { |
| 155 RenderWidgetHostViewAura* widget; | 155 RenderWidgetHostViewAura* widget; |
| 156 std::vector<gfx::Rect> cutout_rects; | 156 std::vector<gfx::Rect> cutout_rects; |
| 157 std::map<HWND, WebPluginGeometry>* geometry; | 157 std::map<HWND, WebPluginGeometry>* geometry; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 // Used to update the region for the windowed plugin to draw in. We start with | 160 // Used to update the region for the windowed plugin to draw in. We start with |
| 161 // the clip rect from the renderer, then remove the cutout rects from the | 161 // the clip rect from the renderer, then remove the cutout rects from the |
| 162 // renderer, and then remove the transient windows from the root window and the | 162 // renderer, and then remove the transient windows from the root window and the |
| 163 // constrained windows from the parent window. | 163 // constrained windows from the parent window. |
| 164 BOOL CALLBACK SetCutoutRectsCallback(HWND window, LPARAM param) { | 164 BOOL CALLBACK SetCutoutRectsCallback(HWND window, LPARAM param) { |
| 165 CutoutRectsParams* params = reinterpret_cast<CutoutRectsParams*>(param); | 165 CutoutRectsParams* params = reinterpret_cast<CutoutRectsParams*>(param); |
| 166 | 166 |
| 167 if (GetProp(window, kWidgetOwnerProperty) == params->widget) { | 167 if (GetProp(window, kWidgetOwnerProperty) == params->widget) { |
| 168 // First calculate the offset of this plugin from the root window, since | 168 // First calculate the offset of this plugin from the root window, since |
| 169 // the cutouts are relative to the root window. | 169 // the cutouts are relative to the root window. |
| 170 HWND parent = params->widget->GetNativeView()->GetDispatcher()-> | 170 HWND parent = params->widget->GetNativeView()->GetDispatcher()-> |
| 171 GetAcceleratedWidget(); | 171 host()->GetAcceleratedWidget(); |
| 172 POINT offset; | 172 POINT offset; |
| 173 offset.x = offset.y = 0; | 173 offset.x = offset.y = 0; |
| 174 MapWindowPoints(window, parent, &offset, 1); | 174 MapWindowPoints(window, parent, &offset, 1); |
| 175 | 175 |
| 176 // Now get the cached clip rect and cutouts for this plugin window that came | 176 // Now get the cached clip rect and cutouts for this plugin window that came |
| 177 // from the renderer. | 177 // from the renderer. |
| 178 std::map<HWND, WebPluginGeometry>::iterator i = params->geometry->begin(); | 178 std::map<HWND, WebPluginGeometry>::iterator i = params->geometry->begin(); |
| 179 while (i != params->geometry->end() && | 179 while (i != params->geometry->end() && |
| 180 i->second.window != window && | 180 i->second.window != window && |
| 181 GetParent(i->second.window) != window) { | 181 GetParent(i->second.window) != window) { |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 return; | 584 return; |
| 585 host_->WasHidden(); | 585 host_->WasHidden(); |
| 586 software_frame_manager_->SetVisibility(false); | 586 software_frame_manager_->SetVisibility(false); |
| 587 delegated_frame_evictor_->SetVisible(false); | 587 delegated_frame_evictor_->SetVisible(false); |
| 588 released_front_lock_ = NULL; | 588 released_front_lock_ = NULL; |
| 589 | 589 |
| 590 #if defined(OS_WIN) | 590 #if defined(OS_WIN) |
| 591 constrained_rects_.clear(); | 591 constrained_rects_.clear(); |
| 592 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 592 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 593 if (dispatcher) { | 593 if (dispatcher) { |
| 594 HWND parent = dispatcher->GetAcceleratedWidget(); | 594 HWND parent = dispatcher->host()->GetAcceleratedWidget(); |
| 595 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 595 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 596 | 596 |
| 597 EnumChildWindows(parent, HideWindowsCallback, lparam); | 597 EnumChildWindows(parent, HideWindowsCallback, lparam); |
| 598 } | 598 } |
| 599 #endif | 599 #endif |
| 600 } | 600 } |
| 601 | 601 |
| 602 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 602 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 603 // For a SetSize operation, we don't care what coordinate system the origin | 603 // For a SetSize operation, we don't care what coordinate system the origin |
| 604 // of the window is in, it's only important to make sure that the origin | 604 // of the window is in, it's only important to make sure that the origin |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 } | 691 } |
| 692 | 692 |
| 693 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 693 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
| 694 return window_; | 694 return window_; |
| 695 } | 695 } |
| 696 | 696 |
| 697 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { | 697 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { |
| 698 #if defined(OS_WIN) | 698 #if defined(OS_WIN) |
| 699 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 699 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 700 if (dispatcher) { | 700 if (dispatcher) { |
| 701 HWND window = dispatcher->GetAcceleratedWidget(); | 701 HWND window = dispatcher->host()->GetAcceleratedWidget(); |
| 702 return reinterpret_cast<gfx::NativeViewId>(window); | 702 return reinterpret_cast<gfx::NativeViewId>(window); |
| 703 } | 703 } |
| 704 #endif | 704 #endif |
| 705 return static_cast<gfx::NativeViewId>(NULL); | 705 return static_cast<gfx::NativeViewId>(NULL); |
| 706 } | 706 } |
| 707 | 707 |
| 708 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { | 708 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { |
| 709 #if defined(OS_WIN) | 709 #if defined(OS_WIN) |
| 710 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 710 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 711 if (!dispatcher) | 711 if (!dispatcher) |
| 712 return static_cast<gfx::NativeViewAccessible>(NULL); | 712 return static_cast<gfx::NativeViewAccessible>(NULL); |
| 713 HWND hwnd = dispatcher->GetAcceleratedWidget(); | 713 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); |
| 714 | 714 |
| 715 BrowserAccessibilityManager* manager = | 715 BrowserAccessibilityManager* manager = |
| 716 GetOrCreateBrowserAccessibilityManager(); | 716 GetOrCreateBrowserAccessibilityManager(); |
| 717 if (manager) | 717 if (manager) |
| 718 return manager->GetRoot()->ToBrowserAccessibilityWin(); | 718 return manager->GetRoot()->ToBrowserAccessibilityWin(); |
| 719 #endif | 719 #endif |
| 720 | 720 |
| 721 NOTIMPLEMENTED(); | 721 NOTIMPLEMENTED(); |
| 722 return static_cast<gfx::NativeViewAccessible>(NULL); | 722 return static_cast<gfx::NativeViewAccessible>(NULL); |
| 723 } | 723 } |
| 724 | 724 |
| 725 BrowserAccessibilityManager* | 725 BrowserAccessibilityManager* |
| 726 RenderWidgetHostViewAura::GetOrCreateBrowserAccessibilityManager() { | 726 RenderWidgetHostViewAura::GetOrCreateBrowserAccessibilityManager() { |
| 727 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); | 727 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); |
| 728 if (manager) | 728 if (manager) |
| 729 return manager; | 729 return manager; |
| 730 | 730 |
| 731 #if defined(OS_WIN) | 731 #if defined(OS_WIN) |
| 732 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 732 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 733 if (!dispatcher) | 733 if (!dispatcher) |
| 734 return NULL; | 734 return NULL; |
| 735 HWND hwnd = dispatcher->GetAcceleratedWidget(); | 735 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); |
| 736 | 736 |
| 737 // The accessible_parent may be NULL at this point. The WebContents will pass | 737 // The accessible_parent may be NULL at this point. The WebContents will pass |
| 738 // it down to this instance (by way of the RenderViewHost and | 738 // it down to this instance (by way of the RenderViewHost and |
| 739 // RenderWidgetHost) when it is known. This instance will then set it on its | 739 // RenderWidgetHost) when it is known. This instance will then set it on its |
| 740 // BrowserAccessibilityManager. | 740 // BrowserAccessibilityManager. |
| 741 gfx::NativeViewAccessible accessible_parent = | 741 gfx::NativeViewAccessible accessible_parent = |
| 742 host_->GetParentNativeViewAccessible(); | 742 host_->GetParentNativeViewAccessible(); |
| 743 | 743 |
| 744 manager = new BrowserAccessibilityManagerWin( | 744 manager = new BrowserAccessibilityManagerWin( |
| 745 hwnd, accessible_parent, | 745 hwnd, accessible_parent, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 756 void RenderWidgetHostViewAura::MovePluginWindows( | 756 void RenderWidgetHostViewAura::MovePluginWindows( |
| 757 const gfx::Vector2d& scroll_offset, | 757 const gfx::Vector2d& scroll_offset, |
| 758 const std::vector<WebPluginGeometry>& plugin_window_moves) { | 758 const std::vector<WebPluginGeometry>& plugin_window_moves) { |
| 759 #if defined(OS_WIN) | 759 #if defined(OS_WIN) |
| 760 // We need to clip the rectangle to the tab's viewport, otherwise we will draw | 760 // We need to clip the rectangle to the tab's viewport, otherwise we will draw |
| 761 // over the browser UI. | 761 // over the browser UI. |
| 762 if (!window_->GetRootWindow()) { | 762 if (!window_->GetRootWindow()) { |
| 763 DCHECK(plugin_window_moves.empty()); | 763 DCHECK(plugin_window_moves.empty()); |
| 764 return; | 764 return; |
| 765 } | 765 } |
| 766 HWND parent = window_->GetDispatcher()->GetAcceleratedWidget(); | 766 HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); |
| 767 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); | 767 gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); |
| 768 std::vector<WebPluginGeometry> moves = plugin_window_moves; | 768 std::vector<WebPluginGeometry> moves = plugin_window_moves; |
| 769 | 769 |
| 770 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), | 770 gfx::Rect view_port(scroll_offset.x(), scroll_offset.y(), view_bounds.width(), |
| 771 view_bounds.height()); | 771 view_bounds.height()); |
| 772 | 772 |
| 773 for (size_t i = 0; i < moves.size(); ++i) { | 773 for (size_t i = 0; i < moves.size(); ++i) { |
| 774 gfx::Rect clip(moves[i].clip_rect); | 774 gfx::Rect clip(moves[i].clip_rect); |
| 775 gfx::Vector2d view_port_offset( | 775 gfx::Vector2d view_port_offset( |
| 776 moves[i].window_rect.OffsetFromOrigin() + scroll_offset); | 776 moves[i].window_rect.OffsetFromOrigin() + scroll_offset); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 continue; | 941 continue; |
| 942 | 942 |
| 943 SchedulePaintIfNotInClip(rect, clip_rect); | 943 SchedulePaintIfNotInClip(rect, clip_rect); |
| 944 | 944 |
| 945 #if defined(OS_WIN) | 945 #if defined(OS_WIN) |
| 946 if (dispatcher) { | 946 if (dispatcher) { |
| 947 // Send the invalid rect in screen coordinates. | 947 // Send the invalid rect in screen coordinates. |
| 948 gfx::Rect screen_rect = GetViewBounds(); | 948 gfx::Rect screen_rect = GetViewBounds(); |
| 949 gfx::Rect invalid_screen_rect(rect); | 949 gfx::Rect invalid_screen_rect(rect); |
| 950 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); | 950 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); |
| 951 HWND hwnd = dispatcher->GetAcceleratedWidget(); | 951 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); |
| 952 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); | 952 PaintPluginWindowsHelper(hwnd, invalid_screen_rect); |
| 953 } | 953 } |
| 954 #endif // defined(OS_WIN) | 954 #endif // defined(OS_WIN) |
| 955 } | 955 } |
| 956 } | 956 } |
| 957 | 957 |
| 958 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, | 958 void RenderWidgetHostViewAura::RenderProcessGone(base::TerminationStatus status, |
| 959 int error_code) { | 959 int error_code) { |
| 960 UpdateCursorIfOverSelf(); | 960 UpdateCursorIfOverSelf(); |
| 961 Destroy(); | 961 Destroy(); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 const std::vector<gfx::Rect>& rects) { | 1257 const std::vector<gfx::Rect>& rects) { |
| 1258 if (rects == constrained_rects_) | 1258 if (rects == constrained_rects_) |
| 1259 return; | 1259 return; |
| 1260 constrained_rects_ = rects; | 1260 constrained_rects_ = rects; |
| 1261 UpdateCutoutRects(); | 1261 UpdateCutoutRects(); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 void RenderWidgetHostViewAura::UpdateCutoutRects() { | 1264 void RenderWidgetHostViewAura::UpdateCutoutRects() { |
| 1265 if (!window_->GetRootWindow()) | 1265 if (!window_->GetRootWindow()) |
| 1266 return; | 1266 return; |
| 1267 HWND parent = window_->GetDispatcher()->GetAcceleratedWidget(); | 1267 HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); |
| 1268 CutoutRectsParams params; | 1268 CutoutRectsParams params; |
| 1269 params.widget = this; | 1269 params.widget = this; |
| 1270 params.cutout_rects = constrained_rects_; | 1270 params.cutout_rects = constrained_rects_; |
| 1271 params.geometry = &plugin_window_moves_; | 1271 params.geometry = &plugin_window_moves_; |
| 1272 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); | 1272 LPARAM lparam = reinterpret_cast<LPARAM>(¶ms); |
| 1273 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 1273 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
| 1274 } | 1274 } |
| 1275 #endif | 1275 #endif |
| 1276 | 1276 |
| 1277 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 1277 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1961 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
| 1962 #if defined(OS_WIN) | 1962 #if defined(OS_WIN) |
| 1963 // aura::Window::GetBoundsInScreen doesn't take non-client area into | 1963 // aura::Window::GetBoundsInScreen doesn't take non-client area into |
| 1964 // account. | 1964 // account. |
| 1965 RECT window_rect = {0}; | 1965 RECT window_rect = {0}; |
| 1966 | 1966 |
| 1967 aura::Window* top_level = window_->GetToplevelWindow(); | 1967 aura::Window* top_level = window_->GetToplevelWindow(); |
| 1968 aura::WindowEventDispatcher* dispatcher = top_level->GetDispatcher(); | 1968 aura::WindowEventDispatcher* dispatcher = top_level->GetDispatcher(); |
| 1969 if (!dispatcher) | 1969 if (!dispatcher) |
| 1970 return top_level->GetBoundsInScreen(); | 1970 return top_level->GetBoundsInScreen(); |
| 1971 HWND hwnd = dispatcher->GetAcceleratedWidget(); | 1971 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); |
| 1972 ::GetWindowRect(hwnd, &window_rect); | 1972 ::GetWindowRect(hwnd, &window_rect); |
| 1973 gfx::Rect rect(window_rect); | 1973 gfx::Rect rect(window_rect); |
| 1974 | 1974 |
| 1975 // Maximized windows are outdented from the work area by the frame thickness | 1975 // Maximized windows are outdented from the work area by the frame thickness |
| 1976 // even though this "frame" is not painted. This confuses code (and people) | 1976 // even though this "frame" is not painted. This confuses code (and people) |
| 1977 // that think of a maximized window as corresponding exactly to the work area. | 1977 // that think of a maximized window as corresponding exactly to the work area. |
| 1978 // Correct for this by subtracting the frame thickness back off. | 1978 // Correct for this by subtracting the frame thickness back off. |
| 1979 if (::IsZoomed(hwnd)) { | 1979 if (::IsZoomed(hwnd)) { |
| 1980 rect.Inset(GetSystemMetrics(SM_CXSIZEFRAME), | 1980 rect.Inset(GetSystemMetrics(SM_CXSIZEFRAME), |
| 1981 GetSystemMetrics(SM_CYSIZEFRAME)); | 1981 GetSystemMetrics(SM_CYSIZEFRAME)); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 cursor_client->LockCursor(); | 2078 cursor_client->LockCursor(); |
| 2079 } | 2079 } |
| 2080 | 2080 |
| 2081 if (ShouldMoveToCenter()) { | 2081 if (ShouldMoveToCenter()) { |
| 2082 synthetic_move_sent_ = true; | 2082 synthetic_move_sent_ = true; |
| 2083 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); | 2083 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); |
| 2084 } | 2084 } |
| 2085 if (aura::client::GetTooltipClient(root_window)) | 2085 if (aura::client::GetTooltipClient(root_window)) |
| 2086 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); | 2086 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); |
| 2087 | 2087 |
| 2088 root_window->GetDispatcher()->ConfineCursorToWindow(); | 2088 root_window->GetDispatcher()->host()->ConfineCursorToRootWindow(); |
| 2089 return true; | 2089 return true; |
| 2090 } | 2090 } |
| 2091 | 2091 |
| 2092 void RenderWidgetHostViewAura::UnlockMouse() { | 2092 void RenderWidgetHostViewAura::UnlockMouse() { |
| 2093 aura::Window* root_window = window_->GetRootWindow(); | 2093 aura::Window* root_window = window_->GetRootWindow(); |
| 2094 if (!mouse_locked_ || !root_window) | 2094 if (!mouse_locked_ || !root_window) |
| 2095 return; | 2095 return; |
| 2096 | 2096 |
| 2097 mouse_locked_ = false; | 2097 mouse_locked_ = false; |
| 2098 | 2098 |
| 2099 #if !defined(OS_WIN) | 2099 #if !defined(OS_WIN) |
| 2100 window_->ReleaseCapture(); | 2100 window_->ReleaseCapture(); |
| 2101 #endif | 2101 #endif |
| 2102 window_->MoveCursorTo(unlocked_mouse_position_); | 2102 window_->MoveCursorTo(unlocked_mouse_position_); |
| 2103 aura::client::CursorClient* cursor_client = | 2103 aura::client::CursorClient* cursor_client = |
| 2104 aura::client::GetCursorClient(root_window); | 2104 aura::client::GetCursorClient(root_window); |
| 2105 if (cursor_client) { | 2105 if (cursor_client) { |
| 2106 cursor_client->UnlockCursor(); | 2106 cursor_client->UnlockCursor(); |
| 2107 cursor_client->ShowCursor(); | 2107 cursor_client->ShowCursor(); |
| 2108 } | 2108 } |
| 2109 | 2109 |
| 2110 if (aura::client::GetTooltipClient(root_window)) | 2110 if (aura::client::GetTooltipClient(root_window)) |
| 2111 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); | 2111 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); |
| 2112 | 2112 |
| 2113 host_->LostMouseLock(); | 2113 host_->LostMouseLock(); |
| 2114 root_window->GetDispatcher()->UnConfineCursor(); | 2114 root_window->GetDispatcher()->host()->UnConfineCursor(); |
| 2115 } | 2115 } |
| 2116 | 2116 |
| 2117 //////////////////////////////////////////////////////////////////////////////// | 2117 //////////////////////////////////////////////////////////////////////////////// |
| 2118 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | 2118 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
| 2119 void RenderWidgetHostViewAura::SetCompositionText( | 2119 void RenderWidgetHostViewAura::SetCompositionText( |
| 2120 const ui::CompositionText& composition) { | 2120 const ui::CompositionText& composition) { |
| 2121 if (!host_) | 2121 if (!host_) |
| 2122 return; | 2122 return; |
| 2123 | 2123 |
| 2124 // ui::CompositionUnderline should be identical to | 2124 // ui::CompositionUnderline should be identical to |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 } | 2460 } |
| 2461 | 2461 |
| 2462 void RenderWidgetHostViewAura::OnWindowDestroying() { | 2462 void RenderWidgetHostViewAura::OnWindowDestroying() { |
| 2463 #if defined(OS_WIN) | 2463 #if defined(OS_WIN) |
| 2464 HWND parent = NULL; | 2464 HWND parent = NULL; |
| 2465 // If the tab was hidden and it's closed, host_->is_hidden would have been | 2465 // If the tab was hidden and it's closed, host_->is_hidden would have been |
| 2466 // reset to false in RenderWidgetHostImpl::RendererExited. | 2466 // reset to false in RenderWidgetHostImpl::RendererExited. |
| 2467 if (!window_->GetRootWindow() || host_->is_hidden()) { | 2467 if (!window_->GetRootWindow() || host_->is_hidden()) { |
| 2468 parent = ui::GetHiddenWindow(); | 2468 parent = ui::GetHiddenWindow(); |
| 2469 } else { | 2469 } else { |
| 2470 parent = window_->GetDispatcher()->GetAcceleratedWidget(); | 2470 parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); |
| 2471 } | 2471 } |
| 2472 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 2472 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 2473 EnumChildWindows(parent, WindowDestroyingCallback, lparam); | 2473 EnumChildWindows(parent, WindowDestroyingCallback, lparam); |
| 2474 #endif | 2474 #endif |
| 2475 | 2475 |
| 2476 // Make sure that the input method no longer references to this object before | 2476 // Make sure that the input method no longer references to this object before |
| 2477 // this object is removed from the root window (i.e. this object loses access | 2477 // this object is removed from the root window (i.e. this object loses access |
| 2478 // to the input method). | 2478 // to the input method). |
| 2479 ui::InputMethod* input_method = GetInputMethod(); | 2479 ui::InputMethod* input_method = GetInputMethod(); |
| 2480 if (input_method) | 2480 if (input_method) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 return; | 2678 return; |
| 2679 } | 2679 } |
| 2680 | 2680 |
| 2681 if (event->type() == ui::ET_MOUSEWHEEL) { | 2681 if (event->type() == ui::ET_MOUSEWHEEL) { |
| 2682 #if defined(OS_WIN) | 2682 #if defined(OS_WIN) |
| 2683 // We get mouse wheel/scroll messages even if we are not in the foreground. | 2683 // We get mouse wheel/scroll messages even if we are not in the foreground. |
| 2684 // So here we check if we have any owned popup windows in the foreground and | 2684 // So here we check if we have any owned popup windows in the foreground and |
| 2685 // dismiss them. | 2685 // dismiss them. |
| 2686 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 2686 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 2687 if (dispatcher) { | 2687 if (dispatcher) { |
| 2688 HWND parent = dispatcher->GetAcceleratedWidget(); | 2688 HWND parent = dispatcher->host()->GetAcceleratedWidget(); |
| 2689 HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); | 2689 HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); |
| 2690 EnumThreadWindows(GetCurrentThreadId(), | 2690 EnumThreadWindows(GetCurrentThreadId(), |
| 2691 DismissOwnedPopups, | 2691 DismissOwnedPopups, |
| 2692 reinterpret_cast<LPARAM>(toplevel_hwnd)); | 2692 reinterpret_cast<LPARAM>(toplevel_hwnd)); |
| 2693 } | 2693 } |
| 2694 #endif | 2694 #endif |
| 2695 blink::WebMouseWheelEvent mouse_wheel_event = | 2695 blink::WebMouseWheelEvent mouse_wheel_event = |
| 2696 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); | 2696 MakeWebMouseWheelEvent(static_cast<ui::MouseWheelEvent*>(event)); |
| 2697 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) | 2697 if (mouse_wheel_event.deltaX != 0 || mouse_wheel_event.deltaY != 0) |
| 2698 host_->ForwardWheelEvent(mouse_wheel_event); | 2698 host_->ForwardWheelEvent(mouse_wheel_event); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3136 | 3136 |
| 3137 gfx::Rect screen_rect = GetViewBounds(); | 3137 gfx::Rect screen_rect = GetViewBounds(); |
| 3138 gfx::Point local_point = screen_point; | 3138 gfx::Point local_point = screen_point; |
| 3139 local_point.Offset(-screen_rect.x(), -screen_rect.y()); | 3139 local_point.Offset(-screen_rect.x(), -screen_rect.y()); |
| 3140 | 3140 |
| 3141 #if defined(OS_WIN) | 3141 #if defined(OS_WIN) |
| 3142 // If there's another toplevel window above us at this point (for example a | 3142 // If there's another toplevel window above us at this point (for example a |
| 3143 // menu), we don't want to update the cursor. | 3143 // menu), we don't want to update the cursor. |
| 3144 POINT windows_point = { screen_point.x(), screen_point.y() }; | 3144 POINT windows_point = { screen_point.x(), screen_point.y() }; |
| 3145 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); | 3145 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); |
| 3146 if (dispatcher->GetAcceleratedWidget() != ::WindowFromPoint(windows_point)) | 3146 if (dispatcher->host()->GetAcceleratedWidget() != |
| 3147 ::WindowFromPoint(windows_point)) |
| 3147 return; | 3148 return; |
| 3148 #endif | 3149 #endif |
| 3149 if (root_window->GetEventHandlerForPoint(local_point) != window_) | 3150 if (root_window->GetEventHandlerForPoint(local_point) != window_) |
| 3150 return; | 3151 return; |
| 3151 | 3152 |
| 3152 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); | 3153 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
| 3153 // Do not show loading cursor when the cursor is currently hidden. | 3154 // Do not show loading cursor when the cursor is currently hidden. |
| 3154 if (is_loading_ && cursor != ui::kCursorNone) | 3155 if (is_loading_ && cursor != ui::kCursorNone) |
| 3155 cursor = ui::kCursorPointer; | 3156 cursor = ui::kCursorPointer; |
| 3156 | 3157 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 RenderWidgetHost* widget) { | 3334 RenderWidgetHost* widget) { |
| 3334 return new RenderWidgetHostViewAura(widget); | 3335 return new RenderWidgetHostViewAura(widget); |
| 3335 } | 3336 } |
| 3336 | 3337 |
| 3337 // static | 3338 // static |
| 3338 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3339 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3339 GetScreenInfoForWindow(results, NULL); | 3340 GetScreenInfoForWindow(results, NULL); |
| 3340 } | 3341 } |
| 3341 | 3342 |
| 3342 } // namespace content | 3343 } // namespace content |
| OLD | NEW |