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

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

Issue 859423002: Explicitly specify the ui::Compositor to DelegatedFrameHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add aura:: Created 5 years, 11 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
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 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 // RenderWidgetHostViewAura, aura::WindowTreeHostObserver implementation: 2238 // RenderWidgetHostViewAura, aura::WindowTreeHostObserver implementation:
2239 2239
2240 void RenderWidgetHostViewAura::OnHostMoved(const aura::WindowTreeHost* host, 2240 void RenderWidgetHostViewAura::OnHostMoved(const aura::WindowTreeHost* host,
2241 const gfx::Point& new_origin) { 2241 const gfx::Point& new_origin) {
2242 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved", 2242 TRACE_EVENT1("ui", "RenderWidgetHostViewAura::OnHostMoved",
2243 "new_origin", new_origin.ToString()); 2243 "new_origin", new_origin.ToString());
2244 2244
2245 UpdateScreenInfo(window_); 2245 UpdateScreenInfo(window_);
2246 } 2246 }
2247 2247
2248 void RenderWidgetHostViewAura::OnHostCompositorWillBeDestroyed(
2249 const aura::WindowTreeHost* host) {
2250 delegated_frame_host_->ResetCompositor();
2251 }
2252
2248 //////////////////////////////////////////////////////////////////////////////// 2253 ////////////////////////////////////////////////////////////////////////////////
2249 // RenderWidgetHostViewAura, private: 2254 // RenderWidgetHostViewAura, private:
2250 2255
2251 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { 2256 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
2252 if (touch_editing_client_) 2257 if (touch_editing_client_)
2253 touch_editing_client_->OnViewDestroyed(); 2258 touch_editing_client_->OnViewDestroyed();
2254 2259
2255 delegated_frame_host_.reset(); 2260 delegated_frame_host_.reset();
2256 window_observer_.reset(); 2261 window_observer_.reset();
2257 if (window_->GetHost()) 2262 if (window_->GetHost())
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 } 2517 }
2513 2518
2514 #if defined(OS_WIN) 2519 #if defined(OS_WIN)
2515 // The parent may have changed here. Ensure that the legacy window is 2520 // The parent may have changed here. Ensure that the legacy window is
2516 // reparented accordingly. 2521 // reparented accordingly.
2517 if (legacy_render_widget_host_HWND_) 2522 if (legacy_render_widget_host_HWND_)
2518 legacy_render_widget_host_HWND_->UpdateParent( 2523 legacy_render_widget_host_HWND_->UpdateParent(
2519 reinterpret_cast<HWND>(GetNativeViewId())); 2524 reinterpret_cast<HWND>(GetNativeViewId()));
2520 #endif 2525 #endif
2521 2526
2522 delegated_frame_host_->AddedToWindow(); 2527 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor());
2523 } 2528 }
2524 2529
2525 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 2530 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
2526 aura::client::CursorClient* cursor_client = 2531 aura::client::CursorClient* cursor_client =
2527 aura::client::GetCursorClient(window_->GetRootWindow()); 2532 aura::client::GetCursorClient(window_->GetRootWindow());
2528 if (cursor_client) 2533 if (cursor_client)
2529 cursor_client->RemoveObserver(this); 2534 cursor_client->RemoveObserver(this);
2530 2535
2531 DetachFromInputMethod(); 2536 DetachFromInputMethod();
2532 2537
2533 window_->GetHost()->RemoveObserver(this); 2538 window_->GetHost()->RemoveObserver(this);
2534 delegated_frame_host_->RemovingFromWindow(); 2539 delegated_frame_host_->ResetCompositor();
2535 2540
2536 #if defined(OS_WIN) 2541 #if defined(OS_WIN)
2537 // Update the legacy window's parent temporarily to the desktop window. It 2542 // Update the legacy window's parent temporarily to the desktop window. It
2538 // will eventually get reparented to the right root. 2543 // will eventually get reparented to the right root.
2539 if (legacy_render_widget_host_HWND_) 2544 if (legacy_render_widget_host_HWND_)
2540 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); 2545 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
2541 #endif 2546 #endif
2542 } 2547 }
2543 2548
2544 void RenderWidgetHostViewAura::DetachFromInputMethod() { 2549 void RenderWidgetHostViewAura::DetachFromInputMethod() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 host_->ForwardKeyboardEvent(event); 2581 host_->ForwardKeyboardEvent(event);
2577 } 2582 }
2578 2583
2579 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { 2584 SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() {
2580 return kN32_SkColorType; 2585 return kN32_SkColorType;
2581 } 2586 }
2582 2587
2583 //////////////////////////////////////////////////////////////////////////////// 2588 ////////////////////////////////////////////////////////////////////////////////
2584 // DelegatedFrameHost, public: 2589 // DelegatedFrameHost, public:
2585 2590
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() { 2591 ui::Layer* RenderWidgetHostViewAura::GetLayer() {
2592 return window_->layer(); 2592 return window_->layer();
2593 } 2593 }
2594 2594
2595 RenderWidgetHostImpl* RenderWidgetHostViewAura::GetHost() { 2595 RenderWidgetHostImpl* RenderWidgetHostViewAura::GetHost() {
2596 return host_; 2596 return host_;
2597 } 2597 }
2598 2598
2599 bool RenderWidgetHostViewAura::IsVisible() { 2599 bool RenderWidgetHostViewAura::IsVisible() {
2600 return IsShowing(); 2600 return IsShowing();
(...skipping 28 matching lines...) Expand all
2629 2629
2630 //////////////////////////////////////////////////////////////////////////////// 2630 ////////////////////////////////////////////////////////////////////////////////
2631 // RenderWidgetHostViewBase, public: 2631 // RenderWidgetHostViewBase, public:
2632 2632
2633 // static 2633 // static
2634 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2634 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2635 GetScreenInfoForWindow(results, NULL); 2635 GetScreenInfoForWindow(results, NULL);
2636 } 2636 }
2637 2637
2638 } // namespace content 2638 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698