Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 151083002: Create a visible window with class name Chrome_RenderWidgetHostHWND which corresponds to the bounds… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 weak_ptr_factory_(this) { 480 weak_ptr_factory_(this) {
480 host_->SetView(this); 481 host_->SetView(this);
481 window_observer_.reset(new WindowObserver(this)); 482 window_observer_.reset(new WindowObserver(this));
482 aura::client::SetTooltipText(window_, &tooltip_); 483 aura::client::SetTooltipText(window_, &tooltip_);
483 aura::client::SetActivationDelegate(window_, this); 484 aura::client::SetActivationDelegate(window_, this);
484 aura::client::SetActivationChangeObserver(window_, this); 485 aura::client::SetActivationChangeObserver(window_, this);
485 aura::client::SetFocusChangeObserver(window_, this); 486 aura::client::SetFocusChangeObserver(window_, this);
486 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 487 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
487 software_frame_manager_.reset(new SoftwareFrameManager( 488 software_frame_manager_.reset(new SoftwareFrameManager(
488 weak_ptr_factory_.GetWeakPtr())); 489 weak_ptr_factory_.GetWeakPtr()));
489 #if defined(OS_WIN)
490 plugin_parent_window_ = NULL;
491 #endif
492 ImageTransportFactory::GetInstance()->AddObserver(this); 490 ImageTransportFactory::GetInstance()->AddObserver(this);
493 } 491 }
494 492
495 //////////////////////////////////////////////////////////////////////////////// 493 ////////////////////////////////////////////////////////////////////////////////
496 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 494 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
497 495
498 bool RenderWidgetHostViewAura::OnMessageReceived( 496 bool RenderWidgetHostViewAura::OnMessageReceived(
499 const IPC::Message& message) { 497 const IPC::Message& message) {
500 bool handled = true; 498 bool handled = true;
501 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) 499 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 609 }
612 610
613 if (!current_surface_.get() && host_->is_accelerated_compositing_active() && 611 if (!current_surface_.get() && host_->is_accelerated_compositing_active() &&
614 !released_front_lock_.get()) { 612 !released_front_lock_.get()) {
615 ui::Compositor* compositor = GetCompositor(); 613 ui::Compositor* compositor = GetCompositor();
616 if (compositor) 614 if (compositor)
617 released_front_lock_ = compositor->GetCompositorLock(); 615 released_front_lock_ = compositor->GetCompositorLock();
618 } 616 }
619 617
620 #if defined(OS_WIN) 618 #if defined(OS_WIN)
619 if (legacy_render_widget_host_HWND_) {
620 // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent
621 // window before reparenting any plugins. This ensures that the plugin
622 // windows stay on top of the child Zorder in the parent and receive
623 // mouse events, etc.
624 legacy_render_widget_host_HWND_->UpdateParent(
625 GetNativeView()->GetDispatcher()->host()->GetAcceleratedWidget());
626 legacy_render_widget_host_HWND_->SetBounds(
627 window_->GetBoundsInRootWindow());
628 }
621 LPARAM lparam = reinterpret_cast<LPARAM>(this); 629 LPARAM lparam = reinterpret_cast<LPARAM>(this);
622 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); 630 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 631 #endif
631 } 632 }
632 633
633 void RenderWidgetHostViewAura::WasHidden() { 634 void RenderWidgetHostViewAura::WasHidden() {
634 if (!host_ || host_->is_hidden()) 635 if (!host_ || host_->is_hidden())
635 return; 636 return;
636 host_->WasHidden(); 637 host_->WasHidden();
637 software_frame_manager_->SetVisibility(false); 638 software_frame_manager_->SetVisibility(false);
638 delegated_frame_evictor_->SetVisible(false); 639 delegated_frame_evictor_->SetVisible(false);
639 released_front_lock_ = NULL; 640 released_front_lock_ = NULL;
640 641
641 #if defined(OS_WIN) 642 #if defined(OS_WIN)
642 constrained_rects_.clear(); 643 constrained_rects_.clear();
643 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); 644 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
644 if (dispatcher) { 645 if (dispatcher) {
645 HWND parent = dispatcher->host()->GetAcceleratedWidget(); 646 HWND parent = dispatcher->host()->GetAcceleratedWidget();
646 LPARAM lparam = reinterpret_cast<LPARAM>(this); 647 LPARAM lparam = reinterpret_cast<LPARAM>(this);
647
648 EnumChildWindows(parent, HideWindowsCallback, lparam); 648 EnumChildWindows(parent, HideWindowsCallback, lparam);
649 // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global
650 // hidden window on the same lines as Windowed plugin windows.
651 if (legacy_render_widget_host_HWND_)
652 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow());
649 } 653 }
650 if (::IsWindow(plugin_parent_window_))
651 ::SetWindowPos(plugin_parent_window_, NULL, 0, 0, 0, 0, 0);
652 #endif 654 #endif
653 } 655 }
654 656
655 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { 657 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
656 // For a SetSize operation, we don't care what coordinate system the origin 658 // 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 659 // of the window is in, it's only important to make sure that the origin
658 // remains constant after the operation. 660 // remains constant after the operation.
659 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); 661 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size));
660 } 662 }
661 663
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 return window_->HasFocus(); 862 return window_->HasFocus();
861 } 863 }
862 864
863 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { 865 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const {
864 return CanCopyToBitmap() || !!host_->GetBackingStore(false); 866 return CanCopyToBitmap() || !!host_->GetBackingStore(false);
865 } 867 }
866 868
867 void RenderWidgetHostViewAura::Show() { 869 void RenderWidgetHostViewAura::Show() {
868 window_->Show(); 870 window_->Show();
869 WasShown(); 871 WasShown();
872 #if defined(OS_WIN)
873 if (legacy_render_widget_host_HWND_)
874 legacy_render_widget_host_HWND_->Show();
875 #endif
870 } 876 }
871 877
872 void RenderWidgetHostViewAura::Hide() { 878 void RenderWidgetHostViewAura::Hide() {
873 window_->Hide(); 879 window_->Hide();
874 WasHidden(); 880 WasHidden();
881 #if defined(OS_WIN)
882 if (legacy_render_widget_host_HWND_)
883 legacy_render_widget_host_HWND_->Hide();
884 #endif
875 } 885 }
876 886
877 bool RenderWidgetHostViewAura::IsShowing() { 887 bool RenderWidgetHostViewAura::IsShowing() {
878 return window_->IsVisible(); 888 return window_->IsVisible();
879 } 889 }
880 890
881 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { 891 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const {
882 // This is the size that we want the renderer to produce. While we're waiting 892 // 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 893 // 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. 894 // we don't pipeline more resizes than we can handle.
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 // a Window::SetBoundsInternal call. 1216 // a Window::SetBoundsInternal call.
1207 if (!in_bounds_changed_) 1217 if (!in_bounds_changed_)
1208 window_->SetBounds(rect); 1218 window_->SetBounds(rect);
1209 host_->WasResized(); 1219 host_->WasResized();
1210 MaybeCreateResizeLock(); 1220 MaybeCreateResizeLock();
1211 if (touch_editing_client_) { 1221 if (touch_editing_client_) {
1212 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, 1222 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_,
1213 selection_focus_rect_); 1223 selection_focus_rect_);
1214 } 1224 }
1215 #if defined(OS_WIN) 1225 #if defined(OS_WIN)
1216 // Create the dummy plugin parent window which will be passed as the 1226 // Create the legacy dummy window which corresponds to the bounds of the
1217 // container window to windowless plugins. 1227 // webcontents. This will be passed as the container window for windowless
1228 // plugins.
1218 // Plugins like Flash assume the container window which is returned via the 1229 // Plugins like Flash assume the container window which is returned via the
1219 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. 1230 // 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 1231 // 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 1232 // window. If we return this window to plugins like Flash then it causes the
1222 // coordinate translations done by these plugins to break. 1233 // coordinate translations done by these plugins to break.
1223 if (!plugin_parent_window_ && GetNativeViewId()) { 1234 // Additonally the legacy dummy window is needed for accessibility and for
1224 plugin_parent_window_ = ::CreateWindowEx( 1235 // scrolling to work in legacy drivers for trackpoints/trackpads, etc.
1225 0, L"Static", NULL, WS_CHILDWINDOW, 0, 0, 0, 0, 1236 if (GetNativeViewId()) {
1226 reinterpret_cast<HWND>(GetNativeViewId()), NULL, NULL, NULL); 1237 if (!legacy_render_widget_host_HWND_) {
1227 if (::IsWindow(plugin_parent_window_)) 1238 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create(
1228 ::SetProp(plugin_parent_window_, content::kPluginDummyParentProperty, 1239 reinterpret_cast<HWND>(GetNativeViewId()));
1229 reinterpret_cast<HANDLE>(true)); 1240 }
1230 } 1241 if (legacy_render_widget_host_HWND_) {
1231 if (::IsWindow(plugin_parent_window_)) { 1242 legacy_render_widget_host_HWND_->SetBounds(
1232 gfx::Rect window_bounds = window_->GetBoundsInRootWindow(); 1243 window_->GetBoundsInRootWindow());
1233 ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(), 1244 }
1234 window_bounds.y(), window_bounds.width(),
1235 window_bounds.height(), 0);
1236 } 1245 }
1237 #endif 1246 #endif
1238 } 1247 }
1239 1248
1240 void RenderWidgetHostViewAura::CheckResizeLock() { 1249 void RenderWidgetHostViewAura::CheckResizeLock() {
1241 if (!resize_lock_ || resize_lock_->expected_size() != current_frame_size_) 1250 if (!resize_lock_ || resize_lock_->expected_size() != current_frame_size_)
1242 return; 1251 return;
1243 1252
1244 // Since we got the size we were looking for, unlock the compositor. But delay 1253 // 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 1254 // 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
1693 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( 1702 void RenderWidgetHostViewAura::SetParentNativeViewAccessible(
1694 gfx::NativeViewAccessible accessible_parent) { 1703 gfx::NativeViewAccessible accessible_parent) {
1695 if (GetBrowserAccessibilityManager()) { 1704 if (GetBrowserAccessibilityManager()) {
1696 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() 1705 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin()
1697 ->set_parent_iaccessible(accessible_parent); 1706 ->set_parent_iaccessible(accessible_parent);
1698 } 1707 }
1699 } 1708 }
1700 1709
1701 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() 1710 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin()
1702 const { 1711 const {
1703 return reinterpret_cast<gfx::NativeViewId>(plugin_parent_window_); 1712 if (legacy_render_widget_host_HWND_) {
1713 return reinterpret_cast<gfx::NativeViewId>(
1714 legacy_render_widget_host_HWND_->hwnd());
1715 }
1716 return NULL;
1704 } 1717 }
1705 #endif 1718 #endif
1706 1719
1707 void RenderWidgetHostViewAura::BuffersSwapped( 1720 void RenderWidgetHostViewAura::BuffersSwapped(
1708 const gfx::Size& surface_size, 1721 const gfx::Size& surface_size,
1709 const gfx::Rect& damage_rect, 1722 const gfx::Rect& damage_rect,
1710 float surface_scale_factor, 1723 float surface_scale_factor,
1711 const std::string& mailbox_name, 1724 const std::string& mailbox_name,
1712 const std::vector<ui::LatencyInfo>& latency_info, 1725 const std::vector<ui::LatencyInfo>& latency_info,
1713 const BufferPresentedCallback& ack_callback) { 1726 const BufferPresentedCallback& ack_callback) {
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2185 2198
2186 void RenderWidgetHostViewAura::SetScrollOffsetPinning( 2199 void RenderWidgetHostViewAura::SetScrollOffsetPinning(
2187 bool is_pinned_to_left, bool is_pinned_to_right) { 2200 bool is_pinned_to_left, bool is_pinned_to_right) {
2188 // Not needed. Mac-only. 2201 // Not needed. Mac-only.
2189 } 2202 }
2190 2203
2191 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { 2204 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() {
2192 if (GetBrowserAccessibilityManager()) 2205 if (GetBrowserAccessibilityManager())
2193 return; 2206 return;
2194 2207
2208 BrowserAccessibilityManager* manager = NULL;
2195 #if defined(OS_WIN) 2209 #if defined(OS_WIN)
2196 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); 2210 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
2197 if (!dispatcher) 2211 if (!dispatcher)
2198 return; 2212 return;
2199 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); 2213 HWND hwnd = dispatcher->host()->GetAcceleratedWidget();
2200 2214
2201 // The accessible_parent may be NULL at this point. The WebContents will pass 2215 // 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 2216 // 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 2217 // RenderWidgetHost) when it is known. This instance will then set it on its
2204 // BrowserAccessibilityManager. 2218 // BrowserAccessibilityManager.
2205 gfx::NativeViewAccessible accessible_parent = 2219 gfx::NativeViewAccessible accessible_parent =
2206 host_->GetParentNativeViewAccessible(); 2220 host_->GetParentNativeViewAccessible();
2207 2221
2208 BrowserAccessibilityManager* manager = new BrowserAccessibilityManagerWin( 2222 if (legacy_render_widget_host_HWND_) {
2209 hwnd, accessible_parent, 2223 manager = new BrowserAccessibilityManagerWin(
2210 BrowserAccessibilityManagerWin::GetEmptyDocument(), this); 2224 legacy_render_widget_host_HWND_.get(), accessible_parent,
2225 BrowserAccessibilityManagerWin::GetEmptyDocument(), this);
2226 }
2211 #else 2227 #else
2212 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( 2228 manager = BrowserAccessibilityManager::Create(
2213 BrowserAccessibilityManager::GetEmptyDocument(), this); 2229 BrowserAccessibilityManager::GetEmptyDocument(), this);
2214 #endif 2230 #endif
2215
2216 SetBrowserAccessibilityManager(manager); 2231 SetBrowserAccessibilityManager(manager);
2217 } 2232 }
2218 2233
2219 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { 2234 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
2220 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); 2235 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
2221 } 2236 }
2222 2237
2223 bool RenderWidgetHostViewAura::LockMouse() { 2238 bool RenderWidgetHostViewAura::LockMouse() {
2224 aura::Window* root_window = window_->GetRootWindow(); 2239 aura::Window* root_window = window_->GetRootWindow();
2225 if (!root_window) 2240 if (!root_window)
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 // destroyed, as it may then outlive the GLHelper. 3343 // destroyed, as it may then outlive the GLHelper.
3329 for (std::set<OwnedMailbox*>::iterator it = 3344 for (std::set<OwnedMailbox*>::iterator it =
3330 active_frame_subscriber_textures_.begin(); 3345 active_frame_subscriber_textures_.begin();
3331 it != active_frame_subscriber_textures_.end(); 3346 it != active_frame_subscriber_textures_.end();
3332 ++it) { 3347 ++it) {
3333 (*it)->Destroy(); 3348 (*it)->Destroy();
3334 } 3349 }
3335 active_frame_subscriber_textures_.clear(); 3350 active_frame_subscriber_textures_.clear();
3336 3351
3337 #if defined(OS_WIN) 3352 #if defined(OS_WIN)
3338 if (::IsWindow(plugin_parent_window_)) 3353 legacy_render_widget_host_HWND_.reset(NULL);
3339 ::DestroyWindow(plugin_parent_window_);
3340 #endif 3354 #endif
3341 } 3355 }
3342 3356
3343 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 3357 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
3344 const gfx::Point screen_point = 3358 const gfx::Point screen_point =
3345 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); 3359 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
3346 aura::Window* root_window = window_->GetRootWindow(); 3360 aura::Window* root_window = window_->GetRootWindow();
3347 if (!root_window) 3361 if (!root_window)
3348 return; 3362 return;
3349 3363
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3476 3490
3477 if (!compositor->HasObserver(this)) 3491 if (!compositor->HasObserver(this))
3478 compositor->AddObserver(this); 3492 compositor->AddObserver(this);
3479 3493
3480 can_lock_compositor_ = NO_PENDING_COMMIT; 3494 can_lock_compositor_ = NO_PENDING_COMMIT;
3481 on_compositing_did_commit_callbacks_.push_back(callback); 3495 on_compositing_did_commit_callbacks_.push_back(callback);
3482 } 3496 }
3483 3497
3484 void RenderWidgetHostViewAura::AddedToRootWindow() { 3498 void RenderWidgetHostViewAura::AddedToRootWindow() {
3485 window_->GetDispatcher()->AddRootWindowObserver(this); 3499 window_->GetDispatcher()->AddRootWindowObserver(this);
3486 host_->ParentChanged(GetNativeViewId());
3487 UpdateScreenInfo(window_); 3500 UpdateScreenInfo(window_);
3488 3501
3489 aura::client::CursorClient* cursor_client = 3502 aura::client::CursorClient* cursor_client =
3490 aura::client::GetCursorClient(window_->GetRootWindow()); 3503 aura::client::GetCursorClient(window_->GetRootWindow());
3491 if (cursor_client) { 3504 if (cursor_client) {
3492 cursor_client->AddObserver(this); 3505 cursor_client->AddObserver(this);
3493 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); 3506 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible());
3494 } 3507 }
3495 if (current_surface_.get()) 3508 if (current_surface_.get())
3496 UpdateExternalTexture(); 3509 UpdateExternalTexture();
3497 if (HasFocus()) { 3510 if (HasFocus()) {
3498 ui::InputMethod* input_method = GetInputMethod(); 3511 ui::InputMethod* input_method = GetInputMethod();
3499 if (input_method) 3512 if (input_method)
3500 input_method->SetFocusedTextInputClient(this); 3513 input_method->SetFocusedTextInputClient(this);
3501 } 3514 }
3515
3516 #if defined(OS_WIN)
3517 // The parent may have changed here. Ensure that the legacy window is
3518 // reparented accordingly.
3519 if (legacy_render_widget_host_HWND_)
3520 legacy_render_widget_host_HWND_->UpdateParent(
3521 reinterpret_cast<HWND>(GetNativeViewId()));
3522 #endif
3502 } 3523 }
3503 3524
3504 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 3525 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
3505 aura::client::CursorClient* cursor_client = 3526 aura::client::CursorClient* cursor_client =
3506 aura::client::GetCursorClient(window_->GetRootWindow()); 3527 aura::client::GetCursorClient(window_->GetRootWindow());
3507 if (cursor_client) 3528 if (cursor_client)
3508 cursor_client->RemoveObserver(this); 3529 cursor_client->RemoveObserver(this);
3509 3530
3510 DetachFromInputMethod(); 3531 DetachFromInputMethod();
3511 3532
3512 window_->GetDispatcher()->RemoveRootWindowObserver(this); 3533 window_->GetDispatcher()->RemoveRootWindowObserver(this);
3513 host_->ParentChanged(0);
3514 ui::Compositor* compositor = GetCompositor(); 3534 ui::Compositor* compositor = GetCompositor();
3515 if (current_surface_.get()) { 3535 if (current_surface_.get()) {
3516 // We can't get notification for commits after this point, which would 3536 // 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 3537 // 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 3538 // 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 3539 // synchronizes with the compositor thread, and makes it safe to run the
3520 // callback. 3540 // callback.
3521 window_->layer()->SetShowPaintedContent(); 3541 window_->layer()->SetShowPaintedContent();
3522 } 3542 }
3523 RunOnCommitCallbacks(); 3543 RunOnCommitCallbacks();
3524 resize_lock_.reset(); 3544 resize_lock_.reset();
3525 host_->WasResized(); 3545 host_->WasResized();
3526 if (compositor && compositor->HasObserver(this)) 3546 if (compositor && compositor->HasObserver(this))
3527 compositor->RemoveObserver(this); 3547 compositor->RemoveObserver(this);
3548
3549 #if defined(OS_WIN)
3550 // Update the legacy window's parent temporarily to the desktop window. It
3551 // will eventually get reparented to the right root.
3552 if (legacy_render_widget_host_HWND_)
3553 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
3554 #endif
3528 } 3555 }
3529 3556
3530 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { 3557 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const {
3531 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); 3558 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
3532 return dispatcher ? dispatcher->host()->compositor() : NULL; 3559 return dispatcher ? dispatcher->host()->compositor() : NULL;
3533 } 3560 }
3534 3561
3535 void RenderWidgetHostViewAura::DetachFromInputMethod() { 3562 void RenderWidgetHostViewAura::DetachFromInputMethod() {
3536 ui::InputMethod* input_method = GetInputMethod(); 3563 ui::InputMethod* input_method = GetInputMethod();
3537 if (input_method && input_method->GetTextInputClient() == this) 3564 if (input_method && input_method->GetTextInputClient() == this)
(...skipping 18 matching lines...) Expand all
3556 RenderWidgetHost* widget) { 3583 RenderWidgetHost* widget) {
3557 return new RenderWidgetHostViewAura(widget); 3584 return new RenderWidgetHostViewAura(widget);
3558 } 3585 }
3559 3586
3560 // static 3587 // static
3561 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3588 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3562 GetScreenInfoForWindow(results, NULL); 3589 GetScreenInfoForWindow(results, NULL);
3563 } 3590 }
3564 3591
3565 } // namespace content 3592 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698