Chromium Code Reviews| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 #include "ui/gfx/display.h" | 75 #include "ui/gfx/display.h" |
| 76 #include "ui/gfx/rect_conversions.h" | 76 #include "ui/gfx/rect_conversions.h" |
| 77 #include "ui/gfx/screen.h" | 77 #include "ui/gfx/screen.h" |
| 78 #include "ui/gfx/size_conversions.h" | 78 #include "ui/gfx/size_conversions.h" |
| 79 #include "ui/gfx/skia_util.h" | 79 #include "ui/gfx/skia_util.h" |
| 80 #include "ui/wm/public/window_types.h" | 80 #include "ui/wm/public/window_types.h" |
| 81 | 81 |
| 82 #if defined(OS_WIN) | 82 #if defined(OS_WIN) |
| 83 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 83 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 84 #include "content/browser/accessibility/browser_accessibility_win.h" | 84 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 85 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | |
| 85 #include "content/common/plugin_constants_win.h" | 86 #include "content/common/plugin_constants_win.h" |
| 86 #include "ui/base/win/hidden_window.h" | 87 #include "ui/base/win/hidden_window.h" |
| 87 #include "ui/gfx/gdi_util.h" | 88 #include "ui/gfx/gdi_util.h" |
| 88 #include "ui/gfx/win/dpi.h" | 89 #include "ui/gfx/win/dpi.h" |
| 89 #endif | 90 #endif |
| 90 | 91 |
| 91 using gfx::RectToSkIRect; | 92 using gfx::RectToSkIRect; |
| 92 using gfx::SkIRectToRect; | 93 using gfx::SkIRectToRect; |
| 93 | 94 |
| 94 using blink::WebScreenInfo; | 95 using blink::WebScreenInfo; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 | 145 |
| 145 BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { | 146 BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { |
| 146 RenderWidgetHostViewAura* widget = | 147 RenderWidgetHostViewAura* widget = |
| 147 reinterpret_cast<RenderWidgetHostViewAura*>(param); | 148 reinterpret_cast<RenderWidgetHostViewAura*>(param); |
| 148 | 149 |
| 149 if (GetProp(window, kWidgetOwnerProperty) == widget && | 150 if (GetProp(window, kWidgetOwnerProperty) == widget && |
| 150 widget->GetNativeView()->GetDispatcher()) { | 151 widget->GetNativeView()->GetDispatcher()) { |
| 151 HWND parent = widget->GetNativeView()->GetDispatcher()->host()-> | 152 HWND parent = widget->GetNativeView()->GetDispatcher()->host()-> |
| 152 GetAcceleratedWidget(); | 153 GetAcceleratedWidget(); |
| 153 SetParent(window, parent); | 154 SetParent(window, parent); |
| 155 ::InvalidateRect(window, NULL, FALSE); | |
|
cpu_(ooo_6.6-7.5)
2014/02/06 21:23:05
do we need this? aren't we invalidated anyhow?
ananta
2014/02/06 21:26:11
Removed. Added for debugging flash painting issues
| |
| 154 } | 156 } |
| 155 return TRUE; | 157 return TRUE; |
| 156 } | 158 } |
| 157 | 159 |
| 158 struct CutoutRectsParams { | 160 struct CutoutRectsParams { |
| 159 RenderWidgetHostViewAura* widget; | 161 RenderWidgetHostViewAura* widget; |
| 160 std::vector<gfx::Rect> cutout_rects; | 162 std::vector<gfx::Rect> cutout_rects; |
| 161 std::map<HWND, WebPluginGeometry>* geometry; | 163 std::map<HWND, WebPluginGeometry>* geometry; |
| 162 }; | 164 }; |
| 163 | 165 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 weak_ptr_factory_(this) { | 481 weak_ptr_factory_(this) { |
| 480 host_->SetView(this); | 482 host_->SetView(this); |
| 481 window_observer_.reset(new WindowObserver(this)); | 483 window_observer_.reset(new WindowObserver(this)); |
| 482 aura::client::SetTooltipText(window_, &tooltip_); | 484 aura::client::SetTooltipText(window_, &tooltip_); |
| 483 aura::client::SetActivationDelegate(window_, this); | 485 aura::client::SetActivationDelegate(window_, this); |
| 484 aura::client::SetActivationChangeObserver(window_, this); | 486 aura::client::SetActivationChangeObserver(window_, this); |
| 485 aura::client::SetFocusChangeObserver(window_, this); | 487 aura::client::SetFocusChangeObserver(window_, this); |
| 486 gfx::Screen::GetScreenFor(window_)->AddObserver(this); | 488 gfx::Screen::GetScreenFor(window_)->AddObserver(this); |
| 487 software_frame_manager_.reset(new SoftwareFrameManager( | 489 software_frame_manager_.reset(new SoftwareFrameManager( |
| 488 weak_ptr_factory_.GetWeakPtr())); | 490 weak_ptr_factory_.GetWeakPtr())); |
| 489 #if defined(OS_WIN) | |
| 490 plugin_parent_window_ = NULL; | |
| 491 #endif | |
| 492 ImageTransportFactory::GetInstance()->AddObserver(this); | 491 ImageTransportFactory::GetInstance()->AddObserver(this); |
| 493 } | 492 } |
| 494 | 493 |
| 495 //////////////////////////////////////////////////////////////////////////////// | 494 //////////////////////////////////////////////////////////////////////////////// |
| 496 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 495 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
| 497 | 496 |
| 498 bool RenderWidgetHostViewAura::OnMessageReceived( | 497 bool RenderWidgetHostViewAura::OnMessageReceived( |
| 499 const IPC::Message& message) { | 498 const IPC::Message& message) { |
| 500 bool handled = true; | 499 bool handled = true; |
| 501 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) | 500 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 } | 610 } |
| 612 | 611 |
| 613 if (!current_surface_.get() && host_->is_accelerated_compositing_active() && | 612 if (!current_surface_.get() && host_->is_accelerated_compositing_active() && |
| 614 !released_front_lock_.get()) { | 613 !released_front_lock_.get()) { |
| 615 ui::Compositor* compositor = GetCompositor(); | 614 ui::Compositor* compositor = GetCompositor(); |
| 616 if (compositor) | 615 if (compositor) |
| 617 released_front_lock_ = compositor->GetCompositorLock(); | 616 released_front_lock_ = compositor->GetCompositorLock(); |
| 618 } | 617 } |
| 619 | 618 |
| 620 #if defined(OS_WIN) | 619 #if defined(OS_WIN) |
| 620 if (legacy_render_widget_host_HWND_) { | |
| 621 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent | |
| 622 // window before reparenting any plugins. This ensures that the plugin | |
| 623 // windows stay on top of the child Zorder in the parent and receive | |
| 624 // mouse events, etc. | |
| 625 legacy_render_widget_host_HWND_->UpdateParent( | |
| 626 GetNativeView()->GetDispatcher()->host()->GetAcceleratedWidget()); | |
| 627 legacy_render_widget_host_HWND_->SetBounds( | |
| 628 window_->GetBoundsInRootWindow()); | |
| 629 } | |
| 621 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 630 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 622 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 631 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
| 623 | |
| 624 if (::IsWindow(plugin_parent_window_)) { | |
| 625 gfx::Rect window_bounds = window_->GetBoundsInRootWindow(); | |
| 626 ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(), | |
| 627 window_bounds.y(), window_bounds.width(), | |
| 628 window_bounds.height(), 0); | |
| 629 } | |
| 630 #endif | 632 #endif |
| 631 } | 633 } |
| 632 | 634 |
| 633 void RenderWidgetHostViewAura::WasHidden() { | 635 void RenderWidgetHostViewAura::WasHidden() { |
| 634 if (!host_ || host_->is_hidden()) | 636 if (!host_ || host_->is_hidden()) |
| 635 return; | 637 return; |
| 636 host_->WasHidden(); | 638 host_->WasHidden(); |
| 637 software_frame_manager_->SetVisibility(false); | 639 software_frame_manager_->SetVisibility(false); |
| 638 delegated_frame_evictor_->SetVisible(false); | 640 delegated_frame_evictor_->SetVisible(false); |
| 639 released_front_lock_ = NULL; | 641 released_front_lock_ = NULL; |
| 640 | 642 |
| 641 #if defined(OS_WIN) | 643 #if defined(OS_WIN) |
| 642 constrained_rects_.clear(); | 644 constrained_rects_.clear(); |
| 643 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 645 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 644 if (dispatcher) { | 646 if (dispatcher) { |
| 645 HWND parent = dispatcher->host()->GetAcceleratedWidget(); | 647 HWND parent = dispatcher->host()->GetAcceleratedWidget(); |
| 646 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 648 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 647 | |
| 648 EnumChildWindows(parent, HideWindowsCallback, lparam); | 649 EnumChildWindows(parent, HideWindowsCallback, lparam); |
| 650 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global | |
| 651 // hidden window on the same lines as Windowed plugin windows. | |
| 652 if (legacy_render_widget_host_HWND_) | |
| 653 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); | |
| 649 } | 654 } |
| 650 if (::IsWindow(plugin_parent_window_)) | |
| 651 ::SetWindowPos(plugin_parent_window_, NULL, 0, 0, 0, 0, 0); | |
| 652 #endif | 655 #endif |
| 653 } | 656 } |
| 654 | 657 |
| 655 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 658 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 656 // For a SetSize operation, we don't care what coordinate system the origin | 659 // For a SetSize operation, we don't care what coordinate system the origin |
| 657 // of the window is in, it's only important to make sure that the origin | 660 // of the window is in, it's only important to make sure that the origin |
| 658 // remains constant after the operation. | 661 // remains constant after the operation. |
| 659 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); | 662 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
| 660 } | 663 } |
| 661 | 664 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 return window_->HasFocus(); | 863 return window_->HasFocus(); |
| 861 } | 864 } |
| 862 | 865 |
| 863 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 866 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 864 return CanCopyToBitmap() || !!host_->GetBackingStore(false); | 867 return CanCopyToBitmap() || !!host_->GetBackingStore(false); |
| 865 } | 868 } |
| 866 | 869 |
| 867 void RenderWidgetHostViewAura::Show() { | 870 void RenderWidgetHostViewAura::Show() { |
| 868 window_->Show(); | 871 window_->Show(); |
| 869 WasShown(); | 872 WasShown(); |
| 873 #if defined(OS_WIN) | |
| 874 if (legacy_render_widget_host_HWND_) | |
| 875 legacy_render_widget_host_HWND_->Show(); | |
| 876 #endif | |
| 870 } | 877 } |
| 871 | 878 |
| 872 void RenderWidgetHostViewAura::Hide() { | 879 void RenderWidgetHostViewAura::Hide() { |
| 873 window_->Hide(); | 880 window_->Hide(); |
| 874 WasHidden(); | 881 WasHidden(); |
| 882 #if defined(OS_WIN) | |
| 883 if (legacy_render_widget_host_HWND_) | |
| 884 legacy_render_widget_host_HWND_->Hide(); | |
| 885 #endif | |
| 875 } | 886 } |
| 876 | 887 |
| 877 bool RenderWidgetHostViewAura::IsShowing() { | 888 bool RenderWidgetHostViewAura::IsShowing() { |
| 878 return window_->IsVisible(); | 889 return window_->IsVisible(); |
| 879 } | 890 } |
| 880 | 891 |
| 881 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 892 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 882 // This is the size that we want the renderer to produce. While we're waiting | 893 // This is the size that we want the renderer to produce. While we're waiting |
| 883 // for the correct frame (i.e. during a resize), don't change the size so that | 894 // for the correct frame (i.e. during a resize), don't change the size so that |
| 884 // we don't pipeline more resizes than we can handle. | 895 // we don't pipeline more resizes than we can handle. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1206 // a Window::SetBoundsInternal call. | 1217 // a Window::SetBoundsInternal call. |
| 1207 if (!in_bounds_changed_) | 1218 if (!in_bounds_changed_) |
| 1208 window_->SetBounds(rect); | 1219 window_->SetBounds(rect); |
| 1209 host_->WasResized(); | 1220 host_->WasResized(); |
| 1210 MaybeCreateResizeLock(); | 1221 MaybeCreateResizeLock(); |
| 1211 if (touch_editing_client_) { | 1222 if (touch_editing_client_) { |
| 1212 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, | 1223 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
| 1213 selection_focus_rect_); | 1224 selection_focus_rect_); |
| 1214 } | 1225 } |
| 1215 #if defined(OS_WIN) | 1226 #if defined(OS_WIN) |
| 1216 // Create the dummy plugin parent window which will be passed as the | 1227 // Create the legacy dummy window which corresponds to the bounds of the |
| 1217 // container window to windowless plugins. | 1228 // webcontents. This will be passed as the container window for windowless |
| 1229 // plugins. | |
| 1218 // Plugins like Flash assume the container window which is returned via the | 1230 // Plugins like Flash assume the container window which is returned via the |
| 1219 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | 1231 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. |
| 1220 // This is not true in Aura where we have only HWND which is the main Aura | 1232 // This is not true in Aura where we have only HWND which is the main Aura |
| 1221 // window. If we return this window to plugins like Flash then it causes the | 1233 // window. If we return this window to plugins like Flash then it causes the |
| 1222 // coordinate translations done by these plugins to break. | 1234 // coordinate translations done by these plugins to break. |
| 1223 if (!plugin_parent_window_ && GetNativeViewId()) { | 1235 // Additonally the legacy dummy window is needed for accessibility and for |
| 1224 plugin_parent_window_ = ::CreateWindowEx( | 1236 // scrolling to work in legacy drivers for trackpoints/trackpads, etc. |
| 1225 0, L"Static", NULL, WS_CHILDWINDOW, 0, 0, 0, 0, | 1237 if (GetNativeViewId()) { |
| 1226 reinterpret_cast<HWND>(GetNativeViewId()), NULL, NULL, NULL); | 1238 if (!legacy_render_widget_host_HWND_) { |
| 1227 if (::IsWindow(plugin_parent_window_)) | 1239 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create( |
| 1228 ::SetProp(plugin_parent_window_, content::kPluginDummyParentProperty, | 1240 reinterpret_cast<HWND>(GetNativeViewId())); |
| 1229 reinterpret_cast<HANDLE>(true)); | 1241 } |
| 1230 } | 1242 if (legacy_render_widget_host_HWND_) { |
| 1231 if (::IsWindow(plugin_parent_window_)) { | 1243 legacy_render_widget_host_HWND_->SetBounds( |
| 1232 gfx::Rect window_bounds = window_->GetBoundsInRootWindow(); | 1244 window_->GetBoundsInRootWindow()); |
| 1233 ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(), | 1245 } |
| 1234 window_bounds.y(), window_bounds.width(), | |
| 1235 window_bounds.height(), 0); | |
| 1236 } | 1246 } |
| 1237 #endif | 1247 #endif |
| 1238 } | 1248 } |
| 1239 | 1249 |
| 1240 void RenderWidgetHostViewAura::CheckResizeLock() { | 1250 void RenderWidgetHostViewAura::CheckResizeLock() { |
| 1241 if (!resize_lock_ || resize_lock_->expected_size() != current_frame_size_) | 1251 if (!resize_lock_ || resize_lock_->expected_size() != current_frame_size_) |
| 1242 return; | 1252 return; |
| 1243 | 1253 |
| 1244 // Since we got the size we were looking for, unlock the compositor. But delay | 1254 // Since we got the size we were looking for, unlock the compositor. But delay |
| 1245 // the release of the lock until we've kicked a frame with the new texture, to | 1255 // the release of the lock until we've kicked a frame with the new texture, to |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1693 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1703 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
| 1694 gfx::NativeViewAccessible accessible_parent) { | 1704 gfx::NativeViewAccessible accessible_parent) { |
| 1695 if (GetBrowserAccessibilityManager()) { | 1705 if (GetBrowserAccessibilityManager()) { |
| 1696 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() | 1706 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() |
| 1697 ->set_parent_iaccessible(accessible_parent); | 1707 ->set_parent_iaccessible(accessible_parent); |
| 1698 } | 1708 } |
| 1699 } | 1709 } |
| 1700 | 1710 |
| 1701 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1711 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
| 1702 const { | 1712 const { |
| 1703 return reinterpret_cast<gfx::NativeViewId>(plugin_parent_window_); | 1713 if (legacy_render_widget_host_HWND_) { |
| 1714 return reinterpret_cast<gfx::NativeViewId>( | |
| 1715 legacy_render_widget_host_HWND_->hwnd()); | |
| 1716 } | |
| 1717 return NULL; | |
| 1704 } | 1718 } |
| 1705 #endif | 1719 #endif |
| 1706 | 1720 |
| 1707 void RenderWidgetHostViewAura::BuffersSwapped( | 1721 void RenderWidgetHostViewAura::BuffersSwapped( |
| 1708 const gfx::Size& surface_size, | 1722 const gfx::Size& surface_size, |
| 1709 const gfx::Rect& damage_rect, | 1723 const gfx::Rect& damage_rect, |
| 1710 float surface_scale_factor, | 1724 float surface_scale_factor, |
| 1711 const std::string& mailbox_name, | 1725 const std::string& mailbox_name, |
| 1712 const std::vector<ui::LatencyInfo>& latency_info, | 1726 const std::vector<ui::LatencyInfo>& latency_info, |
| 1713 const BufferPresentedCallback& ack_callback) { | 1727 const BufferPresentedCallback& ack_callback) { |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2185 | 2199 |
| 2186 void RenderWidgetHostViewAura::SetScrollOffsetPinning( | 2200 void RenderWidgetHostViewAura::SetScrollOffsetPinning( |
| 2187 bool is_pinned_to_left, bool is_pinned_to_right) { | 2201 bool is_pinned_to_left, bool is_pinned_to_right) { |
| 2188 // Not needed. Mac-only. | 2202 // Not needed. Mac-only. |
| 2189 } | 2203 } |
| 2190 | 2204 |
| 2191 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { | 2205 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { |
| 2192 if (GetBrowserAccessibilityManager()) | 2206 if (GetBrowserAccessibilityManager()) |
| 2193 return; | 2207 return; |
| 2194 | 2208 |
| 2209 BrowserAccessibilityManager* manager = NULL; | |
| 2195 #if defined(OS_WIN) | 2210 #if defined(OS_WIN) |
| 2196 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 2211 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 2197 if (!dispatcher) | 2212 if (!dispatcher) |
| 2198 return; | 2213 return; |
| 2199 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); | 2214 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); |
| 2200 | 2215 |
| 2201 // The accessible_parent may be NULL at this point. The WebContents will pass | 2216 // The accessible_parent may be NULL at this point. The WebContents will pass |
| 2202 // it down to this instance (by way of the RenderViewHost and | 2217 // it down to this instance (by way of the RenderViewHost and |
| 2203 // RenderWidgetHost) when it is known. This instance will then set it on its | 2218 // RenderWidgetHost) when it is known. This instance will then set it on its |
| 2204 // BrowserAccessibilityManager. | 2219 // BrowserAccessibilityManager. |
| 2205 gfx::NativeViewAccessible accessible_parent = | 2220 gfx::NativeViewAccessible accessible_parent = |
| 2206 host_->GetParentNativeViewAccessible(); | 2221 host_->GetParentNativeViewAccessible(); |
| 2207 | 2222 |
| 2208 BrowserAccessibilityManager* manager = new BrowserAccessibilityManagerWin( | 2223 if (legacy_render_widget_host_HWND_) { |
| 2209 hwnd, accessible_parent, | 2224 manager = new BrowserAccessibilityManagerWin( |
| 2210 BrowserAccessibilityManagerWin::GetEmptyDocument(), this); | 2225 legacy_render_widget_host_HWND_.get(), accessible_parent, |
| 2226 BrowserAccessibilityManagerWin::GetEmptyDocument(), this); | |
| 2227 } | |
| 2211 #else | 2228 #else |
| 2212 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( | 2229 manager = BrowserAccessibilityManager::Create( |
| 2213 BrowserAccessibilityManager::GetEmptyDocument(), this); | 2230 BrowserAccessibilityManager::GetEmptyDocument(), this); |
| 2214 #endif | 2231 #endif |
| 2215 | |
| 2216 SetBrowserAccessibilityManager(manager); | 2232 SetBrowserAccessibilityManager(manager); |
| 2217 } | 2233 } |
| 2218 | 2234 |
| 2219 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { | 2235 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { |
| 2220 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); | 2236 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); |
| 2221 } | 2237 } |
| 2222 | 2238 |
| 2223 bool RenderWidgetHostViewAura::LockMouse() { | 2239 bool RenderWidgetHostViewAura::LockMouse() { |
| 2224 aura::Window* root_window = window_->GetRootWindow(); | 2240 aura::Window* root_window = window_->GetRootWindow(); |
| 2225 if (!root_window) | 2241 if (!root_window) |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3328 // destroyed, as it may then outlive the GLHelper. | 3344 // destroyed, as it may then outlive the GLHelper. |
| 3329 for (std::set<OwnedMailbox*>::iterator it = | 3345 for (std::set<OwnedMailbox*>::iterator it = |
| 3330 active_frame_subscriber_textures_.begin(); | 3346 active_frame_subscriber_textures_.begin(); |
| 3331 it != active_frame_subscriber_textures_.end(); | 3347 it != active_frame_subscriber_textures_.end(); |
| 3332 ++it) { | 3348 ++it) { |
| 3333 (*it)->Destroy(); | 3349 (*it)->Destroy(); |
| 3334 } | 3350 } |
| 3335 active_frame_subscriber_textures_.clear(); | 3351 active_frame_subscriber_textures_.clear(); |
| 3336 | 3352 |
| 3337 #if defined(OS_WIN) | 3353 #if defined(OS_WIN) |
| 3338 if (::IsWindow(plugin_parent_window_)) | 3354 legacy_render_widget_host_HWND_.reset(NULL); |
| 3339 ::DestroyWindow(plugin_parent_window_); | |
| 3340 #endif | 3355 #endif |
| 3341 } | 3356 } |
| 3342 | 3357 |
| 3343 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { | 3358 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { |
| 3344 const gfx::Point screen_point = | 3359 const gfx::Point screen_point = |
| 3345 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); | 3360 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); |
| 3346 aura::Window* root_window = window_->GetRootWindow(); | 3361 aura::Window* root_window = window_->GetRootWindow(); |
| 3347 if (!root_window) | 3362 if (!root_window) |
| 3348 return; | 3363 return; |
| 3349 | 3364 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3476 | 3491 |
| 3477 if (!compositor->HasObserver(this)) | 3492 if (!compositor->HasObserver(this)) |
| 3478 compositor->AddObserver(this); | 3493 compositor->AddObserver(this); |
| 3479 | 3494 |
| 3480 can_lock_compositor_ = NO_PENDING_COMMIT; | 3495 can_lock_compositor_ = NO_PENDING_COMMIT; |
| 3481 on_compositing_did_commit_callbacks_.push_back(callback); | 3496 on_compositing_did_commit_callbacks_.push_back(callback); |
| 3482 } | 3497 } |
| 3483 | 3498 |
| 3484 void RenderWidgetHostViewAura::AddedToRootWindow() { | 3499 void RenderWidgetHostViewAura::AddedToRootWindow() { |
| 3485 window_->GetDispatcher()->AddRootWindowObserver(this); | 3500 window_->GetDispatcher()->AddRootWindowObserver(this); |
| 3486 host_->ParentChanged(GetNativeViewId()); | |
| 3487 UpdateScreenInfo(window_); | 3501 UpdateScreenInfo(window_); |
| 3488 | 3502 |
| 3489 aura::client::CursorClient* cursor_client = | 3503 aura::client::CursorClient* cursor_client = |
| 3490 aura::client::GetCursorClient(window_->GetRootWindow()); | 3504 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 3491 if (cursor_client) { | 3505 if (cursor_client) { |
| 3492 cursor_client->AddObserver(this); | 3506 cursor_client->AddObserver(this); |
| 3493 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 3507 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 3494 } | 3508 } |
| 3495 if (current_surface_.get()) | 3509 if (current_surface_.get()) |
| 3496 UpdateExternalTexture(); | 3510 UpdateExternalTexture(); |
| 3497 if (HasFocus()) { | 3511 if (HasFocus()) { |
| 3498 ui::InputMethod* input_method = GetInputMethod(); | 3512 ui::InputMethod* input_method = GetInputMethod(); |
| 3499 if (input_method) | 3513 if (input_method) |
| 3500 input_method->SetFocusedTextInputClient(this); | 3514 input_method->SetFocusedTextInputClient(this); |
| 3501 } | 3515 } |
| 3516 | |
| 3517 #if defined(OS_WIN) | |
| 3518 // The parent may have changed here. Ensure that the legacy window is | |
| 3519 // reparented accordingly. | |
| 3520 if (legacy_render_widget_host_HWND_) | |
| 3521 legacy_render_widget_host_HWND_->UpdateParent( | |
| 3522 reinterpret_cast<HWND>(GetNativeViewId())); | |
| 3523 #endif | |
| 3502 } | 3524 } |
| 3503 | 3525 |
| 3504 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 3526 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
| 3505 aura::client::CursorClient* cursor_client = | 3527 aura::client::CursorClient* cursor_client = |
| 3506 aura::client::GetCursorClient(window_->GetRootWindow()); | 3528 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 3507 if (cursor_client) | 3529 if (cursor_client) |
| 3508 cursor_client->RemoveObserver(this); | 3530 cursor_client->RemoveObserver(this); |
| 3509 | 3531 |
| 3510 DetachFromInputMethod(); | 3532 DetachFromInputMethod(); |
| 3511 | 3533 |
| 3512 window_->GetDispatcher()->RemoveRootWindowObserver(this); | 3534 window_->GetDispatcher()->RemoveRootWindowObserver(this); |
| 3513 host_->ParentChanged(0); | |
| 3514 ui::Compositor* compositor = GetCompositor(); | 3535 ui::Compositor* compositor = GetCompositor(); |
| 3515 if (current_surface_.get()) { | 3536 if (current_surface_.get()) { |
| 3516 // We can't get notification for commits after this point, which would | 3537 // We can't get notification for commits after this point, which would |
| 3517 // guarantee that the compositor isn't using an old texture any more, so | 3538 // guarantee that the compositor isn't using an old texture any more, so |
| 3518 // instead we force the layer to stop using any external resources which | 3539 // instead we force the layer to stop using any external resources which |
| 3519 // synchronizes with the compositor thread, and makes it safe to run the | 3540 // synchronizes with the compositor thread, and makes it safe to run the |
| 3520 // callback. | 3541 // callback. |
| 3521 window_->layer()->SetShowPaintedContent(); | 3542 window_->layer()->SetShowPaintedContent(); |
| 3522 } | 3543 } |
| 3523 RunOnCommitCallbacks(); | 3544 RunOnCommitCallbacks(); |
| 3524 resize_lock_.reset(); | 3545 resize_lock_.reset(); |
| 3525 host_->WasResized(); | 3546 host_->WasResized(); |
| 3526 if (compositor && compositor->HasObserver(this)) | 3547 if (compositor && compositor->HasObserver(this)) |
| 3527 compositor->RemoveObserver(this); | 3548 compositor->RemoveObserver(this); |
| 3549 | |
| 3550 #if defined(OS_WIN) | |
| 3551 // Update the legacy window's parent temporarily to the desktop window. It | |
| 3552 // will eventually get reparented to the right root. | |
| 3553 if (legacy_render_widget_host_HWND_) | |
| 3554 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); | |
| 3555 #endif | |
| 3528 } | 3556 } |
| 3529 | 3557 |
| 3530 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { | 3558 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { |
| 3531 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 3559 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
| 3532 return dispatcher ? dispatcher->host()->compositor() : NULL; | 3560 return dispatcher ? dispatcher->host()->compositor() : NULL; |
| 3533 } | 3561 } |
| 3534 | 3562 |
| 3535 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 3563 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
| 3536 ui::InputMethod* input_method = GetInputMethod(); | 3564 ui::InputMethod* input_method = GetInputMethod(); |
| 3537 if (input_method && input_method->GetTextInputClient() == this) | 3565 if (input_method && input_method->GetTextInputClient() == this) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 3556 RenderWidgetHost* widget) { | 3584 RenderWidgetHost* widget) { |
| 3557 return new RenderWidgetHostViewAura(widget); | 3585 return new RenderWidgetHostViewAura(widget); |
| 3558 } | 3586 } |
| 3559 | 3587 |
| 3560 // static | 3588 // static |
| 3561 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3589 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3562 GetScreenInfoForWindow(results, NULL); | 3590 GetScreenInfoForWindow(results, NULL); |
| 3563 } | 3591 } |
| 3564 | 3592 |
| 3565 } // namespace content | 3593 } // namespace content |
| OLD | NEW |