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/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
9 #include "chromecast/base/metrics/cast_metrics_helper.h" | 10 #include "chromecast/base/metrics/cast_metrics_helper.h" |
10 #include "chromecast/browser/cast_browser_process.h" | 11 #include "chromecast/browser/cast_browser_process.h" |
11 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/render_widget_host.h" | 13 #include "content/public/browser/render_widget_host.h" |
13 #include "content/public/browser/render_widget_host_view.h" | 14 #include "content/public/browser/render_widget_host_view.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.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) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Add and show content's view/window | 98 // Add and show content's view/window |
98 aura::Window* content_window = web_contents->GetNativeView(); | 99 aura::Window* content_window = web_contents->GetNativeView(); |
99 aura::Window* parent = window_tree_host_->window(); | 100 aura::Window* parent = window_tree_host_->window(); |
100 if (!parent->Contains(content_window)) { | 101 if (!parent->Contains(content_window)) { |
101 parent->AddChild(content_window); | 102 parent->AddChild(content_window); |
102 } | 103 } |
103 content_window->Show(); | 104 content_window->Show(); |
104 #endif | 105 #endif |
105 } | 106 } |
106 | 107 |
107 scoped_ptr<content::WebContents> CastContentWindow::CreateWebContents( | 108 std::unique_ptr<content::WebContents> CastContentWindow::CreateWebContents( |
108 const gfx::Size& initial_size, | 109 const gfx::Size& initial_size, |
109 content::BrowserContext* browser_context) { | 110 content::BrowserContext* browser_context) { |
110 content::WebContents::CreateParams create_params(browser_context, NULL); | 111 content::WebContents::CreateParams create_params(browser_context, NULL); |
111 create_params.routing_id = MSG_ROUTING_NONE; | 112 create_params.routing_id = MSG_ROUTING_NONE; |
112 create_params.initial_size = initial_size; | 113 create_params.initial_size = initial_size; |
113 content::WebContents* web_contents = content::WebContents::Create( | 114 content::WebContents* web_contents = content::WebContents::Create( |
114 create_params); | 115 create_params); |
115 content::WebContentsObserver::Observe(web_contents); | 116 content::WebContentsObserver::Observe(web_contents); |
116 return make_scoped_ptr(web_contents); | 117 return base::WrapUnique(web_contents); |
117 } | 118 } |
118 | 119 |
119 void CastContentWindow::DidFirstVisuallyNonEmptyPaint() { | 120 void CastContentWindow::DidFirstVisuallyNonEmptyPaint() { |
120 metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint(); | 121 metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstPaint(); |
121 } | 122 } |
122 | 123 |
123 void CastContentWindow::MediaStoppedPlaying(const MediaPlayerId& id) { | 124 void CastContentWindow::MediaStoppedPlaying(const MediaPlayerId& id) { |
124 metrics::CastMetricsHelper::GetInstance()->LogMediaPause(); | 125 metrics::CastMetricsHelper::GetInstance()->LogMediaPause(); |
125 } | 126 } |
126 | 127 |
127 void CastContentWindow::MediaStartedPlaying(const MediaPlayerId& id) { | 128 void CastContentWindow::MediaStartedPlaying(const MediaPlayerId& id) { |
128 metrics::CastMetricsHelper::GetInstance()->LogMediaPlay(); | 129 metrics::CastMetricsHelper::GetInstance()->LogMediaPlay(); |
129 } | 130 } |
130 | 131 |
131 void CastContentWindow::RenderViewCreated( | 132 void CastContentWindow::RenderViewCreated( |
132 content::RenderViewHost* render_view_host) { | 133 content::RenderViewHost* render_view_host) { |
133 content::RenderWidgetHostView* view = | 134 content::RenderWidgetHostView* view = |
134 render_view_host->GetWidget()->GetView(); | 135 render_view_host->GetWidget()->GetView(); |
135 if (view) | 136 if (view) |
136 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT | 137 view->SetBackgroundColor(transparent_ ? SK_ColorTRANSPARENT |
137 : SK_ColorBLACK); | 138 : SK_ColorBLACK); |
138 } | 139 } |
139 | 140 |
140 } // namespace shell | 141 } // namespace shell |
141 } // namespace chromecast | 142 } // namespace chromecast |
OLD | NEW |