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

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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 "base/win/windows_version.h" 83 #include "base/win/windows_version.h"
84 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 84 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
85 #include "content/browser/accessibility/browser_accessibility_win.h" 85 #include "content/browser/accessibility/browser_accessibility_win.h"
86 #include "content/browser/renderer_host/legacy_render_widget_host_win.h"
86 #include "content/common/plugin_constants_win.h" 87 #include "content/common/plugin_constants_win.h"
87 #include "ui/base/win/hidden_window.h" 88 #include "ui/base/win/hidden_window.h"
88 #include "ui/gfx/gdi_util.h" 89 #include "ui/gfx/gdi_util.h"
89 #include "ui/gfx/win/dpi.h" 90 #include "ui/gfx/win/dpi.h"
90 #endif 91 #endif
91 92
92 using gfx::RectToSkIRect; 93 using gfx::RectToSkIRect;
93 using gfx::SkIRectToRect; 94 using gfx::SkIRectToRect;
94 95
95 using blink::WebScreenInfo; 96 using blink::WebScreenInfo;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 weak_ptr_factory_(this) { 493 weak_ptr_factory_(this) {
493 host_->SetView(this); 494 host_->SetView(this);
494 window_observer_.reset(new WindowObserver(this)); 495 window_observer_.reset(new WindowObserver(this));
495 aura::client::SetTooltipText(window_, &tooltip_); 496 aura::client::SetTooltipText(window_, &tooltip_);
496 aura::client::SetActivationDelegate(window_, this); 497 aura::client::SetActivationDelegate(window_, this);
497 aura::client::SetActivationChangeObserver(window_, this); 498 aura::client::SetActivationChangeObserver(window_, this);
498 aura::client::SetFocusChangeObserver(window_, this); 499 aura::client::SetFocusChangeObserver(window_, this);
499 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 500 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
500 software_frame_manager_.reset(new SoftwareFrameManager( 501 software_frame_manager_.reset(new SoftwareFrameManager(
501 weak_ptr_factory_.GetWeakPtr())); 502 weak_ptr_factory_.GetWeakPtr()));
502 #if defined(OS_WIN)
503 plugin_parent_window_ = NULL;
504 #endif
505 ImageTransportFactory::GetInstance()->AddObserver(this); 503 ImageTransportFactory::GetInstance()->AddObserver(this);
506 } 504 }
507 505
508 //////////////////////////////////////////////////////////////////////////////// 506 ////////////////////////////////////////////////////////////////////////////////
509 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 507 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
510 508
511 bool RenderWidgetHostViewAura::OnMessageReceived( 509 bool RenderWidgetHostViewAura::OnMessageReceived(
512 const IPC::Message& message) { 510 const IPC::Message& message) {
513 bool handled = true; 511 bool handled = true;
514 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) 512 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 !released_front_lock_.get()) { 625 !released_front_lock_.get()) {
628 ui::Compositor* compositor = GetCompositor(); 626 ui::Compositor* compositor = GetCompositor();
629 if (compositor) 627 if (compositor)
630 released_front_lock_ = compositor->GetCompositorLock(); 628 released_front_lock_ = compositor->GetCompositorLock();
631 } 629 }
632 630
633 #if defined(OS_WIN) 631 #if defined(OS_WIN)
634 LPARAM lparam = reinterpret_cast<LPARAM>(this); 632 LPARAM lparam = reinterpret_cast<LPARAM>(this);
635 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); 633 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam);
636 634
637 if (::IsWindow(plugin_parent_window_)) { 635 if (legacy_render_widget_host_HWND_) {
638 gfx::Rect window_bounds = window_->GetBoundsInRootWindow(); 636 legacy_render_widget_host_HWND_->SetBounds(
639 ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(), 637 window_->GetBoundsInRootWindow());
640 window_bounds.y(), window_bounds.width(),
641 window_bounds.height(), 0);
642 } 638 }
643 #endif 639 #endif
644 } 640 }
645 641
646 void RenderWidgetHostViewAura::WasHidden() { 642 void RenderWidgetHostViewAura::WasHidden() {
647 if (!host_ || host_->is_hidden()) 643 if (!host_ || host_->is_hidden())
648 return; 644 return;
649 host_->WasHidden(); 645 host_->WasHidden();
650 software_frame_manager_->SetVisibility(false); 646 software_frame_manager_->SetVisibility(false);
651 delegated_frame_evictor_->SetVisible(false); 647 delegated_frame_evictor_->SetVisible(false);
652 released_front_lock_ = NULL; 648 released_front_lock_ = NULL;
653 649
654 #if defined(OS_WIN) 650 #if defined(OS_WIN)
655 constrained_rects_.clear(); 651 constrained_rects_.clear();
656 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); 652 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
657 if (dispatcher) { 653 if (dispatcher) {
658 HWND parent = dispatcher->host()->GetAcceleratedWidget(); 654 HWND parent = dispatcher->host()->GetAcceleratedWidget();
659 LPARAM lparam = reinterpret_cast<LPARAM>(this); 655 LPARAM lparam = reinterpret_cast<LPARAM>(this);
660 656
661 EnumChildWindows(parent, HideWindowsCallback, lparam); 657 EnumChildWindows(parent, HideWindowsCallback, lparam);
662 } 658 }
663 if (::IsWindow(plugin_parent_window_))
664 ::SetWindowPos(plugin_parent_window_, NULL, 0, 0, 0, 0, 0);
665 #endif 659 #endif
666 } 660 }
667 661
668 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { 662 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
669 // For a SetSize operation, we don't care what coordinate system the origin 663 // For a SetSize operation, we don't care what coordinate system the origin
670 // of the window is in, it's only important to make sure that the origin 664 // of the window is in, it's only important to make sure that the origin
671 // remains constant after the operation. 665 // remains constant after the operation.
672 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); 666 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size));
673 } 667 }
674 668
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 return window_->HasFocus(); 867 return window_->HasFocus();
874 } 868 }
875 869
876 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { 870 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const {
877 return CanCopyToBitmap() || !!host_->GetBackingStore(false); 871 return CanCopyToBitmap() || !!host_->GetBackingStore(false);
878 } 872 }
879 873
880 void RenderWidgetHostViewAura::Show() { 874 void RenderWidgetHostViewAura::Show() {
881 window_->Show(); 875 window_->Show();
882 WasShown(); 876 WasShown();
877 #if defined(OS_WIN)
878 if (legacy_render_widget_host_HWND_)
879 legacy_render_widget_host_HWND_->Show();
880 #endif
883 } 881 }
884 882
885 void RenderWidgetHostViewAura::Hide() { 883 void RenderWidgetHostViewAura::Hide() {
886 window_->Hide(); 884 window_->Hide();
887 WasHidden(); 885 WasHidden();
886 #if defined(OS_WIN)
887 if (legacy_render_widget_host_HWND_)
888 legacy_render_widget_host_HWND_->Hide();
889 #endif
888 } 890 }
889 891
890 bool RenderWidgetHostViewAura::IsShowing() { 892 bool RenderWidgetHostViewAura::IsShowing() {
891 return window_->IsVisible(); 893 return window_->IsVisible();
892 } 894 }
893 895
894 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { 896 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const {
895 // This is the size that we want the renderer to produce. While we're waiting 897 // This is the size that we want the renderer to produce. While we're waiting
896 // for the correct frame (i.e. during a resize), don't change the size so that 898 // for the correct frame (i.e. during a resize), don't change the size so that
897 // we don't pipeline more resizes than we can handle. 899 // we don't pipeline more resizes than we can handle.
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 // a Window::SetBoundsInternal call. 1223 // a Window::SetBoundsInternal call.
1222 if (!in_bounds_changed_) 1224 if (!in_bounds_changed_)
1223 window_->SetBounds(rect); 1225 window_->SetBounds(rect);
1224 host_->WasResized(); 1226 host_->WasResized();
1225 MaybeCreateResizeLock(); 1227 MaybeCreateResizeLock();
1226 if (touch_editing_client_) { 1228 if (touch_editing_client_) {
1227 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, 1229 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_,
1228 selection_focus_rect_); 1230 selection_focus_rect_);
1229 } 1231 }
1230 #if defined(OS_WIN) 1232 #if defined(OS_WIN)
1231 // Create the dummy plugin parent window which will be passed as the 1233 // Create the legacy dummy window which corresponds to the bounds of the
1232 // container window to windowless plugins. 1234 // webcontents. This will be passed as the container window for windowless
1235 // plugins.
1233 // Plugins like Flash assume the container window which is returned via the 1236 // Plugins like Flash assume the container window which is returned via the
1234 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. 1237 // NPNVnetscapeWindow property corresponds to the bounds of the webpage.
1235 // This is not true in Aura where we have only HWND which is the main Aura 1238 // This is not true in Aura where we have only HWND which is the main Aura
1236 // window. If we return this window to plugins like Flash then it causes the 1239 // window. If we return this window to plugins like Flash then it causes the
1237 // coordinate translations done by these plugins to break. 1240 // coordinate translations done by these plugins to break.
1238 if (!plugin_parent_window_ && GetNativeViewId()) { 1241 // Additonally the legacy dummy window is needed for accessibility and for
1239 plugin_parent_window_ = ::CreateWindowEx( 1242 // scrolling to work in legacy drivers for trackpoints/trackpads, etc.
1240 0, L"Static", NULL, WS_CHILDWINDOW, 0, 0, 0, 0, 1243 if (GetNativeViewId()) {
1241 reinterpret_cast<HWND>(GetNativeViewId()), NULL, NULL, NULL); 1244 if (!legacy_render_widget_host_HWND_) {
1242 if (::IsWindow(plugin_parent_window_)) 1245 legacy_render_widget_host_HWND_.reset(LegacyRenderWidgetHostHWND::Create(
1243 ::SetProp(plugin_parent_window_, content::kPluginDummyParentProperty, 1246 reinterpret_cast<HWND>(GetNativeViewId())));
1244 reinterpret_cast<HANDLE>(true)); 1247 }
1245 } 1248 if (legacy_render_widget_host_HWND_) {
1246 if (::IsWindow(plugin_parent_window_)) { 1249 legacy_render_widget_host_HWND_->SetBounds(
1247 gfx::Rect window_bounds = window_->GetBoundsInRootWindow(); 1250 window_->GetBoundsInRootWindow());
1248 ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(), 1251 }
1249 window_bounds.y(), window_bounds.width(),
1250 window_bounds.height(), 0);
1251 } 1252 }
1252 #endif 1253 #endif
1253 } 1254 }
1254 1255
1255 void RenderWidgetHostViewAura::CheckResizeLock() { 1256 void RenderWidgetHostViewAura::CheckResizeLock() {
1256 if (!resize_lock_ || resize_lock_->expected_size() != current_frame_size_) 1257 if (!resize_lock_ || resize_lock_->expected_size() != current_frame_size_)
1257 return; 1258 return;
1258 1259
1259 // Since we got the size we were looking for, unlock the compositor. But delay 1260 // Since we got the size we were looking for, unlock the compositor. But delay
1260 // the release of the lock until we've kicked a frame with the new texture, to 1261 // the release of the lock until we've kicked a frame with the new texture, to
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( 1711 void RenderWidgetHostViewAura::SetParentNativeViewAccessible(
1711 gfx::NativeViewAccessible accessible_parent) { 1712 gfx::NativeViewAccessible accessible_parent) {
1712 if (GetBrowserAccessibilityManager()) { 1713 if (GetBrowserAccessibilityManager()) {
1713 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() 1714 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin()
1714 ->set_parent_iaccessible(accessible_parent); 1715 ->set_parent_iaccessible(accessible_parent);
1715 } 1716 }
1716 } 1717 }
1717 1718
1718 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() 1719 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin()
1719 const { 1720 const {
1720 return reinterpret_cast<gfx::NativeViewId>(plugin_parent_window_); 1721 if (legacy_render_widget_host_HWND_) {
1722 return reinterpret_cast<gfx::NativeViewId>(
1723 legacy_render_widget_host_HWND_->hwnd());
1724 }
1725 return NULL;
1721 } 1726 }
1722 #endif 1727 #endif
1723 1728
1724 void RenderWidgetHostViewAura::BuffersSwapped( 1729 void RenderWidgetHostViewAura::BuffersSwapped(
1725 const gfx::Size& surface_size, 1730 const gfx::Size& surface_size,
1726 const gfx::Rect& damage_rect, 1731 const gfx::Rect& damage_rect,
1727 float surface_scale_factor, 1732 float surface_scale_factor,
1728 const std::string& mailbox_name, 1733 const std::string& mailbox_name,
1729 const std::vector<ui::LatencyInfo>& latency_info, 1734 const std::vector<ui::LatencyInfo>& latency_info,
1730 const BufferPresentedCallback& ack_callback) { 1735 const BufferPresentedCallback& ack_callback) {
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 2203
2199 void RenderWidgetHostViewAura::SetScrollOffsetPinning( 2204 void RenderWidgetHostViewAura::SetScrollOffsetPinning(
2200 bool is_pinned_to_left, bool is_pinned_to_right) { 2205 bool is_pinned_to_left, bool is_pinned_to_right) {
2201 // Not needed. Mac-only. 2206 // Not needed. Mac-only.
2202 } 2207 }
2203 2208
2204 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { 2209 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() {
2205 if (GetBrowserAccessibilityManager()) 2210 if (GetBrowserAccessibilityManager())
2206 return; 2211 return;
2207 2212
2213 BrowserAccessibilityManager* manager = NULL;
2208 #if defined(OS_WIN) 2214 #if defined(OS_WIN)
2209 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); 2215 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
2210 if (!dispatcher) 2216 if (!dispatcher)
2211 return; 2217 return;
2212 HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); 2218 HWND hwnd = dispatcher->host()->GetAcceleratedWidget();
2213 2219
2214 // The accessible_parent may be NULL at this point. The WebContents will pass 2220 // The accessible_parent may be NULL at this point. The WebContents will pass
2215 // it down to this instance (by way of the RenderViewHost and 2221 // it down to this instance (by way of the RenderViewHost and
2216 // RenderWidgetHost) when it is known. This instance will then set it on its 2222 // RenderWidgetHost) when it is known. This instance will then set it on its
2217 // BrowserAccessibilityManager. 2223 // BrowserAccessibilityManager.
2218 gfx::NativeViewAccessible accessible_parent = 2224 gfx::NativeViewAccessible accessible_parent =
2219 host_->GetParentNativeViewAccessible(); 2225 host_->GetParentNativeViewAccessible();
2220 2226
2221 BrowserAccessibilityManager* manager = new BrowserAccessibilityManagerWin( 2227 if (legacy_render_widget_host_HWND_) {
2222 hwnd, accessible_parent, 2228 manager = new BrowserAccessibilityManagerWin(
2223 BrowserAccessibilityManagerWin::GetEmptyDocument(), this); 2229 legacy_render_widget_host_HWND_.get(), accessible_parent,
2230 BrowserAccessibilityManagerWin::GetEmptyDocument(), this);
2231 }
2224 #else 2232 #else
2225 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( 2233 manager = BrowserAccessibilityManager::Create(
2226 BrowserAccessibilityManager::GetEmptyDocument(), this); 2234 BrowserAccessibilityManager::GetEmptyDocument(), this);
2227 #endif 2235 #endif
2228
2229 SetBrowserAccessibilityManager(manager); 2236 SetBrowserAccessibilityManager(manager);
2230 } 2237 }
2231 2238
2232 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { 2239 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
2233 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); 2240 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
2234 } 2241 }
2235 2242
2236 bool RenderWidgetHostViewAura::LockMouse() { 2243 bool RenderWidgetHostViewAura::LockMouse() {
2237 aura::Window* root_window = window_->GetRootWindow(); 2244 aura::Window* root_window = window_->GetRootWindow();
2238 if (!root_window) 2245 if (!root_window)
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 // destroyed, as it may then outlive the GLHelper. 3355 // destroyed, as it may then outlive the GLHelper.
3349 for (std::set<OwnedMailbox*>::iterator it = 3356 for (std::set<OwnedMailbox*>::iterator it =
3350 active_frame_subscriber_textures_.begin(); 3357 active_frame_subscriber_textures_.begin();
3351 it != active_frame_subscriber_textures_.end(); 3358 it != active_frame_subscriber_textures_.end();
3352 ++it) { 3359 ++it) {
3353 (*it)->Destroy(); 3360 (*it)->Destroy();
3354 } 3361 }
3355 active_frame_subscriber_textures_.clear(); 3362 active_frame_subscriber_textures_.clear();
3356 3363
3357 #if defined(OS_WIN) 3364 #if defined(OS_WIN)
3358 if (::IsWindow(plugin_parent_window_)) 3365 legacy_render_widget_host_HWND_.reset(NULL);
3359 ::DestroyWindow(plugin_parent_window_);
3360 #endif 3366 #endif
3361 } 3367 }
3362 3368
3363 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 3369 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
3364 const gfx::Point screen_point = 3370 const gfx::Point screen_point =
3365 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); 3371 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
3366 aura::Window* root_window = window_->GetRootWindow(); 3372 aura::Window* root_window = window_->GetRootWindow();
3367 if (!root_window) 3373 if (!root_window)
3368 return; 3374 return;
3369 3375
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3496 3502
3497 if (!compositor->HasObserver(this)) 3503 if (!compositor->HasObserver(this))
3498 compositor->AddObserver(this); 3504 compositor->AddObserver(this);
3499 3505
3500 can_lock_compositor_ = NO_PENDING_COMMIT; 3506 can_lock_compositor_ = NO_PENDING_COMMIT;
3501 on_compositing_did_commit_callbacks_.push_back(callback); 3507 on_compositing_did_commit_callbacks_.push_back(callback);
3502 } 3508 }
3503 3509
3504 void RenderWidgetHostViewAura::AddedToRootWindow() { 3510 void RenderWidgetHostViewAura::AddedToRootWindow() {
3505 window_->GetDispatcher()->AddRootWindowObserver(this); 3511 window_->GetDispatcher()->AddRootWindowObserver(this);
3506 host_->ParentChanged(GetNativeViewId());
3507 UpdateScreenInfo(window_); 3512 UpdateScreenInfo(window_);
3508 3513
3509 aura::client::CursorClient* cursor_client = 3514 aura::client::CursorClient* cursor_client =
3510 aura::client::GetCursorClient(window_->GetRootWindow()); 3515 aura::client::GetCursorClient(window_->GetRootWindow());
3511 if (cursor_client) { 3516 if (cursor_client) {
3512 cursor_client->AddObserver(this); 3517 cursor_client->AddObserver(this);
3513 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); 3518 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible());
3514 } 3519 }
3515 if (current_surface_.get()) 3520 if (current_surface_.get())
3516 UpdateExternalTexture(); 3521 UpdateExternalTexture();
3517 if (HasFocus()) { 3522 if (HasFocus()) {
3518 ui::InputMethod* input_method = GetInputMethod(); 3523 ui::InputMethod* input_method = GetInputMethod();
3519 if (input_method) 3524 if (input_method)
3520 input_method->SetFocusedTextInputClient(this); 3525 input_method->SetFocusedTextInputClient(this);
3521 } 3526 }
3527
3528 #if defined(OS_WIN)
3529 // The parent may have changed here. Ensure that the legacy window is
3530 // reparented accordingly.
3531 if (legacy_render_widget_host_HWND_)
3532 legacy_render_widget_host_HWND_->UpdateParent(
3533 reinterpret_cast<HWND>(GetNativeViewId()));
3534 #endif
3522 } 3535 }
3523 3536
3524 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 3537 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
3525 aura::client::CursorClient* cursor_client = 3538 aura::client::CursorClient* cursor_client =
3526 aura::client::GetCursorClient(window_->GetRootWindow()); 3539 aura::client::GetCursorClient(window_->GetRootWindow());
3527 if (cursor_client) 3540 if (cursor_client)
3528 cursor_client->RemoveObserver(this); 3541 cursor_client->RemoveObserver(this);
3529 3542
3530 DetachFromInputMethod(); 3543 DetachFromInputMethod();
3531 3544
3532 window_->GetDispatcher()->RemoveRootWindowObserver(this); 3545 window_->GetDispatcher()->RemoveRootWindowObserver(this);
3533 host_->ParentChanged(0);
3534 ui::Compositor* compositor = GetCompositor(); 3546 ui::Compositor* compositor = GetCompositor();
3535 if (current_surface_.get()) { 3547 if (current_surface_.get()) {
3536 // We can't get notification for commits after this point, which would 3548 // We can't get notification for commits after this point, which would
3537 // guarantee that the compositor isn't using an old texture any more, so 3549 // guarantee that the compositor isn't using an old texture any more, so
3538 // instead we force the layer to stop using any external resources which 3550 // instead we force the layer to stop using any external resources which
3539 // synchronizes with the compositor thread, and makes it safe to run the 3551 // synchronizes with the compositor thread, and makes it safe to run the
3540 // callback. 3552 // callback.
3541 window_->layer()->SetShowPaintedContent(); 3553 window_->layer()->SetShowPaintedContent();
3542 } 3554 }
3543 RunOnCommitCallbacks(); 3555 RunOnCommitCallbacks();
3544 resize_lock_.reset(); 3556 resize_lock_.reset();
3545 host_->WasResized(); 3557 host_->WasResized();
3546 if (compositor && compositor->HasObserver(this)) 3558 if (compositor && compositor->HasObserver(this))
3547 compositor->RemoveObserver(this); 3559 compositor->RemoveObserver(this);
3560
3561 #if defined(OS_WIN)
3562 // Update the legacy window's parent temporarily to the desktop window. It
3563 // will eventually get reparented to the right root.
3564 if (legacy_render_widget_host_HWND_)
3565 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
sky 2014/02/05 23:56:41 When you do this should you disable the window or
ananta 2014/02/06 00:42:04 It should not because of WS_EX_TRANSPARENT. Added
3566 #endif
3548 } 3567 }
3549 3568
3550 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { 3569 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const {
3551 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); 3570 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
3552 return dispatcher ? dispatcher->host()->compositor() : NULL; 3571 return dispatcher ? dispatcher->host()->compositor() : NULL;
3553 } 3572 }
3554 3573
3555 void RenderWidgetHostViewAura::DetachFromInputMethod() { 3574 void RenderWidgetHostViewAura::DetachFromInputMethod() {
3556 ui::InputMethod* input_method = GetInputMethod(); 3575 ui::InputMethod* input_method = GetInputMethod();
3557 if (input_method && input_method->GetTextInputClient() == this) 3576 if (input_method && input_method->GetTextInputClient() == this)
(...skipping 18 matching lines...) Expand all
3576 RenderWidgetHost* widget) { 3595 RenderWidgetHost* widget) {
3577 return new RenderWidgetHostViewAura(widget); 3596 return new RenderWidgetHostViewAura(widget);
3578 } 3597 }
3579 3598
3580 // static 3599 // static
3581 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3600 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3582 GetScreenInfoForWindow(results, NULL); 3601 GetScreenInfoForWindow(results, NULL);
3583 } 3602 }
3584 3603
3585 } // namespace content 3604 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698