1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "content/browser/renderer_host/delegated_frame_host_client_aura.h" 6 7 #include "content/browser/renderer_host/render_widget_host_impl.h" 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 9 #include "ui/aura/window.h" 10 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_tree_host.h" 12 #include "ui/compositor/layer.h" 13 14 namespace content { 15 DelegatedFrameHostClientAura(RenderWidgetHostViewAura * render_widget_host_view)16DelegatedFrameHostClientAura::DelegatedFrameHostClientAura( 17 RenderWidgetHostViewAura* render_widget_host_view) 18 : render_widget_host_view_(render_widget_host_view) {} 19 ~DelegatedFrameHostClientAura()20DelegatedFrameHostClientAura::~DelegatedFrameHostClientAura() {} 21 DelegatedFrameHostGetLayer() const22ui::Layer* DelegatedFrameHostClientAura::DelegatedFrameHostGetLayer() const { 23 return render_widget_host_view_->window()->layer(); 24 } 25 DelegatedFrameHostIsVisible() const26bool DelegatedFrameHostClientAura::DelegatedFrameHostIsVisible() const { 27 return !render_widget_host_view_->host()->is_hidden(); 28 } 29 DelegatedFrameHostGetGutterColor() const30SkColor DelegatedFrameHostClientAura::DelegatedFrameHostGetGutterColor() const { 31 // When making an element on the page fullscreen the element's background 32 // may not match the page's, so use black as the gutter color to avoid 33 // flashes of brighter colors during the transition. 34 if (render_widget_host_view_->host()->delegate() && 35 render_widget_host_view_->host()->delegate()->IsFullscreen()) { 36 return SK_ColorBLACK; 37 } 38 if (render_widget_host_view_->GetBackgroundColor()) 39 return *render_widget_host_view_->GetBackgroundColor(); 40 return SK_ColorWHITE; 41 } 42 OnFrameTokenChanged(uint32_t frame_token)43void DelegatedFrameHostClientAura::OnFrameTokenChanged(uint32_t frame_token) { 44 render_widget_host_view_->OnFrameTokenChangedForView(frame_token); 45 } 46 GetDeviceScaleFactor() const47float DelegatedFrameHostClientAura::GetDeviceScaleFactor() const { 48 return render_widget_host_view_->device_scale_factor_; 49 } 50 InvalidateLocalSurfaceIdOnEviction()51void DelegatedFrameHostClientAura::InvalidateLocalSurfaceIdOnEviction() { 52 render_widget_host_view_->InvalidateLocalSurfaceIdOnEviction(); 53 } 54 55 std::vector<viz::SurfaceId> CollectSurfaceIdsForEviction()56DelegatedFrameHostClientAura::CollectSurfaceIdsForEviction() { 57 return render_widget_host_view_->host()->CollectSurfaceIdsForEviction(); 58 } 59 ShouldShowStaleContentOnEviction()60bool DelegatedFrameHostClientAura::ShouldShowStaleContentOnEviction() { 61 return render_widget_host_view_->ShouldShowStaleContentOnEviction(); 62 } 63 64 } // namespace content 65