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