Chromium Code Reviews| 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.h" | 5 #include "chromecast/browser/cast_content_window.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" | 10 #include "chromecast/base/metrics/cast_metrics_helper.h" |
| 11 #include "chromecast/browser/cast_browser_process.h" | 11 #include "chromecast/browser/cast_browser_process.h" |
| 12 #include "chromecast/chromecast_features.h" | |
| 12 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
| 13 #include "content/public/browser/render_widget_host.h" | 14 #include "content/public/browser/render_widget_host.h" |
| 14 #include "content/public/browser/render_widget_host_view.h" | 15 #include "content/public/browser/render_widget_host_view.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/renderer_preferences.h" | |
| 16 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
| 17 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
| 18 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
| 19 | 21 |
| 20 #if defined(USE_AURA) | 22 #if defined(USE_AURA) |
| 21 #include "chromecast/graphics/cast_screen.h" | 23 #include "chromecast/graphics/cast_screen.h" |
| 22 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
| 23 #include "ui/aura/layout_manager.h" | 25 #include "ui/aura/layout_manager.h" |
| 24 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_tree_host.h" | 27 #include "ui/aura/window_tree_host.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 CHECK(display::Screen::GetScreen()); | 108 CHECK(display::Screen::GetScreen()); |
| 107 gfx::Size display_size = | 109 gfx::Size display_size = |
| 108 display::Screen::GetScreen()->GetPrimaryDisplay().size(); | 110 display::Screen::GetScreen()->GetPrimaryDisplay().size(); |
| 109 | 111 |
| 110 content::WebContents::CreateParams create_params(browser_context, NULL); | 112 content::WebContents::CreateParams create_params(browser_context, NULL); |
| 111 create_params.routing_id = MSG_ROUTING_NONE; | 113 create_params.routing_id = MSG_ROUTING_NONE; |
| 112 create_params.initial_size = display_size; | 114 create_params.initial_size = display_size; |
| 113 content::WebContents* web_contents = content::WebContents::Create( | 115 content::WebContents* web_contents = content::WebContents::Create( |
| 114 create_params); | 116 create_params); |
| 115 content::WebContentsObserver::Observe(web_contents); | 117 content::WebContentsObserver::Observe(web_contents); |
| 118 | |
| 119 #if !BUILDFLAG(DISABLE_DISPLAY) | |
| 120 content::RendererPreferences* prefs = web_contents->GetMutableRendererPrefs(); | |
| 121 prefs->use_video_overlay_for_embedded_encrypted_video = true; | |
|
ddorwin
2016/05/24 22:05:41
This is currently related directly to VIDEO_HOLE (
yucliu1
2016/05/24 22:26:33
I found almost all the logics related to this bool
halliwell
2016/05/24 22:51:02
Yuchen: WMPI = WebMediaPlayerImpl
David, could you
ddorwin
2016/05/24 23:11:50
WMPI will soon be used for all EME content on Andr
| |
| 122 | |
| 123 content::RenderViewHost* host = web_contents->GetRenderViewHost(); | |
| 124 if (host) | |
| 125 host->SyncRendererPrefs(); | |
| 126 #endif // !BUILDFLAG(DISABLE_DISPLAY) | |
| 127 | |
| 116 return base::WrapUnique(web_contents); | 128 return base::WrapUnique(web_contents); |
| 117 } | 129 } |
| 118 | 130 |
| 119 void CastContentWindow::DidFirstVisuallyNonEmptyPaint() { | 131 void CastContentWindow::DidFirstVisuallyNonEmptyPaint() { |
| 120 metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint(); | 132 metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint(); |
| 121 } | 133 } |
| 122 | 134 |
| 123 void CastContentWindow::MediaStoppedPlaying(const MediaPlayerId& id) { | 135 void CastContentWindow::MediaStoppedPlaying(const MediaPlayerId& id) { |
| 124 metrics::CastMetricsHelper::GetInstance()->LogMediaPause(); | 136 metrics::CastMetricsHelper::GetInstance()->LogMediaPause(); |
| 125 } | 137 } |
| 126 | 138 |
| 127 void CastContentWindow::MediaStartedPlaying(const MediaPlayerId& id) { | 139 void CastContentWindow::MediaStartedPlaying(const MediaPlayerId& id) { |
| 128 metrics::CastMetricsHelper::GetInstance()->LogMediaPlay(); | 140 metrics::CastMetricsHelper::GetInstance()->LogMediaPlay(); |
| 129 } | 141 } |
| 130 | 142 |
| 131 void CastContentWindow::RenderViewCreated( | 143 void CastContentWindow::RenderViewCreated( |
| 132 content::RenderViewHost* render_view_host) { | 144 content::RenderViewHost* render_view_host) { |
| 133 content::RenderWidgetHostView* view = | 145 content::RenderWidgetHostView* view = |
| 134 render_view_host->GetWidget()->GetView(); | 146 render_view_host->GetWidget()->GetView(); |
| 135 if (view) | 147 if (view) |
| 136 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT | 148 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT |
| 137 : SK_ColorBLACK); | 149 : SK_ColorBLACK); |
| 138 } | 150 } |
| 139 | 151 |
| 140 } // namespace shell | 152 } // namespace shell |
| 141 } // namespace chromecast | 153 } // namespace chromecast |
| OLD | NEW |