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_flags_(0), | 441 text_input_flags_(0), |
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 is_guest_view_hack_(is_guest_view_hack), | 454 is_guest_view_hack_(is_guest_view_hack), |
456 weak_ptr_factory_(this) { | 455 weak_ptr_factory_(this) { |
457 if (!is_guest_view_hack_) | 456 if (!is_guest_view_hack_) |
458 host_->SetView(this); | 457 host_->SetView(this); |
459 | 458 |
460 window_observer_.reset(new WindowObserver(this)); | 459 window_observer_.reset(new WindowObserver(this)); |
461 aura::client::SetTooltipText(window_, &tooltip_); | 460 aura::client::SetTooltipText(window_, &tooltip_); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 if (root) { | 594 if (root) { |
596 aura::client::CursorClient* cursor_client = | 595 aura::client::CursorClient* cursor_client = |
597 aura::client::GetCursorClient(root); | 596 aura::client::GetCursorClient(root); |
598 if (cursor_client) | 597 if (cursor_client) |
599 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 598 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
600 } | 599 } |
601 | 600 |
602 delegated_frame_host_->WasShown(browser_latency_info); | 601 delegated_frame_host_->WasShown(browser_latency_info); |
603 | 602 |
604 #if defined(OS_WIN) | 603 #if defined(OS_WIN) |
605 if (legacy_render_widget_host_HWND_) { | |
606 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent | |
607 // window before reparenting any plugins. This ensures that the plugin | |
608 // windows stay on top of the child Zorder in the parent and receive | |
609 // mouse events, etc. | |
610 legacy_render_widget_host_HWND_->UpdateParent( | |
611 GetNativeView()->GetHost()->GetAcceleratedWidget()); | |
612 legacy_render_widget_host_HWND_->SetBounds( | |
613 window_->GetBoundsInRootWindow()); | |
614 } | |
615 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 604 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
616 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 605 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
617 #endif | 606 #endif |
618 } | 607 } |
619 | 608 |
620 void RenderWidgetHostViewAura::WasHidden() { | 609 void RenderWidgetHostViewAura::WasHidden() { |
621 if (!host_ || host_->is_hidden()) | 610 if (!host_ || host_->is_hidden()) |
622 return; | 611 return; |
623 host_->WasHidden(); | 612 host_->WasHidden(); |
624 delegated_frame_host_->WasHidden(); | 613 delegated_frame_host_->WasHidden(); |
625 | 614 |
626 #if defined(OS_WIN) | 615 #if defined(OS_WIN) |
627 constrained_rects_.clear(); | 616 constrained_rects_.clear(); |
628 aura::WindowTreeHost* host = window_->GetHost(); | 617 aura::WindowTreeHost* host = window_->GetHost(); |
629 if (host) { | 618 if (host) { |
630 HWND parent = host->GetAcceleratedWidget(); | 619 HWND parent = host->GetAcceleratedWidget(); |
631 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 620 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
632 EnumChildWindows(parent, HideWindowsCallback, lparam); | 621 EnumChildWindows(parent, HideWindowsCallback, lparam); |
633 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global | |
634 // hidden window on the same lines as Windowed plugin windows. | |
635 if (legacy_render_widget_host_HWND_) | |
636 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); | |
637 } | 622 } |
638 #endif | 623 #endif |
639 } | 624 } |
640 | 625 |
641 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 626 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
642 // For a SetSize operation, we don't care what coordinate system the origin | 627 // For a SetSize operation, we don't care what coordinate system the origin |
643 // of the window is in, it's only important to make sure that the origin | 628 // of the window is in, it's only important to make sure that the origin |
644 // remains constant after the operation. | 629 // remains constant after the operation. |
645 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 630 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
646 } | 631 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 return window_->HasFocus(); | 776 return window_->HasFocus(); |
792 } | 777 } |
793 | 778 |
794 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 779 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
795 return delegated_frame_host_->CanCopyToBitmap(); | 780 return delegated_frame_host_->CanCopyToBitmap(); |
796 } | 781 } |
797 | 782 |
798 void RenderWidgetHostViewAura::Show() { | 783 void RenderWidgetHostViewAura::Show() { |
799 window_->Show(); | 784 window_->Show(); |
800 WasShown(); | 785 WasShown(); |
801 #if defined(OS_WIN) | |
802 if (legacy_render_widget_host_HWND_) | |
803 legacy_render_widget_host_HWND_->Show(); | |
804 #endif | |
805 } | 786 } |
806 | 787 |
807 void RenderWidgetHostViewAura::Hide() { | 788 void RenderWidgetHostViewAura::Hide() { |
808 window_->Hide(); | 789 window_->Hide(); |
809 WasHidden(); | 790 WasHidden(); |
810 #if defined(OS_WIN) | |
811 if (legacy_render_widget_host_HWND_) | |
812 legacy_render_widget_host_HWND_->Hide(); | |
813 #endif | |
814 } | 791 } |
815 | 792 |
816 bool RenderWidgetHostViewAura::IsShowing() { | 793 bool RenderWidgetHostViewAura::IsShowing() { |
817 return window_->IsVisible(); | 794 return window_->IsVisible(); |
818 } | 795 } |
819 | 796 |
820 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 797 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
821 return window_->GetBoundsInScreen(); | 798 return window_->GetBoundsInScreen(); |
822 } | 799 } |
823 | 800 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); | 1005 EnumChildWindows(parent, SetCutoutRectsCallback, lparam); |
1029 } | 1006 } |
1030 | 1007 |
1031 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 1008 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
1032 // Clip the cursor if chrome is running on regular desktop. | 1009 // Clip the cursor if chrome is running on regular desktop. |
1033 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { | 1010 if (gfx::Screen::GetScreenFor(window_) == gfx::Screen::GetNativeScreen()) { |
1034 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); | 1011 RECT window_rect = window_->GetBoundsInScreen().ToRECT(); |
1035 ::ClipCursor(&window_rect); | 1012 ::ClipCursor(&window_rect); |
1036 } | 1013 } |
1037 } | 1014 } |
1038 | 1015 #endif // defined(OS_WIN) |
1039 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | |
1040 legacy_render_widget_host_HWND_ = NULL; | |
1041 legacy_window_destroyed_ = true; | |
1042 } | |
1043 #endif | |
1044 | 1016 |
1045 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 1017 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
1046 uint32 output_surface_id, | 1018 uint32 output_surface_id, |
1047 scoped_ptr<cc::CompositorFrame> frame) { | 1019 scoped_ptr<cc::CompositorFrame> frame) { |
1048 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 1020 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
1049 | 1021 |
1050 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 1022 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
1051 if (frame->delegated_frame_data) { | 1023 if (frame->delegated_frame_data) { |
1052 delegated_frame_host_->SwapDelegatedFrame( | 1024 delegated_frame_host_->SwapDelegatedFrame( |
1053 output_surface_id, | 1025 output_surface_id, |
(...skipping 11 matching lines...) Expand all Loading... |
1065 return; | 1037 return; |
1066 } | 1038 } |
1067 } | 1039 } |
1068 | 1040 |
1069 void RenderWidgetHostViewAura::DidStopFlinging() { | 1041 void RenderWidgetHostViewAura::DidStopFlinging() { |
1070 if (touch_editing_client_) | 1042 if (touch_editing_client_) |
1071 touch_editing_client_->DidStopFlinging(); | 1043 touch_editing_client_->DidStopFlinging(); |
1072 } | 1044 } |
1073 | 1045 |
1074 #if defined(OS_WIN) | 1046 #if defined(OS_WIN) |
| 1047 void RenderWidgetHostViewAura::SetLegacyRenderWidgetHostHWND( |
| 1048 LegacyRenderWidgetHostHWND* legacy_hwnd) { |
| 1049 legacy_render_widget_host_HWND_ = legacy_hwnd; |
| 1050 } |
| 1051 |
1075 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1052 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
1076 gfx::NativeViewAccessible accessible_parent) { | 1053 gfx::NativeViewAccessible accessible_parent) { |
1077 } | 1054 } |
1078 | 1055 |
1079 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1056 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
1080 const { | 1057 const { |
1081 if (legacy_render_widget_host_HWND_) { | 1058 if (legacy_render_widget_host_HWND_) { |
1082 return reinterpret_cast<gfx::NativeViewId>( | 1059 HWND hwnd = legacy_render_widget_host_HWND_->hwnd(); |
1083 legacy_render_widget_host_HWND_->hwnd()); | 1060 if (::IsWindow(hwnd)) |
| 1061 return reinterpret_cast<gfx::NativeViewId>(hwnd); |
1084 } | 1062 } |
1085 return NULL; | 1063 return NULL; |
1086 } | 1064 } |
1087 #endif | 1065 #endif |
1088 | 1066 |
1089 bool RenderWidgetHostViewAura::HasAcceleratedSurface( | 1067 bool RenderWidgetHostViewAura::HasAcceleratedSurface( |
1090 const gfx::Size& desired_size) { | 1068 const gfx::Size& desired_size) { |
1091 // Aura doesn't use GetBackingStore for accelerated pages, so it doesn't | 1069 // Aura doesn't use GetBackingStore for accelerated pages, so it doesn't |
1092 // matter what is returned here as GetBackingStore is the only caller of this | 1070 // matter what is returned here as GetBackingStore is the only caller of this |
1093 // method. TODO(jbates) implement this if other Aura code needs it. | 1071 // method. TODO(jbates) implement this if other Aura code needs it. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 #else | 1194 #else |
1217 manager = BrowserAccessibilityManager::Create( | 1195 manager = BrowserAccessibilityManager::Create( |
1218 BrowserAccessibilityManager::GetEmptyDocument(), delegate); | 1196 BrowserAccessibilityManager::GetEmptyDocument(), delegate); |
1219 #endif | 1197 #endif |
1220 return manager; | 1198 return manager; |
1221 } | 1199 } |
1222 | 1200 |
1223 gfx::AcceleratedWidget | 1201 gfx::AcceleratedWidget |
1224 RenderWidgetHostViewAura::AccessibilityGetAcceleratedWidget() { | 1202 RenderWidgetHostViewAura::AccessibilityGetAcceleratedWidget() { |
1225 #if defined(OS_WIN) | 1203 #if defined(OS_WIN) |
1226 if (legacy_render_widget_host_HWND_) | 1204 if (legacy_render_widget_host_HWND_) { |
1227 return legacy_render_widget_host_HWND_->hwnd(); | 1205 HWND hwnd = legacy_render_widget_host_HWND_->hwnd(); |
| 1206 if (::IsWindow(hwnd)) |
| 1207 return hwnd; |
| 1208 } |
1228 #endif | 1209 #endif |
1229 return gfx::kNullAcceleratedWidget; | 1210 return gfx::kNullAcceleratedWidget; |
1230 } | 1211 } |
1231 | 1212 |
1232 gfx::NativeViewAccessible | 1213 gfx::NativeViewAccessible |
1233 RenderWidgetHostViewAura::AccessibilityGetNativeViewAccessible() { | 1214 RenderWidgetHostViewAura::AccessibilityGetNativeViewAccessible() { |
1234 #if defined(OS_WIN) | 1215 #if defined(OS_WIN) |
1235 if (legacy_render_widget_host_HWND_) | 1216 if (legacy_render_widget_host_HWND_) |
1236 return legacy_render_widget_host_HWND_->window_accessible(); | 1217 return legacy_render_widget_host_HWND_->window_accessible(); |
1237 #endif | 1218 #endif |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 HWND parent = NULL; | 1721 HWND parent = NULL; |
1741 // If the tab was hidden and it's closed, host_->is_hidden would have been | 1722 // If the tab was hidden and it's closed, host_->is_hidden would have been |
1742 // reset to false in RenderWidgetHostImpl::RendererExited. | 1723 // reset to false in RenderWidgetHostImpl::RendererExited. |
1743 if (!window_->GetRootWindow() || host_->is_hidden()) { | 1724 if (!window_->GetRootWindow() || host_->is_hidden()) { |
1744 parent = ui::GetHiddenWindow(); | 1725 parent = ui::GetHiddenWindow(); |
1745 } else { | 1726 } else { |
1746 parent = window_->GetHost()->GetAcceleratedWidget(); | 1727 parent = window_->GetHost()->GetAcceleratedWidget(); |
1747 } | 1728 } |
1748 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 1729 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
1749 EnumChildWindows(parent, WindowDestroyingCallback, lparam); | 1730 EnumChildWindows(parent, WindowDestroyingCallback, lparam); |
1750 | 1731 legacy_render_widget_host_HWND_ = NULL; |
1751 // The LegacyRenderWidgetHostHWND instance is destroyed when its window is | |
1752 // destroyed. Normally we control when that happens via the Destroy call | |
1753 // in the dtor. However there may be cases where the window is destroyed | |
1754 // by Windows, i.e. the parent window is destroyed before the | |
1755 // RenderWidgetHostViewAura instance goes away etc. To avoid that we | |
1756 // destroy the LegacyRenderWidgetHostHWND instance here. | |
1757 if (legacy_render_widget_host_HWND_) { | |
1758 legacy_render_widget_host_HWND_->set_host(NULL); | |
1759 legacy_render_widget_host_HWND_->Destroy(); | |
1760 // The Destroy call above will delete the LegacyRenderWidgetHostHWND | |
1761 // instance. | |
1762 legacy_render_widget_host_HWND_ = NULL; | |
1763 } | |
1764 #endif | 1732 #endif |
1765 | 1733 |
1766 // Make sure that the input method no longer references to this object before | 1734 // Make sure that the input method no longer references to this object before |
1767 // this object is removed from the root window (i.e. this object loses access | 1735 // this object is removed from the root window (i.e. this object loses access |
1768 // to the input method). | 1736 // to the input method). |
1769 ui::InputMethod* input_method = GetInputMethod(); | 1737 ui::InputMethod* input_method = GetInputMethod(); |
1770 if (input_method) | 1738 if (input_method) |
1771 input_method->DetachTextInputClient(this); | 1739 input_method->DetachTextInputClient(this); |
1772 | 1740 |
1773 if (overscroll_controller_) | 1741 if (overscroll_controller_) |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 popup_child_host_view_->popup_parent_host_view_ = NULL; | 2229 popup_child_host_view_->popup_parent_host_view_ = NULL; |
2262 } | 2230 } |
2263 event_filter_for_popup_exit_.reset(); | 2231 event_filter_for_popup_exit_.reset(); |
2264 aura::client::SetTooltipText(window_, NULL); | 2232 aura::client::SetTooltipText(window_, NULL); |
2265 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); | 2233 gfx::Screen::GetScreenFor(window_)->RemoveObserver(this); |
2266 | 2234 |
2267 // This call is usually no-op since |this| object is already removed from the | 2235 // This call is usually no-op since |this| object is already removed from the |
2268 // Aura root window and we don't have a way to get an input method object | 2236 // Aura root window and we don't have a way to get an input method object |
2269 // associated with the window, but just in case. | 2237 // associated with the window, but just in case. |
2270 DetachFromInputMethod(); | 2238 DetachFromInputMethod(); |
2271 | |
2272 #if defined(OS_WIN) | |
2273 // The LegacyRenderWidgetHostHWND window should have been destroyed in | |
2274 // RenderWidgetHostViewAura::OnWindowDestroying and the pointer should | |
2275 // be set to NULL. | |
2276 DCHECK(!legacy_render_widget_host_HWND_); | |
2277 #endif | |
2278 } | 2239 } |
2279 | 2240 |
2280 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 2241 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
2281 const gfx::Point screen_point = | 2242 const gfx::Point screen_point = |
2282 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 2243 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
2283 aura::Window* root_window = window_->GetRootWindow(); | 2244 aura::Window* root_window = window_->GetRootWindow(); |
2284 if (!root_window) | 2245 if (!root_window) |
2285 return; | 2246 return; |
2286 | 2247 |
2287 gfx::Point root_window_point = screen_point; | 2248 gfx::Point root_window_point = screen_point; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2424 // a Window::SetBoundsInternal call. | 2385 // a Window::SetBoundsInternal call. |
2425 if (!in_bounds_changed_) | 2386 if (!in_bounds_changed_) |
2426 window_->SetBounds(rect); | 2387 window_->SetBounds(rect); |
2427 host_->WasResized(); | 2388 host_->WasResized(); |
2428 delegated_frame_host_->WasResized(); | 2389 delegated_frame_host_->WasResized(); |
2429 if (touch_editing_client_) { | 2390 if (touch_editing_client_) { |
2430 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 2391 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
2431 selection_focus_rect_); | 2392 selection_focus_rect_); |
2432 } | 2393 } |
2433 #if defined(OS_WIN) | 2394 #if defined(OS_WIN) |
2434 // Create the legacy dummy window which corresponds to the bounds of the | |
2435 // webcontents. This will be passed as the container window for windowless | |
2436 // plugins. | |
2437 // Plugins like Flash assume the container window which is returned via the | |
2438 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | |
2439 // This is not true in Aura where we have only HWND which is the main Aura | |
2440 // window. If we return this window to plugins like Flash then it causes the | |
2441 // coordinate translations done by these plugins to break. | |
2442 // Additonally the legacy dummy window is needed for accessibility and for | |
2443 // scrolling to work in legacy drivers for trackpoints/trackpads, etc. | |
2444 if (!legacy_window_destroyed_ && GetNativeViewId()) { | |
2445 if (!legacy_render_widget_host_HWND_) { | |
2446 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create( | |
2447 reinterpret_cast<HWND>(GetNativeViewId())); | |
2448 } | |
2449 if (legacy_render_widget_host_HWND_) { | |
2450 legacy_render_widget_host_HWND_->set_host(this); | |
2451 legacy_render_widget_host_HWND_->SetBounds( | |
2452 window_->GetBoundsInRootWindow()); | |
2453 // There are cases where the parent window is created, made visible and | |
2454 // the associated RenderWidget is also visible before the | |
2455 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown | |
2456 // here. | |
2457 if (!host_->is_hidden()) | |
2458 legacy_render_widget_host_HWND_->Show(); | |
2459 } | |
2460 } | |
2461 | |
2462 if (mouse_locked_) | 2395 if (mouse_locked_) |
2463 UpdateMouseLockRegion(); | 2396 UpdateMouseLockRegion(); |
2464 #endif | 2397 #endif |
2465 } | 2398 } |
2466 | 2399 |
2467 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( | 2400 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( |
2468 const gfx::Rect& rect, | 2401 const gfx::Rect& rect, |
2469 const gfx::Rect& clip) { | 2402 const gfx::Rect& clip) { |
2470 if (!clip.IsEmpty()) { | 2403 if (!clip.IsEmpty()) { |
2471 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); | 2404 gfx::Rect to_paint = gfx::SubtractRects(rect, clip); |
(...skipping 25 matching lines...) Expand all Loading... |
2497 if (cursor_client) { | 2430 if (cursor_client) { |
2498 cursor_client->AddObserver(this); | 2431 cursor_client->AddObserver(this); |
2499 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 2432 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
2500 } | 2433 } |
2501 if (HasFocus()) { | 2434 if (HasFocus()) { |
2502 ui::InputMethod* input_method = GetInputMethod(); | 2435 ui::InputMethod* input_method = GetInputMethod(); |
2503 if (input_method) | 2436 if (input_method) |
2504 input_method->SetFocusedTextInputClient(this); | 2437 input_method->SetFocusedTextInputClient(this); |
2505 } | 2438 } |
2506 | 2439 |
2507 #if defined(OS_WIN) | |
2508 // The parent may have changed here. Ensure that the legacy window is | |
2509 // reparented accordingly. | |
2510 if (legacy_render_widget_host_HWND_) | |
2511 legacy_render_widget_host_HWND_->UpdateParent( | |
2512 reinterpret_cast<HWND>(GetNativeViewId())); | |
2513 #endif | |
2514 | |
2515 delegated_frame_host_->AddedToWindow(); | 2440 delegated_frame_host_->AddedToWindow(); |
2516 } | 2441 } |
2517 | 2442 |
2518 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 2443 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
2519 aura::client::CursorClient* cursor_client = | 2444 aura::client::CursorClient* cursor_client = |
2520 aura::client::GetCursorClient(window_->GetRootWindow()); | 2445 aura::client::GetCursorClient(window_->GetRootWindow()); |
2521 if (cursor_client) | 2446 if (cursor_client) |
2522 cursor_client->RemoveObserver(this); | 2447 cursor_client->RemoveObserver(this); |
2523 | 2448 |
2524 DetachFromInputMethod(); | 2449 DetachFromInputMethod(); |
2525 | 2450 |
2526 window_->GetHost()->RemoveObserver(this); | 2451 window_->GetHost()->RemoveObserver(this); |
2527 delegated_frame_host_->RemovingFromWindow(); | 2452 delegated_frame_host_->RemovingFromWindow(); |
2528 | |
2529 #if defined(OS_WIN) | |
2530 // Update the legacy window's parent temporarily to the desktop window. It | |
2531 // will eventually get reparented to the right root. | |
2532 if (legacy_render_widget_host_HWND_) | |
2533 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); | |
2534 #endif | |
2535 } | 2453 } |
2536 | 2454 |
2537 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2455 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
2538 ui::InputMethod* input_method = GetInputMethod(); | 2456 ui::InputMethod* input_method = GetInputMethod(); |
2539 if (input_method && input_method->GetTextInputClient() == this) | 2457 if (input_method && input_method->GetTextInputClient() == this) |
2540 input_method->SetFocusedTextInputClient(NULL); | 2458 input_method->SetFocusedTextInputClient(NULL); |
2541 } | 2459 } |
2542 | 2460 |
2543 void RenderWidgetHostViewAura::ForwardKeyboardEvent( | 2461 void RenderWidgetHostViewAura::ForwardKeyboardEvent( |
2544 const NativeWebKeyboardEvent& event) { | 2462 const NativeWebKeyboardEvent& event) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2622 | 2540 |
2623 //////////////////////////////////////////////////////////////////////////////// | 2541 //////////////////////////////////////////////////////////////////////////////// |
2624 // RenderWidgetHostViewBase, public: | 2542 // RenderWidgetHostViewBase, public: |
2625 | 2543 |
2626 // static | 2544 // static |
2627 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2545 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2628 GetScreenInfoForWindow(results, NULL); | 2546 GetScreenInfoForWindow(results, NULL); |
2629 } | 2547 } |
2630 | 2548 |
2631 } // namespace content | 2549 } // namespace content |
OLD | NEW |