OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/renderer_media_player_manager.h" | 5 #include "content/renderer/media/android/renderer_media_player_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/common/media/media_player_messages_android.h" | 8 #include "content/common/media/media_player_messages_android.h" |
9 #include "content/public/common/renderer_preferences.h" | 9 #include "content/public/common/renderer_preferences.h" |
10 #include "content/renderer/media/android/webmediaplayer_android.h" | 10 #include "content/renderer/media/android/webmediaplayer_android.h" |
11 #include "content/renderer/media/cdm/renderer_cdm_manager.h" | |
12 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
13 #include "media/base/cdm_context.h" | |
14 #include "media/base/media_switches.h" | 12 #include "media/base/media_switches.h" |
15 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
16 | 14 |
17 namespace content { | 15 namespace content { |
18 | 16 |
19 RendererMediaPlayerManager::RendererMediaPlayerManager( | 17 RendererMediaPlayerManager::RendererMediaPlayerManager( |
20 RenderFrame* render_frame) | 18 RenderFrame* render_frame) |
21 : RenderFrameObserver(render_frame), | 19 : RenderFrameObserver(render_frame), |
22 next_media_player_id_(0) { | 20 next_media_player_id_(0) { |
23 } | 21 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 bool routes_available) { | 233 bool routes_available) { |
236 media::RendererMediaPlayerInterface* player = GetMediaPlayer(player_id); | 234 media::RendererMediaPlayerInterface* player = GetMediaPlayer(player_id); |
237 if (player) | 235 if (player) |
238 player->OnRemoteRouteAvailabilityChanged(routes_available); | 236 player->OnRemoteRouteAvailabilityChanged(routes_available); |
239 } | 237 } |
240 | 238 |
241 void RendererMediaPlayerManager::EnterFullscreen(int player_id) { | 239 void RendererMediaPlayerManager::EnterFullscreen(int player_id) { |
242 Send(new MediaPlayerHostMsg_EnterFullscreen(routing_id(), player_id)); | 240 Send(new MediaPlayerHostMsg_EnterFullscreen(routing_id(), player_id)); |
243 } | 241 } |
244 | 242 |
245 void RendererMediaPlayerManager::SetCdm(int player_id, int cdm_id) { | |
246 if (cdm_id == media::CdmContext::kInvalidCdmId) { | |
247 NOTREACHED(); | |
248 return; | |
249 } | |
250 Send(new MediaPlayerHostMsg_SetCdm(routing_id(), player_id, cdm_id)); | |
251 } | |
252 | |
253 int RendererMediaPlayerManager::RegisterMediaPlayer( | 243 int RendererMediaPlayerManager::RegisterMediaPlayer( |
254 media::RendererMediaPlayerInterface* player) { | 244 media::RendererMediaPlayerInterface* player) { |
255 media_players_[next_media_player_id_] = player; | 245 media_players_[next_media_player_id_] = player; |
256 return next_media_player_id_++; | 246 return next_media_player_id_++; |
257 } | 247 } |
258 | 248 |
259 void RendererMediaPlayerManager::UnregisterMediaPlayer(int player_id) { | 249 void RendererMediaPlayerManager::UnregisterMediaPlayer(int player_id) { |
260 media_players_.erase(player_id); | 250 media_players_.erase(player_id); |
261 } | 251 } |
262 | 252 |
263 media::RendererMediaPlayerInterface* RendererMediaPlayerManager::GetMediaPlayer( | 253 media::RendererMediaPlayerInterface* RendererMediaPlayerManager::GetMediaPlayer( |
264 int player_id) { | 254 int player_id) { |
265 std::map<int, media::RendererMediaPlayerInterface*>::iterator iter = | 255 std::map<int, media::RendererMediaPlayerInterface*>::iterator iter = |
266 media_players_.find(player_id); | 256 media_players_.find(player_id); |
267 if (iter != media_players_.end()) | 257 if (iter != media_players_.end()) |
268 return iter->second; | 258 return iter->second; |
269 return NULL; | 259 return NULL; |
270 } | 260 } |
271 | 261 |
272 void RendererMediaPlayerManager::OnDestruct() { | 262 void RendererMediaPlayerManager::OnDestruct() { |
273 delete this; | 263 delete this; |
274 } | 264 } |
275 | 265 |
276 } // namespace content | 266 } // namespace content |
OLD | NEW |