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

Unified Diff: chromecast/browser/cast_content_window_linux.cc

Issue 2570623003: [Chromecast] Turn CastContentWindow into an abstract interface. (Closed)
Patch Set: Set user data outside of contructor Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/browser/cast_content_window_linux.cc
diff --git a/chromecast/browser/cast_content_window.cc b/chromecast/browser/cast_content_window_linux.cc
similarity index 81%
rename from chromecast/browser/cast_content_window.cc
rename to chromecast/browser/cast_content_window_linux.cc
index df1720c85b87ce5ed771df70492612fd9b4e35e3..88640b88e311bb8b1157951b3d92be5a57b97b57 100644
--- a/chromecast/browser/cast_content_window.cc
+++ b/chromecast/browser/cast_content_window_linux.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromecast/browser/cast_content_window.h"
+#include "chromecast/browser/cast_content_window_linux.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -60,10 +60,16 @@ class CastFillLayout : public aura::LayoutManager {
};
#endif
-CastContentWindow::CastContentWindow() : transparent_(false) {
+// static
+std::unique_ptr<CastContentWindow> CastContentWindow::Create(
+ CastContentWindow::Delegate* delegate) {
+ return base::MakeUnique<CastContentWindowLinux>();
}
-CastContentWindow::~CastContentWindow() {
+CastContentWindowLinux::CastContentWindowLinux() : transparent_(false) {
+}
byungchul 2016/12/16 22:52:22 {}
derekjchow1 2016/12/17 00:13:07 Done.
+
+CastContentWindowLinux::~CastContentWindowLinux() {
#if defined(USE_AURA)
CastVSyncSettings::GetInstance()->RemoveObserver(this);
window_tree_host_.reset();
@@ -72,7 +78,13 @@ CastContentWindow::~CastContentWindow() {
#endif
}
-void CastContentWindow::CreateWindowTree(content::WebContents* web_contents) {
+void CastContentWindowLinux::SetTransparent() {
+ DCHECK(!window_tree_host_);
+ transparent_ = true;
+}
+
+void CastContentWindowLinux::ShowWebContents(
+ content::WebContents* web_contents) {
#if defined(USE_AURA)
// Aura initialization
DCHECK(display::Screen::GetScreen());
@@ -108,7 +120,7 @@ void CastContentWindow::CreateWindowTree(content::WebContents* web_contents) {
#endif
}
-std::unique_ptr<content::WebContents> CastContentWindow::CreateWebContents(
+std::unique_ptr<content::WebContents> CastContentWindowLinux::CreateWebContents(
content::BrowserContext* browser_context) {
CHECK(display::Screen::GetScreen());
gfx::Size display_size =
@@ -131,30 +143,33 @@ std::unique_ptr<content::WebContents> CastContentWindow::CreateWebContents(
return base::WrapUnique(web_contents);
}
-void CastContentWindow::DidFirstVisuallyNonEmptyPaint() {
+void CastContentWindowLinux::DidFirstVisuallyNonEmptyPaint() {
metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint();
}
-void CastContentWindow::MediaStoppedPlaying(const MediaPlayerInfo& media_info,
- const MediaPlayerId& id) {
+void CastContentWindowLinux::MediaStoppedPlaying(
+ const MediaPlayerInfo& media_info,
+ const MediaPlayerId& id) {
metrics::CastMetricsHelper::GetInstance()->LogMediaPause();
}
-void CastContentWindow::MediaStartedPlaying(const MediaPlayerInfo& media_info,
- const MediaPlayerId& id) {
+void CastContentWindowLinux::MediaStartedPlaying(
+ const MediaPlayerInfo& media_info,
+ const MediaPlayerId& id) {
metrics::CastMetricsHelper::GetInstance()->LogMediaPlay();
}
-void CastContentWindow::RenderViewCreated(
+void CastContentWindowLinux::RenderViewCreated(
content::RenderViewHost* render_view_host) {
content::RenderWidgetHostView* view =
render_view_host->GetWidget()->GetView();
- if (view)
+ if (view) {
view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT
: SK_ColorBLACK);
+ }
}
-void CastContentWindow::OnVSyncIntervalChanged(base::TimeDelta interval) {
+void CastContentWindowLinux::OnVSyncIntervalChanged(base::TimeDelta interval) {
#if defined(USE_AURA)
window_tree_host_->compositor()->SetAuthoritativeVSyncInterval(
interval);

Powered by Google App Engine
This is Rietveld 408576698