| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 441 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| 442 can_compose_inline_(true), | 442 can_compose_inline_(true), |
| 443 has_composition_text_(false), | 443 has_composition_text_(false), |
| 444 accept_return_character_(false), | 444 accept_return_character_(false), |
| 445 last_swapped_software_frame_scale_factor_(1.f), | 445 last_swapped_software_frame_scale_factor_(1.f), |
| 446 paint_canvas_(NULL), | 446 paint_canvas_(NULL), |
| 447 synthetic_move_sent_(false), | 447 synthetic_move_sent_(false), |
| 448 cursor_visibility_state_in_renderer_(UNKNOWN), | 448 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 449 #if defined(OS_WIN) | 449 #if defined(OS_WIN) |
| 450 legacy_render_widget_host_HWND_(NULL), | 450 legacy_render_widget_host_HWND_(NULL), |
| 451 legacy_window_destroyed_(false), | |
| 452 #endif | 451 #endif |
| 453 has_snapped_to_boundary_(false), | 452 has_snapped_to_boundary_(false), |
| 454 touch_editing_client_(NULL), | 453 touch_editing_client_(NULL), |
| 455 weak_ptr_factory_(this) { | 454 weak_ptr_factory_(this) { |
| 456 host_->SetView(this); | 455 host_->SetView(this); |
| 457 window_observer_.reset(new WindowObserver(this)); | 456 window_observer_.reset(new WindowObserver(this)); |
| 458 aura::client::SetTooltipText(window_, &tooltip_); | 457 aura::client::SetTooltipText(window_, &tooltip_); |
| 459 aura::client::SetActivationDelegate(window_, this); | 458 aura::client::SetActivationDelegate(window_, this); |
| 460 aura::client::SetActivationChangeObserver(window_, this); | 459 aura::client::SetActivationChangeObserver(window_, this); |
| 461 aura::client::SetFocusChangeObserver(window_, this); | 460 aura::client::SetFocusChangeObserver(window_, this); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 if (root) { | 574 if (root) { |
| 576 aura::client::CursorClient* cursor_client = | 575 aura::client::CursorClient* cursor_client = |
| 577 aura::client::GetCursorClient(root); | 576 aura::client::GetCursorClient(root); |
| 578 if (cursor_client) | 577 if (cursor_client) |
| 579 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 578 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 580 } | 579 } |
| 581 | 580 |
| 582 delegated_frame_host_->WasShown(browser_latency_info); | 581 delegated_frame_host_->WasShown(browser_latency_info); |
| 583 | 582 |
| 584 #if defined(OS_WIN) | 583 #if defined(OS_WIN) |
| 585 if (legacy_render_widget_host_HWND_) { | |
| 586 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent | |
| 587 // window before reparenting any plugins. This ensures that the plugin | |
| 588 // windows stay on top of the child Zorder in the parent and receive | |
| 589 // mouse events, etc. | |
| 590 legacy_render_widget_host_HWND_->UpdateParent( | |
| 591 GetNativeView()->GetHost()->GetAcceleratedWidget()); | |
| 592 legacy_render_widget_host_HWND_->SetBounds( | |
| 593 window_->GetBoundsInRootWindow()); | |
| 594 } | |
| 595 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 584 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 596 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 585 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
| 597 #endif | 586 #endif |
| 598 } | 587 } |
| 599 | 588 |
| 600 void RenderWidgetHostViewAura::WasHidden() { | 589 void RenderWidgetHostViewAura::WasHidden() { |
| 601 if (!host_ || host_->is_hidden()) | 590 if (!host_ || host_->is_hidden()) |
| 602 return; | 591 return; |
| 603 host_->WasHidden(); | 592 host_->WasHidden(); |
| 604 delegated_frame_host_->WasHidden(); | 593 delegated_frame_host_->WasHidden(); |
| 605 | 594 |
| 606 #if defined(OS_WIN) | 595 #if defined(OS_WIN) |
| 607 constrained_rects_.clear(); | 596 constrained_rects_.clear(); |
| 608 aura::WindowTreeHost* host = window_->GetHost(); | 597 aura::WindowTreeHost* host = window_->GetHost(); |
| 609 if (host) { | 598 if (host) { |
| 610 HWND parent = host->GetAcceleratedWidget(); | 599 HWND parent = host->GetAcceleratedWidget(); |
| 611 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 600 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 612 EnumChildWindows(parent, HideWindowsCallback, lparam); | 601 EnumChildWindows(parent, HideWindowsCallback, lparam); |
| 613 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global | |
| 614 // hidden window on the same lines as Windowed plugin windows. | |
| 615 if (legacy_render_widget_host_HWND_) | |
| 616 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); | |
| 617 } | 602 } |
| 618 #endif | 603 #endif |
| 619 } | 604 } |
| 620 | 605 |
| 621 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 606 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 622 // For a SetSize operation, we don't care what coordinate system the origin | 607 // For a SetSize operation, we don't care what coordinate system the origin |
| 623 // of the window is in, it's only important to make sure that the origin | 608 // of the window is in, it's only important to make sure that the origin |
| 624 // remains constant after the operation. | 609 // remains constant after the operation. |
| 625 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 610 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
| 626 } | 611 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 return window_->HasFocus(); | 756 return window_->HasFocus(); |
| 772 } | 757 } |
| 773 | 758 |
| 774 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 759 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 775 return delegated_frame_host_->CanCopyToBitmap(); | 760 return delegated_frame_host_->CanCopyToBitmap(); |
| 776 } | 761 } |
| 777 | 762 |
| 778 void RenderWidgetHostViewAura::Show() { | 763 void RenderWidgetHostViewAura::Show() { |
| 779 window_->Show(); | 764 window_->Show(); |
| 780 WasShown(); | 765 WasShown(); |
| 781 #if defined(OS_WIN) | |
| 782 if (legacy_render_widget_host_HWND_) | |
| 783 legacy_render_widget_host_HWND_->Show(); | |
| 784 #endif | |
| 785 } | 766 } |
| 786 | 767 |
| 787 void RenderWidgetHostViewAura::Hide() { | 768 void RenderWidgetHostViewAura::Hide() { |
| 788 window_->Hide(); | 769 window_->Hide(); |
| 789 WasHidden(); | 770 WasHidden(); |
| 790 #if defined(OS_WIN) | |
| 791 if (legacy_render_widget_host_HWND_) | |
| 792 legacy_render_widget_host_HWND_->Hide(); | |
| 793 #endif | |
| 794 } | 771 } |
| 795 | 772 |
| 796 bool RenderWidgetHostViewAura::IsShowing() { | 773 bool RenderWidgetHostViewAura::IsShowing() { |
| 797 return window_->IsVisible(); | 774 return window_->IsVisible(); |
| 798 } | 775 } |
| 799 | 776 |
| 800 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 777 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 801 return window_->GetBoundsInScreen(); | 778 return window_->GetBoundsInScreen(); |
| 802 } | 779 } |
| 803 | 780 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 979 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
| 1003 } | 980 } |
| 1004 | 981 |
| 1005 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 982 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
| 1006 // Clip the cursor if chrome is running on regular desktop. | 983 // Clip the cursor if chrome is running on regular desktop. |
| 1007 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { | 984 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { |
| 1008 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); | 985 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); |
| 1009 ::ClipCursor(&window_rect); | 986 ::ClipCursor(&window_rect); |
| 1010 } | 987 } |
| 1011 } | 988 } |
| 1012 | 989 #endif // defined(OS_WIN) |
| 1013 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | |
| 1014 legacy_render_widget_host_HWND_ = NULL; | |
| 1015 legacy_window_destroyed_ = true; | |
| 1016 } | |
| 1017 #endif | |
| 1018 | 990 |
| 1019 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 991 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
| 1020 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, | 992 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
| 1021 int gpu_host_id) { | 993 int gpu_host_id) { |
| 1022 // Oldschool composited mode is no longer supported. | 994 // Oldschool composited mode is no longer supported. |
| 1023 } | 995 } |
| 1024 | 996 |
| 1025 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 997 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
| 1026 uint32 output_surface_id, | 998 uint32 output_surface_id, |
| 1027 scoped_ptr<cc::CompositorFrame> frame) { | 999 scoped_ptr<cc::CompositorFrame> frame) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1040 if (frame->software_frame_data) { | 1012 if (frame->software_frame_data) { |
| 1041 DLOG(ERROR) << "Unable to use software frame in aura"; | 1013 DLOG(ERROR) << "Unable to use software frame in aura"; |
| 1042 RecordAction( | 1014 RecordAction( |
| 1043 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); | 1015 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); |
| 1044 host_->GetProcess()->ReceivedBadMessage(); | 1016 host_->GetProcess()->ReceivedBadMessage(); |
| 1045 return; | 1017 return; |
| 1046 } | 1018 } |
| 1047 } | 1019 } |
| 1048 | 1020 |
| 1049 #if defined(OS_WIN) | 1021 #if defined(OS_WIN) |
| 1022 void RenderWidgetHostViewAura::SetLegacyRenderWidgetHostHWND( |
| 1023 LegacyRenderWidgetHostHWND* legacy_hwnd) { |
| 1024 legacy_render_widget_host_HWND_ = legacy_hwnd; |
| 1025 } |
| 1026 |
| 1050 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1027 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
| 1051 gfx::NativeViewAccessible accessible_parent) { | 1028 gfx::NativeViewAccessible accessible_parent) { |
| 1052 } | 1029 } |
| 1053 | 1030 |
| 1054 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1031 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
| 1055 const { | 1032 const { |
| 1056 if (legacy_render_widget_host_HWND_) { | 1033 if (legacy_render_widget_host_HWND_) { |
| 1057 return reinterpret_cast<gfx::NativeViewId>( | 1034 return reinterpret_cast<gfx::NativeViewId>( |
| 1058 legacy_render_widget_host_HWND_->hwnd()); | 1035 legacy_render_widget_host_HWND_->hwnd()); |
| 1059 } | 1036 } |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 HWND parent = NULL; | 1621 HWND parent = NULL; |
| 1645 // If the tab was hidden and it's closed, host_->is_hidden would have been | 1622 // If the tab was hidden and it's closed, host_->is_hidden would have been |
| 1646 // reset to false in RenderWidgetHostImpl::RendererExited. | 1623 // reset to false in RenderWidgetHostImpl::RendererExited. |
| 1647 if (!window_->GetRootWindow() || host_->is_hidden()) { | 1624 if (!window_->GetRootWindow() || host_->is_hidden()) { |
| 1648 parent = ui::GetHiddenWindow(); | 1625 parent = ui::GetHiddenWindow(); |
| 1649 } else { | 1626 } else { |
| 1650 parent = window_->GetHost()->GetAcceleratedWidget(); | 1627 parent = window_->GetHost()->GetAcceleratedWidget(); |
| 1651 } | 1628 } |
| 1652 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 1629 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 1653 EnumChildWindows(parent, WindowDestroyingCallback, lparam); | 1630 EnumChildWindows(parent, WindowDestroyingCallback, lparam); |
| 1654 | 1631 legacy_render_widget_host_HWND_ = NULL; |
| 1655 // The LegacyRenderWidgetHostHWND instance is destroyed when its window is | |
| 1656 // destroyed. Normally we control when that happens via the Destroy call | |
| 1657 // in the dtor. However there may be cases where the window is destroyed | |
| 1658 // by Windows, i.e. the parent window is destroyed before the | |
| 1659 // RenderWidgetHostViewAura instance goes away etc. To avoid that we | |
| 1660 // destroy the LegacyRenderWidgetHostHWND instance here. | |
| 1661 if (legacy_render_widget_host_HWND_) { | |
| 1662 legacy_render_widget_host_HWND_->set_host(NULL); | |
| 1663 legacy_render_widget_host_HWND_->Destroy(); | |
| 1664 // The Destroy call above will delete the LegacyRenderWidgetHostHWND | |
| 1665 // instance. | |
| 1666 legacy_render_widget_host_HWND_ = NULL; | |
| 1667 } | |
| 1668 #endif | 1632 #endif |
| 1669 | 1633 |
| 1670 // Make sure that the input method no longer references to this object before | 1634 // Make sure that the input method no longer references to this object before |
| 1671 // this object is removed from the root window (i.e. this object loses access | 1635 // this object is removed from the root window (i.e. this object loses access |
| 1672 // to the input method). | 1636 // to the input method). |
| 1673 ui::InputMethod* input_method = GetInputMethod(); | 1637 ui::InputMethod* input_method = GetInputMethod(); |
| 1674 if (input_method) | 1638 if (input_method) |
| 1675 input_method->DetachTextInputClient(this); | 1639 input_method->DetachTextInputClient(this); |
| 1676 | 1640 |
| 1677 if (overscroll_controller_) | 1641 if (overscroll_controller_) |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 popup_child_host_view_->popup_parent_host_view_ = NULL; | 2111 popup_child_host_view_->popup_parent_host_view_ = NULL; |
| 2148 } | 2112 } |
| 2149 event_filter_for_popup_exit_.reset(); | 2113 event_filter_for_popup_exit_.reset(); |
| 2150 aura::client::SetTooltipText(window_, NULL); | 2114 aura::client::SetTooltipText(window_, NULL); |
| 2151 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); | 2115 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); |
| 2152 | 2116 |
| 2153 // This call is usually no-op since |this| object is already removed from the | 2117 // This call is usually no-op since |this| object is already removed from the |
| 2154 // Aura root window and we don't have a way to get an input method object | 2118 // Aura root window and we don't have a way to get an input method object |
| 2155 // associated with the window, but just in case. | 2119 // associated with the window, but just in case. |
| 2156 DetachFromInputMethod(); | 2120 DetachFromInputMethod(); |
| 2157 | |
| 2158 #if defined(OS_WIN) | |
| 2159 // The LegacyRenderWidgetHostHWND window should have been destroyed in | |
| 2160 // RenderWidgetHostViewAura::OnWindowDestroying and the pointer should | |
| 2161 // be set to NULL. | |
| 2162 DCHECK(!legacy_render_widget_host_HWND_); | |
| 2163 #endif | |
| 2164 } | 2121 } |
| 2165 | 2122 |
| 2166 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2123 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 2167 const gfx::Point screen_point = | 2124 const gfx::Point screen_point = |
| 2168 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 2125 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
| 2169 aura::Window* root_window = window_->GetRootWindow(); | 2126 aura::Window* root_window = window_->GetRootWindow(); |
| 2170 if (!root_window) | 2127 if (!root_window) |
| 2171 return; | 2128 return; |
| 2172 | 2129 |
| 2173 gfx::Point root_window_point = screen_point; | 2130 gfx::Point root_window_point = screen_point; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2296 // a Window::SetBoundsInternal call. | 2253 // a Window::SetBoundsInternal call. |
| 2297 if (!in_bounds_changed_) | 2254 if (!in_bounds_changed_) |
| 2298 window_->SetBounds(rect); | 2255 window_->SetBounds(rect); |
| 2299 host_->WasResized(); | 2256 host_->WasResized(); |
| 2300 delegated_frame_host_->WasResized(); | 2257 delegated_frame_host_->WasResized(); |
| 2301 if (touch_editing_client_) { | 2258 if (touch_editing_client_) { |
| 2302 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 2259 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
| 2303 selection_focus_rect_); | 2260 selection_focus_rect_); |
| 2304 } | 2261 } |
| 2305 #if defined(OS_WIN) | 2262 #if defined(OS_WIN) |
| 2306 // Create the legacy dummy window which corresponds to the bounds of the | |
| 2307 // webcontents. This will be passed as the container window for windowless | |
| 2308 // plugins. | |
| 2309 // Plugins like Flash assume the container window which is returned via the | |
| 2310 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | |
| 2311 // This is not true in Aura where we have only HWND which is the main Aura | |
| 2312 // window. If we return this window to plugins like Flash then it causes the | |
| 2313 // coordinate translations done by these plugins to break. | |
| 2314 // Additonally the legacy dummy window is needed for accessibility and for | |
| 2315 // scrolling to work in legacy drivers for trackpoints/trackpads, etc. | |
| 2316 if (!legacy_window_destroyed_ && GetNativeViewId()) { | |
| 2317 if (!legacy_render_widget_host_HWND_) { | |
| 2318 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create( | |
| 2319 reinterpret_cast<HWND>(GetNativeViewId())); | |
| 2320 } | |
| 2321 if (legacy_render_widget_host_HWND_) { | |
| 2322 legacy_render_widget_host_HWND_->set_host(this); | |
| 2323 legacy_render_widget_host_HWND_->SetBounds( | |
| 2324 window_->GetBoundsInRootWindow()); | |
| 2325 // There are cases where the parent window is created, made visible and | |
| 2326 // the associated RenderWidget is also visible before the | |
| 2327 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown | |
| 2328 // here. | |
| 2329 if (!host_->is_hidden()) | |
| 2330 legacy_render_widget_host_HWND_->Show(); | |
| 2331 } | |
| 2332 } | |
| 2333 | |
| 2334 if (mouse_locked_) | 2263 if (mouse_locked_) |
| 2335 UpdateMouseLockRegion(); | 2264 UpdateMouseLockRegion(); |
| 2336 #endif | 2265 #endif |
| 2337 } | 2266 } |
| 2338 | 2267 |
| 2339 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( | 2268 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( |
| 2340 const gfx::Rect& rect, | 2269 const gfx::Rect& rect, |
| 2341 const gfx::Rect& clip) { | 2270 const gfx::Rect& clip) { |
| 2342 if (!clip.IsEmpty()) { | 2271 if (!clip.IsEmpty()) { |
| 2343 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); | 2272 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2369 if (cursor_client) { | 2298 if (cursor_client) { |
| 2370 cursor_client->AddObserver(this); | 2299 cursor_client->AddObserver(this); |
| 2371 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 2300 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 2372 } | 2301 } |
| 2373 if (HasFocus()) { | 2302 if (HasFocus()) { |
| 2374 ui::InputMethod* input_method = GetInputMethod(); | 2303 ui::InputMethod* input_method = GetInputMethod(); |
| 2375 if (input_method) | 2304 if (input_method) |
| 2376 input_method->SetFocusedTextInputClient(this); | 2305 input_method->SetFocusedTextInputClient(this); |
| 2377 } | 2306 } |
| 2378 | 2307 |
| 2379 #if defined(OS_WIN) | |
| 2380 // The parent may have changed here. Ensure that the legacy window is | |
| 2381 // reparented accordingly. | |
| 2382 if (legacy_render_widget_host_HWND_) | |
| 2383 legacy_render_widget_host_HWND_->UpdateParent( | |
| 2384 reinterpret_cast<HWND>(GetNativeViewId())); | |
| 2385 #endif | |
| 2386 | |
| 2387 delegated_frame_host_->AddedToWindow(); | 2308 delegated_frame_host_->AddedToWindow(); |
| 2388 } | 2309 } |
| 2389 | 2310 |
| 2390 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 2311 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
| 2391 aura::client::CursorClient* cursor_client = | 2312 aura::client::CursorClient* cursor_client = |
| 2392 aura::client::GetCursorClient(window_->GetRootWindow()); | 2313 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 2393 if (cursor_client) | 2314 if (cursor_client) |
| 2394 cursor_client->RemoveObserver(this); | 2315 cursor_client->RemoveObserver(this); |
| 2395 | 2316 |
| 2396 DetachFromInputMethod(); | 2317 DetachFromInputMethod(); |
| 2397 | 2318 |
| 2398 window_->GetHost()->RemoveObserver(this); | 2319 window_->GetHost()->RemoveObserver(this); |
| 2399 delegated_frame_host_->RemovingFromWindow(); | 2320 delegated_frame_host_->RemovingFromWindow(); |
| 2400 | |
| 2401 #if defined(OS_WIN) | |
| 2402 // Update the legacy window's parent temporarily to the desktop window. It | |
| 2403 // will eventually get reparented to the right root. | |
| 2404 if (legacy_render_widget_host_HWND_) | |
| 2405 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); | |
| 2406 #endif | |
| 2407 } | 2321 } |
| 2408 | 2322 |
| 2409 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2323 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
| 2410 ui::InputMethod* input_method = GetInputMethod(); | 2324 ui::InputMethod* input_method = GetInputMethod(); |
| 2411 if (input_method && input_method->GetTextInputClient() == this) | 2325 if (input_method && input_method->GetTextInputClient() == this) |
| 2412 input_method->SetFocusedTextInputClient(NULL); | 2326 input_method->SetFocusedTextInputClient(NULL); |
| 2413 } | 2327 } |
| 2414 | 2328 |
| 2415 void RenderWidgetHostViewAura::ForwardKeyboardEvent( | 2329 void RenderWidgetHostViewAura::ForwardKeyboardEvent( |
| 2416 const NativeWebKeyboardEvent& event) { | 2330 const NativeWebKeyboardEvent& event) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 | 2408 |
| 2495 //////////////////////////////////////////////////////////////////////////////// | 2409 //////////////////////////////////////////////////////////////////////////////// |
| 2496 // RenderWidgetHostViewBase, public: | 2410 // RenderWidgetHostViewBase, public: |
| 2497 | 2411 |
| 2498 // static | 2412 // static |
| 2499 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2413 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2500 GetScreenInfoForWindow(results, NULL); | 2414 GetScreenInfoForWindow(results, NULL); |
| 2501 } | 2415 } |
| 2502 | 2416 |
| 2503 } // namespace content | 2417 } // namespace content |
| OLD | NEW |