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 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 } | 2512 } |
2513 | 2513 |
2514 #if defined(OS_WIN) | 2514 #if defined(OS_WIN) |
2515 // The parent may have changed here. Ensure that the legacy window is | 2515 // The parent may have changed here. Ensure that the legacy window is |
2516 // reparented accordingly. | 2516 // reparented accordingly. |
2517 if (legacy_render_widget_host_HWND_) | 2517 if (legacy_render_widget_host_HWND_) |
2518 legacy_render_widget_host_HWND_->UpdateParent( | 2518 legacy_render_widget_host_HWND_->UpdateParent( |
2519 reinterpret_cast<HWND>(GetNativeViewId())); | 2519 reinterpret_cast<HWND>(GetNativeViewId())); |
2520 #endif | 2520 #endif |
2521 | 2521 |
2522 delegated_frame_host_->AddedToWindow(); | 2522 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor()); |
2523 } | 2523 } |
2524 | 2524 |
2525 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 2525 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
2526 aura::client::CursorClient* cursor_client = | 2526 aura::client::CursorClient* cursor_client = |
2527 aura::client::GetCursorClient(window_->GetRootWindow()); | 2527 aura::client::GetCursorClient(window_->GetRootWindow()); |
2528 if (cursor_client) | 2528 if (cursor_client) |
2529 cursor_client->RemoveObserver(this); | 2529 cursor_client->RemoveObserver(this); |
2530 | 2530 |
2531 DetachFromInputMethod(); | 2531 DetachFromInputMethod(); |
2532 | 2532 |
2533 window_->GetHost()->RemoveObserver(this); | 2533 window_->GetHost()->RemoveObserver(this); |
2534 delegated_frame_host_->RemovingFromWindow(); | 2534 delegated_frame_host_->ResetCompositor(); |
2535 | 2535 |
2536 #if defined(OS_WIN) | 2536 #if defined(OS_WIN) |
2537 // Update the legacy window's parent temporarily to the desktop window. It | 2537 // Update the legacy window's parent temporarily to the desktop window. It |
2538 // will eventually get reparented to the right root. | 2538 // will eventually get reparented to the right root. |
2539 if (legacy_render_widget_host_HWND_) | 2539 if (legacy_render_widget_host_HWND_) |
2540 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); | 2540 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); |
2541 #endif | 2541 #endif |
2542 } | 2542 } |
2543 | 2543 |
2544 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2544 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 host_->ForwardKeyboardEvent(event); | 2576 host_->ForwardKeyboardEvent(event); |
2577 } | 2577 } |
2578 | 2578 |
2579 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { | 2579 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { |
2580 return kN32_SkColorType; | 2580 return kN32_SkColorType; |
2581 } | 2581 } |
2582 | 2582 |
2583 //////////////////////////////////////////////////////////////////////////////// | 2583 //////////////////////////////////////////////////////////////////////////////// |
2584 // DelegatedFrameHost, public: | 2584 // DelegatedFrameHost, public: |
2585 | 2585 |
2586 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { | |
2587 aura::WindowTreeHost* host = window_->GetHost(); | |
2588 return host ? host->compositor() : NULL; | |
2589 } | |
2590 | |
2591 ui::Layer* RenderWidgetHostViewAura::GetLayer() { | 2586 ui::Layer* RenderWidgetHostViewAura::GetLayer() { |
2592 return window_->layer(); | 2587 return window_->layer(); |
2593 } | 2588 } |
2594 | 2589 |
2595 RenderWidgetHostImpl* RenderWidgetHostViewAura::GetHost() { | 2590 RenderWidgetHostImpl* RenderWidgetHostViewAura::GetHost() { |
2596 return host_; | 2591 return host_; |
2597 } | 2592 } |
2598 | 2593 |
2599 bool RenderWidgetHostViewAura::IsVisible() { | 2594 bool RenderWidgetHostViewAura::IsVisible() { |
2600 return IsShowing(); | 2595 return IsShowing(); |
(...skipping 28 matching lines...) Expand all Loading... |
2629 | 2624 |
2630 //////////////////////////////////////////////////////////////////////////////// | 2625 //////////////////////////////////////////////////////////////////////////////// |
2631 // RenderWidgetHostViewBase, public: | 2626 // RenderWidgetHostViewBase, public: |
2632 | 2627 |
2633 // static | 2628 // static |
2634 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2629 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2635 GetScreenInfoForWindow(results, NULL); | 2630 GetScreenInfoForWindow(results, NULL); |
2636 } | 2631 } |
2637 | 2632 |
2638 } // namespace content | 2633 } // namespace content |
OLD | NEW |