| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/cast_content_window_linux.h" | 5 #include "chromecast/browser/cast_content_window_linux.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "chromecast/base/metrics/cast_metrics_helper.h" | |
| 11 #include "chromecast/browser/cast_browser_process.h" | 10 #include "chromecast/browser/cast_browser_process.h" |
| 12 #include "chromecast/graphics/cast_vsync_settings.h" | 11 #include "chromecast/graphics/cast_vsync_settings.h" |
| 13 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 14 #include "content/public/browser/render_widget_host.h" | 13 #include "content/public/browser/render_widget_host.h" |
| 15 #include "content/public/browser/render_widget_host_view.h" | 14 #include "content/public/browser/render_widget_host_view.h" |
| 16 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 17 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
| 18 #include "ui/display/display.h" | 17 #include "ui/display/display.h" |
| 19 #include "ui/display/screen.h" | 18 #include "ui/display/screen.h" |
| 20 | 19 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Resize window | 136 // Resize window |
| 138 aura::Window* content_window = web_contents->GetNativeView(); | 137 aura::Window* content_window = web_contents->GetNativeView(); |
| 139 content_window->SetBounds( | 138 content_window->SetBounds( |
| 140 gfx::Rect(display_size.width(), display_size.height())); | 139 gfx::Rect(display_size.width(), display_size.height())); |
| 141 #endif | 140 #endif |
| 142 | 141 |
| 143 content::WebContentsObserver::Observe(web_contents); | 142 content::WebContentsObserver::Observe(web_contents); |
| 144 return base::WrapUnique(web_contents); | 143 return base::WrapUnique(web_contents); |
| 145 } | 144 } |
| 146 | 145 |
| 147 void CastContentWindowLinux::DidFirstVisuallyNonEmptyPaint() { | |
| 148 metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint(); | |
| 149 } | |
| 150 | |
| 151 void CastContentWindowLinux::MediaStartedPlaying( | |
| 152 const MediaPlayerInfo& media_info, | |
| 153 const MediaPlayerId& id) { | |
| 154 metrics::CastMetricsHelper::GetInstance()->LogMediaPlay(); | |
| 155 } | |
| 156 | |
| 157 void CastContentWindowLinux::MediaStoppedPlaying( | |
| 158 const MediaPlayerInfo& media_info, | |
| 159 const MediaPlayerId& id) { | |
| 160 metrics::CastMetricsHelper::GetInstance()->LogMediaPause(); | |
| 161 } | |
| 162 | |
| 163 void CastContentWindowLinux::RenderViewCreated( | 146 void CastContentWindowLinux::RenderViewCreated( |
| 164 content::RenderViewHost* render_view_host) { | 147 content::RenderViewHost* render_view_host) { |
| 165 content::RenderWidgetHostView* view = | 148 content::RenderWidgetHostView* view = |
| 166 render_view_host->GetWidget()->GetView(); | 149 render_view_host->GetWidget()->GetView(); |
| 167 if (view) { | 150 if (view) { |
| 168 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT | 151 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT |
| 169 : SK_ColorBLACK); | 152 : SK_ColorBLACK); |
| 170 } | 153 } |
| 171 } | 154 } |
| 172 | 155 |
| 173 void CastContentWindowLinux::OnVSyncIntervalChanged(base::TimeDelta interval) { | 156 void CastContentWindowLinux::OnVSyncIntervalChanged(base::TimeDelta interval) { |
| 174 #if defined(USE_AURA) | 157 #if defined(USE_AURA) |
| 175 window_tree_host_->compositor()->SetAuthoritativeVSyncInterval(interval); | 158 window_tree_host_->compositor()->SetAuthoritativeVSyncInterval(interval); |
| 176 #endif | 159 #endif |
| 177 } | 160 } |
| 178 | 161 |
| 179 } // namespace shell | 162 } // namespace shell |
| 180 } // namespace chromecast | 163 } // namespace chromecast |
| OLD | NEW |