| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 442 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| 443 can_compose_inline_(true), | 443 can_compose_inline_(true), |
| 444 has_composition_text_(false), | 444 has_composition_text_(false), |
| 445 accept_return_character_(false), | 445 accept_return_character_(false), |
| 446 last_swapped_software_frame_scale_factor_(1.f), | 446 last_swapped_software_frame_scale_factor_(1.f), |
| 447 paint_canvas_(NULL), | 447 paint_canvas_(NULL), |
| 448 synthetic_move_sent_(false), | 448 synthetic_move_sent_(false), |
| 449 cursor_visibility_state_in_renderer_(UNKNOWN), | 449 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 450 #if defined(OS_WIN) | 450 #if defined(OS_WIN) |
| 451 legacy_render_widget_host_HWND_(NULL), | 451 legacy_render_widget_host_HWND_(NULL), |
| 452 legacy_window_destroyed_(false), | |
| 453 #endif | 452 #endif |
| 454 has_snapped_to_boundary_(false), | 453 has_snapped_to_boundary_(false), |
| 455 touch_editing_client_(NULL), | 454 touch_editing_client_(NULL), |
| 456 weak_ptr_factory_(this) { | 455 weak_ptr_factory_(this) { |
| 457 host_->SetView(this); | 456 host_->SetView(this); |
| 458 window_observer_.reset(new WindowObserver(this)); | 457 window_observer_.reset(new WindowObserver(this)); |
| 459 aura::client::SetTooltipText(window_, &tooltip_); | 458 aura::client::SetTooltipText(window_, &tooltip_); |
| 460 aura::client::SetActivationDelegate(window_, this); | 459 aura::client::SetActivationDelegate(window_, this); |
| 461 aura::client::SetActivationChangeObserver(window_, this); | 460 aura::client::SetActivationChangeObserver(window_, this); |
| 462 aura::client::SetFocusChangeObserver(window_, this); | 461 aura::client::SetFocusChangeObserver(window_, this); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 if (root) { | 573 if (root) { |
| 575 aura::client::CursorClient* cursor_client = | 574 aura::client::CursorClient* cursor_client = |
| 576 aura::client::GetCursorClient(root); | 575 aura::client::GetCursorClient(root); |
| 577 if (cursor_client) | 576 if (cursor_client) |
| 578 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 577 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 579 } | 578 } |
| 580 | 579 |
| 581 delegated_frame_host_->WasShown(browser_latency_info); | 580 delegated_frame_host_->WasShown(browser_latency_info); |
| 582 | 581 |
| 583 #if defined(OS_WIN) | 582 #if defined(OS_WIN) |
| 584 if (legacy_render_widget_host_HWND_) { | |
| 585 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent | |
| 586 // window before reparenting any plugins. This ensures that the plugin | |
| 587 // windows stay on top of the child Zorder in the parent and receive | |
| 588 // mouse events, etc. | |
| 589 legacy_render_widget_host_HWND_->UpdateParent( | |
| 590 GetNativeView()->GetHost()->GetAcceleratedWidget()); | |
| 591 legacy_render_widget_host_HWND_->SetBounds( | |
| 592 window_->GetBoundsInRootWindow()); | |
| 593 } | |
| 594 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 583 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 595 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 584 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
| 596 #endif | 585 #endif |
| 597 } | 586 } |
| 598 | 587 |
| 599 void RenderWidgetHostViewAura::WasHidden() { | 588 void RenderWidgetHostViewAura::WasHidden() { |
| 600 if (!host_ || host_->is_hidden()) | 589 if (!host_ || host_->is_hidden()) |
| 601 return; | 590 return; |
| 602 host_->WasHidden(); | 591 host_->WasHidden(); |
| 603 delegated_frame_host_->WasHidden(); | 592 delegated_frame_host_->WasHidden(); |
| 604 | 593 |
| 605 #if defined(OS_WIN) | 594 #if defined(OS_WIN) |
| 606 constrained_rects_.clear(); | 595 constrained_rects_.clear(); |
| 607 aura::WindowTreeHost* host = window_->GetHost(); | 596 aura::WindowTreeHost* host = window_->GetHost(); |
| 608 if (host) { | 597 if (host) { |
| 609 HWND parent = host->GetAcceleratedWidget(); | 598 HWND parent = host->GetAcceleratedWidget(); |
| 610 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 599 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 611 EnumChildWindows(parent, HideWindowsCallback, lparam); | 600 EnumChildWindows(parent, HideWindowsCallback, lparam); |
| 612 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global | |
| 613 // hidden window on the same lines as Windowed plugin windows. | |
| 614 if (legacy_render_widget_host_HWND_) | |
| 615 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); | |
| 616 } | 601 } |
| 617 #endif | 602 #endif |
| 618 } | 603 } |
| 619 | 604 |
| 620 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 605 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 621 // For a SetSize operation, we don't care what coordinate system the origin | 606 // For a SetSize operation, we don't care what coordinate system the origin |
| 622 // of the window is in, it's only important to make sure that the origin | 607 // of the window is in, it's only important to make sure that the origin |
| 623 // remains constant after the operation. | 608 // remains constant after the operation. |
| 624 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 609 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
| 625 } | 610 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 return window_->HasFocus(); | 755 return window_->HasFocus(); |
| 771 } | 756 } |
| 772 | 757 |
| 773 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 758 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 774 return delegated_frame_host_->CanCopyToBitmap(); | 759 return delegated_frame_host_->CanCopyToBitmap(); |
| 775 } | 760 } |
| 776 | 761 |
| 777 void RenderWidgetHostViewAura::Show() { | 762 void RenderWidgetHostViewAura::Show() { |
| 778 window_->Show(); | 763 window_->Show(); |
| 779 WasShown(); | 764 WasShown(); |
| 780 #if defined(OS_WIN) | |
| 781 if (legacy_render_widget_host_HWND_) | |
| 782 legacy_render_widget_host_HWND_->Show(); | |
| 783 #endif | |
| 784 } | 765 } |
| 785 | 766 |
| 786 void RenderWidgetHostViewAura::Hide() { | 767 void RenderWidgetHostViewAura::Hide() { |
| 787 window_->Hide(); | 768 window_->Hide(); |
| 788 WasHidden(); | 769 WasHidden(); |
| 789 #if defined(OS_WIN) | |
| 790 if (legacy_render_widget_host_HWND_) | |
| 791 legacy_render_widget_host_HWND_->Hide(); | |
| 792 #endif | |
| 793 } | 770 } |
| 794 | 771 |
| 795 bool RenderWidgetHostViewAura::IsShowing() { | 772 bool RenderWidgetHostViewAura::IsShowing() { |
| 796 return window_->IsVisible(); | 773 return window_->IsVisible(); |
| 797 } | 774 } |
| 798 | 775 |
| 799 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 776 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 800 return window_->GetBoundsInScreen(); | 777 return window_->GetBoundsInScreen(); |
| 801 } | 778 } |
| 802 | 779 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 972 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
| 996 } | 973 } |
| 997 | 974 |
| 998 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 975 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
| 999 // Clip the cursor if chrome is running on regular desktop. | 976 // Clip the cursor if chrome is running on regular desktop. |
| 1000 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { | 977 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { |
| 1001 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); | 978 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); |
| 1002 ::ClipCursor(&window_rect); | 979 ::ClipCursor(&window_rect); |
| 1003 } | 980 } |
| 1004 } | 981 } |
| 1005 | 982 #endif // defined(OS_WIN) |
| 1006 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | |
| 1007 legacy_render_widget_host_HWND_ = NULL; | |
| 1008 legacy_window_destroyed_ = true; | |
| 1009 } | |
| 1010 #endif | |
| 1011 | 983 |
| 1012 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 984 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
| 1013 uint32 output_surface_id, | 985 uint32 output_surface_id, |
| 1014 scoped_ptr<cc::CompositorFrame> frame) { | 986 scoped_ptr<cc::CompositorFrame> frame) { |
| 1015 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 987 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
| 1016 | 988 |
| 1017 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 989 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
| 1018 if (frame->delegated_frame_data) { | 990 if (frame->delegated_frame_data) { |
| 1019 delegated_frame_host_->SwapDelegatedFrame( | 991 delegated_frame_host_->SwapDelegatedFrame( |
| 1020 output_surface_id, | 992 output_surface_id, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1032 return; | 1004 return; |
| 1033 } | 1005 } |
| 1034 } | 1006 } |
| 1035 | 1007 |
| 1036 void RenderWidgetHostViewAura::DidStopFlinging() { | 1008 void RenderWidgetHostViewAura::DidStopFlinging() { |
| 1037 if (touch_editing_client_) | 1009 if (touch_editing_client_) |
| 1038 touch_editing_client_->DidStopFlinging(); | 1010 touch_editing_client_->DidStopFlinging(); |
| 1039 } | 1011 } |
| 1040 | 1012 |
| 1041 #if defined(OS_WIN) | 1013 #if defined(OS_WIN) |
| 1014 void RenderWidgetHostViewAura::SetLegacyRenderWidgetHostHWND( |
| 1015 LegacyRenderWidgetHostHWND* legacy_hwnd) { |
| 1016 legacy_render_widget_host_HWND_ = legacy_hwnd; |
| 1017 } |
| 1018 |
| 1042 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1019 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
| 1043 gfx::NativeViewAccessible accessible_parent) { | 1020 gfx::NativeViewAccessible accessible_parent) { |
| 1044 } | 1021 } |
| 1045 | 1022 |
| 1046 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1023 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
| 1047 const { | 1024 const { |
| 1048 if (legacy_render_widget_host_HWND_) { | 1025 if (legacy_render_widget_host_HWND_) { |
| 1049 return reinterpret_cast<gfx::NativeViewId>( | 1026 return reinterpret_cast<gfx::NativeViewId>( |
| 1050 legacy_render_widget_host_HWND_->hwnd()); | 1027 legacy_render_widget_host_HWND_->hwnd()); |
| 1051 } | 1028 } |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 HWND parent = NULL; | 1684 HWND parent = NULL; |
| 1708 // If the tab was hidden and it's closed, host_->is_hidden would have been | 1685 // If the tab was hidden and it's closed, host_->is_hidden would have been |
| 1709 // reset to false in RenderWidgetHostImpl::RendererExited. | 1686 // reset to false in RenderWidgetHostImpl::RendererExited. |
| 1710 if (!window_->GetRootWindow() || host_->is_hidden()) { | 1687 if (!window_->GetRootWindow() || host_->is_hidden()) { |
| 1711 parent = ui::GetHiddenWindow(); | 1688 parent = ui::GetHiddenWindow(); |
| 1712 } else { | 1689 } else { |
| 1713 parent = window_->GetHost()->GetAcceleratedWidget(); | 1690 parent = window_->GetHost()->GetAcceleratedWidget(); |
| 1714 } | 1691 } |
| 1715 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 1692 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 1716 EnumChildWindows(parent, WindowDestroyingCallback, lparam); | 1693 EnumChildWindows(parent, WindowDestroyingCallback, lparam); |
| 1717 | 1694 legacy_render_widget_host_HWND_ = NULL; |
| 1718 // The LegacyRenderWidgetHostHWND instance is destroyed when its window is | |
| 1719 // destroyed. Normally we control when that happens via the Destroy call | |
| 1720 // in the dtor. However there may be cases where the window is destroyed | |
| 1721 // by Windows, i.e. the parent window is destroyed before the | |
| 1722 // RenderWidgetHostViewAura instance goes away etc. To avoid that we | |
| 1723 // destroy the LegacyRenderWidgetHostHWND instance here. | |
| 1724 if (legacy_render_widget_host_HWND_) { | |
| 1725 legacy_render_widget_host_HWND_->set_host(NULL); | |
| 1726 legacy_render_widget_host_HWND_->Destroy(); | |
| 1727 // The Destroy call above will delete the LegacyRenderWidgetHostHWND | |
| 1728 // instance. | |
| 1729 legacy_render_widget_host_HWND_ = NULL; | |
| 1730 } | |
| 1731 #endif | 1695 #endif |
| 1732 | 1696 |
| 1733 // Make sure that the input method no longer references to this object before | 1697 // Make sure that the input method no longer references to this object before |
| 1734 // this object is removed from the root window (i.e. this object loses access | 1698 // this object is removed from the root window (i.e. this object loses access |
| 1735 // to the input method). | 1699 // to the input method). |
| 1736 ui::InputMethod* input_method = GetInputMethod(); | 1700 ui::InputMethod* input_method = GetInputMethod(); |
| 1737 if (input_method) | 1701 if (input_method) |
| 1738 input_method->DetachTextInputClient(this); | 1702 input_method->DetachTextInputClient(this); |
| 1739 | 1703 |
| 1740 if (overscroll_controller_) | 1704 if (overscroll_controller_) |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 popup_child_host_view_->popup_parent_host_view_ = NULL; | 2186 popup_child_host_view_->popup_parent_host_view_ = NULL; |
| 2223 } | 2187 } |
| 2224 event_filter_for_popup_exit_.reset(); | 2188 event_filter_for_popup_exit_.reset(); |
| 2225 aura::client::SetTooltipText(window_, NULL); | 2189 aura::client::SetTooltipText(window_, NULL); |
| 2226 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); | 2190 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); |
| 2227 | 2191 |
| 2228 // This call is usually no-op since |this| object is already removed from the | 2192 // This call is usually no-op since |this| object is already removed from the |
| 2229 // Aura root window and we don't have a way to get an input method object | 2193 // Aura root window and we don't have a way to get an input method object |
| 2230 // associated with the window, but just in case. | 2194 // associated with the window, but just in case. |
| 2231 DetachFromInputMethod(); | 2195 DetachFromInputMethod(); |
| 2232 | |
| 2233 #if defined(OS_WIN) | |
| 2234 // The LegacyRenderWidgetHostHWND window should have been destroyed in | |
| 2235 // RenderWidgetHostViewAura::OnWindowDestroying and the pointer should | |
| 2236 // be set to NULL. | |
| 2237 DCHECK(!legacy_render_widget_host_HWND_); | |
| 2238 #endif | |
| 2239 } | 2196 } |
| 2240 | 2197 |
| 2241 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2198 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 2242 const gfx::Point screen_point = | 2199 const gfx::Point screen_point = |
| 2243 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 2200 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
| 2244 aura::Window* root_window = window_->GetRootWindow(); | 2201 aura::Window* root_window = window_->GetRootWindow(); |
| 2245 if (!root_window) | 2202 if (!root_window) |
| 2246 return; | 2203 return; |
| 2247 | 2204 |
| 2248 gfx::Point root_window_point = screen_point; | 2205 gfx::Point root_window_point = screen_point; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 // a Window::SetBoundsInternal call. | 2335 // a Window::SetBoundsInternal call. |
| 2379 if (!in_bounds_changed_) | 2336 if (!in_bounds_changed_) |
| 2380 window_->SetBounds(rect); | 2337 window_->SetBounds(rect); |
| 2381 host_->WasResized(); | 2338 host_->WasResized(); |
| 2382 delegated_frame_host_->WasResized(); | 2339 delegated_frame_host_->WasResized(); |
| 2383 if (touch_editing_client_) { | 2340 if (touch_editing_client_) { |
| 2384 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 2341 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
| 2385 selection_focus_rect_); | 2342 selection_focus_rect_); |
| 2386 } | 2343 } |
| 2387 #if defined(OS_WIN) | 2344 #if defined(OS_WIN) |
| 2388 // Create the legacy dummy window which corresponds to the bounds of the | |
| 2389 // webcontents. This will be passed as the container window for windowless | |
| 2390 // plugins. | |
| 2391 // Plugins like Flash assume the container window which is returned via the | |
| 2392 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | |
| 2393 // This is not true in Aura where we have only HWND which is the main Aura | |
| 2394 // window. If we return this window to plugins like Flash then it causes the | |
| 2395 // coordinate translations done by these plugins to break. | |
| 2396 // Additonally the legacy dummy window is needed for accessibility and for | |
| 2397 // scrolling to work in legacy drivers for trackpoints/trackpads, etc. | |
| 2398 if (!legacy_window_destroyed_ && GetNativeViewId()) { | |
| 2399 if (!legacy_render_widget_host_HWND_) { | |
| 2400 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create( | |
| 2401 reinterpret_cast<HWND>(GetNativeViewId())); | |
| 2402 } | |
| 2403 if (legacy_render_widget_host_HWND_) { | |
| 2404 legacy_render_widget_host_HWND_->set_host(this); | |
| 2405 legacy_render_widget_host_HWND_->SetBounds( | |
| 2406 window_->GetBoundsInRootWindow()); | |
| 2407 // There are cases where the parent window is created, made visible and | |
| 2408 // the associated RenderWidget is also visible before the | |
| 2409 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown | |
| 2410 // here. | |
| 2411 if (!host_->is_hidden()) | |
| 2412 legacy_render_widget_host_HWND_->Show(); | |
| 2413 } | |
| 2414 } | |
| 2415 | |
| 2416 if (mouse_locked_) | 2345 if (mouse_locked_) |
| 2417 UpdateMouseLockRegion(); | 2346 UpdateMouseLockRegion(); |
| 2418 #endif | 2347 #endif |
| 2419 } | 2348 } |
| 2420 | 2349 |
| 2421 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( | 2350 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( |
| 2422 const gfx::Rect& rect, | 2351 const gfx::Rect& rect, |
| 2423 const gfx::Rect& clip) { | 2352 const gfx::Rect& clip) { |
| 2424 if (!clip.IsEmpty()) { | 2353 if (!clip.IsEmpty()) { |
| 2425 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); | 2354 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2451 if (cursor_client) { | 2380 if (cursor_client) { |
| 2452 cursor_client->AddObserver(this); | 2381 cursor_client->AddObserver(this); |
| 2453 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 2382 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 2454 } | 2383 } |
| 2455 if (HasFocus()) { | 2384 if (HasFocus()) { |
| 2456 ui::InputMethod* input_method = GetInputMethod(); | 2385 ui::InputMethod* input_method = GetInputMethod(); |
| 2457 if (input_method) | 2386 if (input_method) |
| 2458 input_method->SetFocusedTextInputClient(this); | 2387 input_method->SetFocusedTextInputClient(this); |
| 2459 } | 2388 } |
| 2460 | 2389 |
| 2461 #if defined(OS_WIN) | |
| 2462 // The parent may have changed here. Ensure that the legacy window is | |
| 2463 // reparented accordingly. | |
| 2464 if (legacy_render_widget_host_HWND_) | |
| 2465 legacy_render_widget_host_HWND_->UpdateParent( | |
| 2466 reinterpret_cast<HWND>(GetNativeViewId())); | |
| 2467 #endif | |
| 2468 | |
| 2469 delegated_frame_host_->AddedToWindow(); | 2390 delegated_frame_host_->AddedToWindow(); |
| 2470 } | 2391 } |
| 2471 | 2392 |
| 2472 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 2393 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
| 2473 aura::client::CursorClient* cursor_client = | 2394 aura::client::CursorClient* cursor_client = |
| 2474 aura::client::GetCursorClient(window_->GetRootWindow()); | 2395 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 2475 if (cursor_client) | 2396 if (cursor_client) |
| 2476 cursor_client->RemoveObserver(this); | 2397 cursor_client->RemoveObserver(this); |
| 2477 | 2398 |
| 2478 DetachFromInputMethod(); | 2399 DetachFromInputMethod(); |
| 2479 | 2400 |
| 2480 window_->GetHost()->RemoveObserver(this); | 2401 window_->GetHost()->RemoveObserver(this); |
| 2481 delegated_frame_host_->RemovingFromWindow(); | 2402 delegated_frame_host_->RemovingFromWindow(); |
| 2482 | |
| 2483 #if defined(OS_WIN) | |
| 2484 // Update the legacy window's parent temporarily to the desktop window. It | |
| 2485 // will eventually get reparented to the right root. | |
| 2486 if (legacy_render_widget_host_HWND_) | |
| 2487 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); | |
| 2488 #endif | |
| 2489 } | 2403 } |
| 2490 | 2404 |
| 2491 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2405 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
| 2492 ui::InputMethod* input_method = GetInputMethod(); | 2406 ui::InputMethod* input_method = GetInputMethod(); |
| 2493 if (input_method && input_method->GetTextInputClient() == this) | 2407 if (input_method && input_method->GetTextInputClient() == this) |
| 2494 input_method->SetFocusedTextInputClient(NULL); | 2408 input_method->SetFocusedTextInputClient(NULL); |
| 2495 } | 2409 } |
| 2496 | 2410 |
| 2497 void RenderWidgetHostViewAura::ForwardKeyboardEvent( | 2411 void RenderWidgetHostViewAura::ForwardKeyboardEvent( |
| 2498 const NativeWebKeyboardEvent& event) { | 2412 const NativeWebKeyboardEvent& event) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 | 2490 |
| 2577 //////////////////////////////////////////////////////////////////////////////// | 2491 //////////////////////////////////////////////////////////////////////////////// |
| 2578 // RenderWidgetHostViewBase, public: | 2492 // RenderWidgetHostViewBase, public: |
| 2579 | 2493 |
| 2580 // static | 2494 // static |
| 2581 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2495 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2582 GetScreenInfoForWindow(results, NULL); | 2496 GetScreenInfoForWindow(results, NULL); |
| 2583 } | 2497 } |
| 2584 | 2498 |
| 2585 } // namespace content | 2499 } // namespace content |
| OLD | NEW |