| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 437 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| 438 can_compose_inline_(true), | 438 can_compose_inline_(true), |
| 439 has_composition_text_(false), | 439 has_composition_text_(false), |
| 440 accept_return_character_(false), | 440 accept_return_character_(false), |
| 441 last_swapped_software_frame_scale_factor_(1.f), | 441 last_swapped_software_frame_scale_factor_(1.f), |
| 442 paint_canvas_(NULL), | 442 paint_canvas_(NULL), |
| 443 synthetic_move_sent_(false), | 443 synthetic_move_sent_(false), |
| 444 cursor_visibility_state_in_renderer_(UNKNOWN), | 444 cursor_visibility_state_in_renderer_(UNKNOWN), |
| 445 #if defined(OS_WIN) | 445 #if defined(OS_WIN) |
| 446 legacy_render_widget_host_HWND_(NULL), | 446 legacy_render_widget_host_HWND_(NULL), |
| 447 legacy_window_destroyed_(false), | |
| 448 #endif | 447 #endif |
| 449 touch_editing_client_(NULL), | 448 touch_editing_client_(NULL), |
| 450 weak_ptr_factory_(this) { | 449 weak_ptr_factory_(this) { |
| 451 host_->SetView(this); | 450 host_->SetView(this); |
| 452 window_observer_.reset(new WindowObserver(this)); | 451 window_observer_.reset(new WindowObserver(this)); |
| 453 aura::client::SetTooltipText(window_, &tooltip_); | 452 aura::client::SetTooltipText(window_, &tooltip_); |
| 454 aura::client::SetActivationDelegate(window_, this); | 453 aura::client::SetActivationDelegate(window_, this); |
| 455 aura::client::SetActivationChangeObserver(window_, this); | 454 aura::client::SetActivationChangeObserver(window_, this); |
| 456 aura::client::SetFocusChangeObserver(window_, this); | 455 aura::client::SetFocusChangeObserver(window_, this); |
| 457 window_->set_layer_owner_delegate(delegated_frame_host_.get()); | 456 window_->set_layer_owner_delegate(delegated_frame_host_.get()); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 if (root) { | 559 if (root) { |
| 561 aura::client::CursorClient* cursor_client = | 560 aura::client::CursorClient* cursor_client = |
| 562 aura::client::GetCursorClient(root); | 561 aura::client::GetCursorClient(root); |
| 563 if (cursor_client) | 562 if (cursor_client) |
| 564 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 563 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 565 } | 564 } |
| 566 | 565 |
| 567 delegated_frame_host_->WasShown(); | 566 delegated_frame_host_->WasShown(); |
| 568 | 567 |
| 569 #if defined(OS_WIN) | 568 #if defined(OS_WIN) |
| 570 if (legacy_render_widget_host_HWND_) { | |
| 571 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent | |
| 572 // window before reparenting any plugins. This ensures that the plugin | |
| 573 // windows stay on top of the child Zorder in the parent and receive | |
| 574 // mouse events, etc. | |
| 575 legacy_render_widget_host_HWND_->UpdateParent( | |
| 576 GetNativeView()->GetHost()->GetAcceleratedWidget()); | |
| 577 legacy_render_widget_host_HWND_->SetBounds( | |
| 578 window_->GetBoundsInRootWindow()); | |
| 579 } | |
| 580 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 569 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 581 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 570 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
| 582 #endif | 571 #endif |
| 583 } | 572 } |
| 584 | 573 |
| 585 void RenderWidgetHostViewAura::WasHidden() { | 574 void RenderWidgetHostViewAura::WasHidden() { |
| 586 if (!host_ || host_->is_hidden()) | 575 if (!host_ || host_->is_hidden()) |
| 587 return; | 576 return; |
| 588 host_->WasHidden(); | 577 host_->WasHidden(); |
| 589 delegated_frame_host_->WasHidden(); | 578 delegated_frame_host_->WasHidden(); |
| 590 | 579 |
| 591 #if defined(OS_WIN) | 580 #if defined(OS_WIN) |
| 592 constrained_rects_.clear(); | 581 constrained_rects_.clear(); |
| 593 aura::WindowTreeHost* host = window_->GetHost(); | 582 aura::WindowTreeHost* host = window_->GetHost(); |
| 594 if (host) { | 583 if (host) { |
| 595 HWND parent = host->GetAcceleratedWidget(); | 584 HWND parent = host->GetAcceleratedWidget(); |
| 596 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 585 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 597 EnumChildWindows(parent, HideWindowsCallback, lparam); | 586 EnumChildWindows(parent, HideWindowsCallback, lparam); |
| 598 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global | |
| 599 // hidden window on the same lines as Windowed plugin windows. | |
| 600 if (legacy_render_widget_host_HWND_) | |
| 601 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); | |
| 602 } | 587 } |
| 603 #endif | 588 #endif |
| 604 } | 589 } |
| 605 | 590 |
| 606 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 591 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 607 // For a SetSize operation, we don't care what coordinate system the origin | 592 // For a SetSize operation, we don't care what coordinate system the origin |
| 608 // of the window is in, it's only important to make sure that the origin | 593 // of the window is in, it's only important to make sure that the origin |
| 609 // remains constant after the operation. | 594 // remains constant after the operation. |
| 610 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 595 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
| 611 } | 596 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 return window_->HasFocus(); | 737 return window_->HasFocus(); |
| 753 } | 738 } |
| 754 | 739 |
| 755 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 740 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 756 return delegated_frame_host_->CanCopyToBitmap(); | 741 return delegated_frame_host_->CanCopyToBitmap(); |
| 757 } | 742 } |
| 758 | 743 |
| 759 void RenderWidgetHostViewAura::Show() { | 744 void RenderWidgetHostViewAura::Show() { |
| 760 window_->Show(); | 745 window_->Show(); |
| 761 WasShown(); | 746 WasShown(); |
| 762 #if defined(OS_WIN) | |
| 763 if (legacy_render_widget_host_HWND_) | |
| 764 legacy_render_widget_host_HWND_->Show(); | |
| 765 #endif | |
| 766 } | 747 } |
| 767 | 748 |
| 768 void RenderWidgetHostViewAura::Hide() { | 749 void RenderWidgetHostViewAura::Hide() { |
| 769 window_->Hide(); | 750 window_->Hide(); |
| 770 WasHidden(); | 751 WasHidden(); |
| 771 #if defined(OS_WIN) | |
| 772 if (legacy_render_widget_host_HWND_) | |
| 773 legacy_render_widget_host_HWND_->Hide(); | |
| 774 #endif | |
| 775 } | 752 } |
| 776 | 753 |
| 777 bool RenderWidgetHostViewAura::IsShowing() { | 754 bool RenderWidgetHostViewAura::IsShowing() { |
| 778 return window_->IsVisible(); | 755 return window_->IsVisible(); |
| 779 } | 756 } |
| 780 | 757 |
| 781 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 758 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 782 return window_->GetBoundsInScreen(); | 759 return window_->GetBoundsInScreen(); |
| 783 } | 760 } |
| 784 | 761 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 970 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
| 994 } | 971 } |
| 995 | 972 |
| 996 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 973 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
| 997 // Clip the cursor if chrome is running on regular desktop. | 974 // Clip the cursor if chrome is running on regular desktop. |
| 998 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { | 975 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { |
| 999 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); | 976 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); |
| 1000 ::ClipCursor(&window_rect); | 977 ::ClipCursor(&window_rect); |
| 1001 } | 978 } |
| 1002 } | 979 } |
| 1003 | 980 #endif // defined(OS_WIN) |
| 1004 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | |
| 1005 legacy_render_widget_host_HWND_ = NULL; | |
| 1006 legacy_window_destroyed_ = true; | |
| 1007 } | |
| 1008 #endif | |
| 1009 | 981 |
| 1010 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 982 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
| 1011 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, | 983 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
| 1012 int gpu_host_id) { | 984 int gpu_host_id) { |
| 1013 // Oldschool composited mode is no longer supported. | 985 // Oldschool composited mode is no longer supported. |
| 1014 } | 986 } |
| 1015 | 987 |
| 1016 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 988 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
| 1017 uint32 output_surface_id, | 989 uint32 output_surface_id, |
| 1018 scoped_ptr<cc::CompositorFrame> frame) { | 990 scoped_ptr<cc::CompositorFrame> frame) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1029 if (frame->software_frame_data) { | 1001 if (frame->software_frame_data) { |
| 1030 DLOG(ERROR) << "Unable to use software frame in aura"; | 1002 DLOG(ERROR) << "Unable to use software frame in aura"; |
| 1031 RecordAction( | 1003 RecordAction( |
| 1032 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); | 1004 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); |
| 1033 host_->GetProcess()->ReceivedBadMessage(); | 1005 host_->GetProcess()->ReceivedBadMessage(); |
| 1034 return; | 1006 return; |
| 1035 } | 1007 } |
| 1036 } | 1008 } |
| 1037 | 1009 |
| 1038 #if defined(OS_WIN) | 1010 #if defined(OS_WIN) |
| 1011 void RenderWidgetHostViewAura::SetLegacyRenderWidgetHostHWND( |
| 1012 LegacyRenderWidgetHostHWND* legacy_hwnd) { |
| 1013 legacy_render_widget_host_HWND_ = legacy_hwnd; |
| 1014 } |
| 1015 |
| 1039 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1016 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
| 1040 gfx::NativeViewAccessible accessible_parent) { | 1017 gfx::NativeViewAccessible accessible_parent) { |
| 1041 BrowserAccessibilityManager* manager = | 1018 BrowserAccessibilityManager* manager = |
| 1042 host_->GetRootBrowserAccessibilityManager(); | 1019 host_->GetRootBrowserAccessibilityManager(); |
| 1043 if (manager) { | 1020 if (manager) { |
| 1044 manager->ToBrowserAccessibilityManagerWin() | 1021 manager->ToBrowserAccessibilityManagerWin() |
| 1045 ->set_parent_iaccessible(accessible_parent); | 1022 ->set_parent_iaccessible(accessible_parent); |
| 1046 } | 1023 } |
| 1047 } | 1024 } |
| 1048 | 1025 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 HWND parent = NULL; | 1599 HWND parent = NULL; |
| 1623 // If the tab was hidden and it's closed, host_->is_hidden would have been | 1600 // If the tab was hidden and it's closed, host_->is_hidden would have been |
| 1624 // reset to false in RenderWidgetHostImpl::RendererExited. | 1601 // reset to false in RenderWidgetHostImpl::RendererExited. |
| 1625 if (!window_->GetRootWindow() || host_->is_hidden()) { | 1602 if (!window_->GetRootWindow() || host_->is_hidden()) { |
| 1626 parent = ui::GetHiddenWindow(); | 1603 parent = ui::GetHiddenWindow(); |
| 1627 } else { | 1604 } else { |
| 1628 parent = window_->GetHost()->GetAcceleratedWidget(); | 1605 parent = window_->GetHost()->GetAcceleratedWidget(); |
| 1629 } | 1606 } |
| 1630 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 1607 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 1631 EnumChildWindows(parent, WindowDestroyingCallback, lparam); | 1608 EnumChildWindows(parent, WindowDestroyingCallback, lparam); |
| 1632 | 1609 legacy_render_widget_host_HWND_ = NULL; |
| 1633 // The LegacyRenderWidgetHostHWND instance is destroyed when its window is | |
| 1634 // destroyed. Normally we control when that happens via the Destroy call | |
| 1635 // in the dtor. However there may be cases where the window is destroyed | |
| 1636 // by Windows, i.e. the parent window is destroyed before the | |
| 1637 // RenderWidgetHostViewAura instance goes away etc. To avoid that we | |
| 1638 // destroy the LegacyRenderWidgetHostHWND instance here. | |
| 1639 if (legacy_render_widget_host_HWND_) { | |
| 1640 legacy_render_widget_host_HWND_->set_host(NULL); | |
| 1641 legacy_render_widget_host_HWND_->Destroy(); | |
| 1642 // The Destroy call above will delete the LegacyRenderWidgetHostHWND | |
| 1643 // instance. | |
| 1644 legacy_render_widget_host_HWND_ = NULL; | |
| 1645 } | |
| 1646 #endif | 1610 #endif |
| 1647 | 1611 |
| 1648 // Make sure that the input method no longer references to this object before | 1612 // Make sure that the input method no longer references to this object before |
| 1649 // this object is removed from the root window (i.e. this object loses access | 1613 // this object is removed from the root window (i.e. this object loses access |
| 1650 // to the input method). | 1614 // to the input method). |
| 1651 ui::InputMethod* input_method = GetInputMethod(); | 1615 ui::InputMethod* input_method = GetInputMethod(); |
| 1652 if (input_method) | 1616 if (input_method) |
| 1653 input_method->DetachTextInputClient(this); | 1617 input_method->DetachTextInputClient(this); |
| 1654 | 1618 |
| 1655 if (overscroll_controller_) | 1619 if (overscroll_controller_) |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2125 popup_child_host_view_->popup_parent_host_view_ = NULL; | 2089 popup_child_host_view_->popup_parent_host_view_ = NULL; |
| 2126 } | 2090 } |
| 2127 event_filter_for_popup_exit_.reset(); | 2091 event_filter_for_popup_exit_.reset(); |
| 2128 aura::client::SetTooltipText(window_, NULL); | 2092 aura::client::SetTooltipText(window_, NULL); |
| 2129 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); | 2093 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); |
| 2130 | 2094 |
| 2131 // This call is usually no-op since |this| object is already removed from the | 2095 // This call is usually no-op since |this| object is already removed from the |
| 2132 // Aura root window and we don't have a way to get an input method object | 2096 // Aura root window and we don't have a way to get an input method object |
| 2133 // associated with the window, but just in case. | 2097 // associated with the window, but just in case. |
| 2134 DetachFromInputMethod(); | 2098 DetachFromInputMethod(); |
| 2135 | |
| 2136 #if defined(OS_WIN) | |
| 2137 // The LegacyRenderWidgetHostHWND window should have been destroyed in | |
| 2138 // RenderWidgetHostViewAura::OnWindowDestroying and the pointer should | |
| 2139 // be set to NULL. | |
| 2140 DCHECK(!legacy_render_widget_host_HWND_); | |
| 2141 #endif | |
| 2142 } | 2099 } |
| 2143 | 2100 |
| 2144 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2101 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 2145 const gfx::Point screen_point = | 2102 const gfx::Point screen_point = |
| 2146 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 2103 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
| 2147 aura::Window* root_window = window_->GetRootWindow(); | 2104 aura::Window* root_window = window_->GetRootWindow(); |
| 2148 if (!root_window) | 2105 if (!root_window) |
| 2149 return; | 2106 return; |
| 2150 | 2107 |
| 2151 gfx::Point root_window_point = screen_point; | 2108 gfx::Point root_window_point = screen_point; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 // a Window::SetBoundsInternal call. | 2227 // a Window::SetBoundsInternal call. |
| 2271 if (!in_bounds_changed_) | 2228 if (!in_bounds_changed_) |
| 2272 window_->SetBounds(rect); | 2229 window_->SetBounds(rect); |
| 2273 host_->WasResized(); | 2230 host_->WasResized(); |
| 2274 delegated_frame_host_->WasResized(); | 2231 delegated_frame_host_->WasResized(); |
| 2275 if (touch_editing_client_) { | 2232 if (touch_editing_client_) { |
| 2276 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 2233 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
| 2277 selection_focus_rect_); | 2234 selection_focus_rect_); |
| 2278 } | 2235 } |
| 2279 #if defined(OS_WIN) | 2236 #if defined(OS_WIN) |
| 2280 // Create the legacy dummy window which corresponds to the bounds of the | |
| 2281 // webcontents. This will be passed as the container window for windowless | |
| 2282 // plugins. | |
| 2283 // Plugins like Flash assume the container window which is returned via the | |
| 2284 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | |
| 2285 // This is not true in Aura where we have only HWND which is the main Aura | |
| 2286 // window. If we return this window to plugins like Flash then it causes the | |
| 2287 // coordinate translations done by these plugins to break. | |
| 2288 // Additonally the legacy dummy window is needed for accessibility and for | |
| 2289 // scrolling to work in legacy drivers for trackpoints/trackpads, etc. | |
| 2290 if (!legacy_window_destroyed_ && GetNativeViewId()) { | |
| 2291 if (!legacy_render_widget_host_HWND_) { | |
| 2292 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create( | |
| 2293 reinterpret_cast<HWND>(GetNativeViewId())); | |
| 2294 } | |
| 2295 if (legacy_render_widget_host_HWND_) { | |
| 2296 legacy_render_widget_host_HWND_->set_host(this); | |
| 2297 legacy_render_widget_host_HWND_->SetBounds( | |
| 2298 window_->GetBoundsInRootWindow()); | |
| 2299 // There are cases where the parent window is created, made visible and | |
| 2300 // the associated RenderWidget is also visible before the | |
| 2301 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown | |
| 2302 // here. | |
| 2303 if (!host_->is_hidden()) | |
| 2304 legacy_render_widget_host_HWND_->Show(); | |
| 2305 | |
| 2306 BrowserAccessibilityManagerWin* manager = | |
| 2307 static_cast<BrowserAccessibilityManagerWin*>( | |
| 2308 host_->GetRootBrowserAccessibilityManager()); | |
| 2309 if (manager) | |
| 2310 manager->SetAccessibleHWND(legacy_render_widget_host_HWND_); | |
| 2311 } | |
| 2312 } | |
| 2313 | |
| 2314 if (mouse_locked_) | 2237 if (mouse_locked_) |
| 2315 UpdateMouseLockRegion(); | 2238 UpdateMouseLockRegion(); |
| 2316 #endif | 2239 #endif |
| 2317 } | 2240 } |
| 2318 | 2241 |
| 2319 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( | 2242 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( |
| 2320 const gfx::Rect& rect, | 2243 const gfx::Rect& rect, |
| 2321 const gfx::Rect& clip) { | 2244 const gfx::Rect& clip) { |
| 2322 if (!clip.IsEmpty()) { | 2245 if (!clip.IsEmpty()) { |
| 2323 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); | 2246 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2349 if (cursor_client) { | 2272 if (cursor_client) { |
| 2350 cursor_client->AddObserver(this); | 2273 cursor_client->AddObserver(this); |
| 2351 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 2274 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 2352 } | 2275 } |
| 2353 if (HasFocus()) { | 2276 if (HasFocus()) { |
| 2354 ui::InputMethod* input_method = GetInputMethod(); | 2277 ui::InputMethod* input_method = GetInputMethod(); |
| 2355 if (input_method) | 2278 if (input_method) |
| 2356 input_method->SetFocusedTextInputClient(this); | 2279 input_method->SetFocusedTextInputClient(this); |
| 2357 } | 2280 } |
| 2358 | 2281 |
| 2359 #if defined(OS_WIN) | |
| 2360 // The parent may have changed here. Ensure that the legacy window is | |
| 2361 // reparented accordingly. | |
| 2362 if (legacy_render_widget_host_HWND_) | |
| 2363 legacy_render_widget_host_HWND_->UpdateParent( | |
| 2364 reinterpret_cast<HWND>(GetNativeViewId())); | |
| 2365 #endif | |
| 2366 | |
| 2367 delegated_frame_host_->AddedToWindow(); | 2282 delegated_frame_host_->AddedToWindow(); |
| 2368 } | 2283 } |
| 2369 | 2284 |
| 2370 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 2285 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
| 2371 aura::client::CursorClient* cursor_client = | 2286 aura::client::CursorClient* cursor_client = |
| 2372 aura::client::GetCursorClient(window_->GetRootWindow()); | 2287 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 2373 if (cursor_client) | 2288 if (cursor_client) |
| 2374 cursor_client->RemoveObserver(this); | 2289 cursor_client->RemoveObserver(this); |
| 2375 | 2290 |
| 2376 DetachFromInputMethod(); | 2291 DetachFromInputMethod(); |
| 2377 | 2292 |
| 2378 window_->GetHost()->RemoveObserver(this); | 2293 window_->GetHost()->RemoveObserver(this); |
| 2379 delegated_frame_host_->RemovingFromWindow(); | 2294 delegated_frame_host_->RemovingFromWindow(); |
| 2380 | |
| 2381 #if defined(OS_WIN) | |
| 2382 // Update the legacy window's parent temporarily to the desktop window. It | |
| 2383 // will eventually get reparented to the right root. | |
| 2384 if (legacy_render_widget_host_HWND_) | |
| 2385 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); | |
| 2386 #endif | |
| 2387 } | 2295 } |
| 2388 | 2296 |
| 2389 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2297 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
| 2390 ui::InputMethod* input_method = GetInputMethod(); | 2298 ui::InputMethod* input_method = GetInputMethod(); |
| 2391 if (input_method && input_method->GetTextInputClient() == this) | 2299 if (input_method && input_method->GetTextInputClient() == this) |
| 2392 input_method->SetFocusedTextInputClient(NULL); | 2300 input_method->SetFocusedTextInputClient(NULL); |
| 2393 } | 2301 } |
| 2394 | 2302 |
| 2395 void RenderWidgetHostViewAura::ForwardKeyboardEvent( | 2303 void RenderWidgetHostViewAura::ForwardKeyboardEvent( |
| 2396 const NativeWebKeyboardEvent& event) { | 2304 const NativeWebKeyboardEvent& event) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 | 2387 |
| 2480 //////////////////////////////////////////////////////////////////////////////// | 2388 //////////////////////////////////////////////////////////////////////////////// |
| 2481 // RenderWidgetHostViewBase, public: | 2389 // RenderWidgetHostViewBase, public: |
| 2482 | 2390 |
| 2483 // static | 2391 // static |
| 2484 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2392 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2485 GetScreenInfoForWindow(results, NULL); | 2393 GetScreenInfoForWindow(results, NULL); |
| 2486 } | 2394 } |
| 2487 | 2395 |
| 2488 } // namespace content | 2396 } // namespace content |
| OLD | NEW |