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/threading/thread_restrictions.h" | 7 #include "base/threading/thread_restrictions.h" |
| 8 #include "chromecast/base/metrics/cast_metrics_helper.h" | 8 #include "chromecast/base/metrics/cast_metrics_helper.h" |
| 9 #include "chromecast/browser/cast_browser_process.h" | 9 #include "chromecast/browser/cast_browser_process.h" |
| 10 #include "chromecast/media/base/video_plane_controller.h" | 10 #include "chromecast/media/base/video_plane_controller.h" |
| 11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/browser/render_widget_host.h" | 12 #include "content/public/browser/render_widget_host.h" |
| 13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_contents_source.h" | |
| 15 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
| 16 | 17 |
| 17 #if defined(USE_AURA) | 18 #if defined(USE_AURA) |
| 18 #include "chromecast/graphics/cast_screen.h" | 19 #include "chromecast/graphics/cast_screen.h" |
| 19 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
| 20 #include "ui/aura/layout_manager.h" | 21 #include "ui/aura/layout_manager.h" |
| 21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_tree_host.h" | 23 #include "ui/aura/window_tree_host.h" |
| 23 #endif | 24 #endif |
| 24 | 25 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 } | 108 } |
| 108 | 109 |
| 109 scoped_ptr<content::WebContents> CastContentWindow::CreateWebContents( | 110 scoped_ptr<content::WebContents> CastContentWindow::CreateWebContents( |
| 110 const gfx::Size& initial_size, | 111 const gfx::Size& initial_size, |
| 111 content::BrowserContext* browser_context) { | 112 content::BrowserContext* browser_context) { |
| 112 content::WebContents::CreateParams create_params(browser_context, NULL); | 113 content::WebContents::CreateParams create_params(browser_context, NULL); |
| 113 create_params.routing_id = MSG_ROUTING_NONE; | 114 create_params.routing_id = MSG_ROUTING_NONE; |
| 114 create_params.initial_size = initial_size; | 115 create_params.initial_size = initial_size; |
| 115 content::WebContents* web_contents = content::WebContents::Create( | 116 content::WebContents* web_contents = content::WebContents::Create( |
| 116 create_params); | 117 create_params); |
| 118 WebContentsSource::CreateForWebContentsAndLocation(web_contents, FROM_HERE); | |
|
halliwell
2015/11/11 14:14:31
Think you can revert this file, your crash isn't i
hcarmona
2015/11/11 19:57:58
Done.
| |
| 117 content::WebContentsObserver::Observe(web_contents); | 119 content::WebContentsObserver::Observe(web_contents); |
| 118 return make_scoped_ptr(web_contents); | 120 return make_scoped_ptr(web_contents); |
| 119 } | 121 } |
| 120 | 122 |
| 121 void CastContentWindow::DidFirstVisuallyNonEmptyPaint() { | 123 void CastContentWindow::DidFirstVisuallyNonEmptyPaint() { |
| 122 metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint(); | 124 metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint(); |
| 123 } | 125 } |
| 124 | 126 |
| 125 void CastContentWindow::MediaPaused() { | 127 void CastContentWindow::MediaPaused() { |
| 126 metrics::CastMetricsHelper::GetInstance()->LogMediaPause(); | 128 metrics::CastMetricsHelper::GetInstance()->LogMediaPause(); |
| 127 } | 129 } |
| 128 | 130 |
| 129 void CastContentWindow::MediaStartedPlaying() { | 131 void CastContentWindow::MediaStartedPlaying() { |
| 130 metrics::CastMetricsHelper::GetInstance()->LogMediaPlay(); | 132 metrics::CastMetricsHelper::GetInstance()->LogMediaPlay(); |
| 131 } | 133 } |
| 132 | 134 |
| 133 void CastContentWindow::RenderViewCreated( | 135 void CastContentWindow::RenderViewCreated( |
| 134 content::RenderViewHost* render_view_host) { | 136 content::RenderViewHost* render_view_host) { |
| 135 content::RenderWidgetHostView* view = | 137 content::RenderWidgetHostView* view = |
| 136 render_view_host->GetWidget()->GetView(); | 138 render_view_host->GetWidget()->GetView(); |
| 137 if (view) | 139 if (view) |
| 138 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT | 140 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT |
| 139 : SK_ColorBLACK); | 141 : SK_ColorBLACK); |
| 140 } | 142 } |
| 141 | 143 |
| 142 } // namespace shell | 144 } // namespace shell |
| 143 } // namespace chromecast | 145 } // namespace chromecast |
| OLD | NEW |