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/browser/media/android/browser_media_player_manager.h" | 5 #include "content/browser/media/android/browser_media_player_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 players_.weak_clear(); | 274 players_.weak_clear(); |
275 } | 275 } |
276 | 276 |
277 void BrowserMediaPlayerManager::DidExitFullscreen(bool release_media_player) { | 277 void BrowserMediaPlayerManager::DidExitFullscreen(bool release_media_player) { |
278 #if defined(USE_AURA) | 278 #if defined(USE_AURA) |
279 // TODO(crbug.com/548024) | 279 // TODO(crbug.com/548024) |
280 NOTIMPLEMENTED(); | 280 NOTIMPLEMENTED(); |
281 #else | 281 #else |
282 if (WebContentsDelegate* delegate = web_contents_->GetDelegate()) | 282 if (WebContentsDelegate* delegate = web_contents_->GetDelegate()) |
283 delegate->ExitFullscreenModeForTab(web_contents_); | 283 delegate->ExitFullscreenModeForTab(web_contents_); |
284 if (RenderWidgetHostViewAndroid* view_android = | |
285 static_cast<RenderWidgetHostViewAndroid*>( | |
286 web_contents_->GetRenderWidgetHostView())) { | |
287 view_android->SetOverlayVideoMode(false); | |
288 } | |
289 | 284 |
290 Send( | 285 Send( |
291 new MediaPlayerMsg_DidExitFullscreen(RoutingID(), fullscreen_player_id_)); | 286 new MediaPlayerMsg_DidExitFullscreen(RoutingID(), fullscreen_player_id_)); |
292 video_view_.reset(); | 287 video_view_.reset(); |
293 MediaPlayerAndroid* player = GetFullscreenPlayer(); | 288 MediaPlayerAndroid* player = GetFullscreenPlayer(); |
294 fullscreen_player_id_ = kInvalidMediaPlayerId; | 289 fullscreen_player_id_ = kInvalidMediaPlayerId; |
295 if (!player) | 290 if (!player) |
296 return; | 291 return; |
297 | 292 |
298 #if defined(VIDEO_HOLE) | 293 #if defined(VIDEO_HOLE) |
(...skipping 25 matching lines...) Expand all Loading... |
324 player->SetVideoSurface(std::move(surface)); | 319 player->SetVideoSurface(std::move(surface)); |
325 if (empty_surface) | 320 if (empty_surface) |
326 return; | 321 return; |
327 | 322 |
328 // If we already know the size, set it now. Otherwise it will be set when the | 323 // If we already know the size, set it now. Otherwise it will be set when the |
329 // player gets it. | 324 // player gets it. |
330 if (player->IsPlayerReady()) { | 325 if (player->IsPlayerReady()) { |
331 video_view_->OnVideoSizeChanged(player->GetVideoWidth(), | 326 video_view_->OnVideoSizeChanged(player->GetVideoWidth(), |
332 player->GetVideoHeight()); | 327 player->GetVideoHeight()); |
333 } | 328 } |
334 | |
335 #if !defined(USE_AURA) | |
336 if (RenderWidgetHostViewAndroid* view_android = | |
337 static_cast<RenderWidgetHostViewAndroid*>( | |
338 web_contents_->GetRenderWidgetHostView())) { | |
339 view_android->SetOverlayVideoMode(true); | |
340 } | |
341 #endif | |
342 } | 329 } |
343 | 330 |
344 void BrowserMediaPlayerManager::OnMediaMetadataChanged( | 331 void BrowserMediaPlayerManager::OnMediaMetadataChanged( |
345 int player_id, base::TimeDelta duration, int width, int height, | 332 int player_id, base::TimeDelta duration, int width, int height, |
346 bool success) { | 333 bool success) { |
347 Send(new MediaPlayerMsg_MediaMetadataChanged( | 334 Send(new MediaPlayerMsg_MediaMetadataChanged( |
348 RoutingID(), player_id, duration, width, height, success)); | 335 RoutingID(), player_id, duration, width, height, success)); |
349 if (fullscreen_player_id_ == player_id) | 336 if (fullscreen_player_id_ == player_id) |
350 video_view_->OnVideoSizeChanged(width, height); | 337 video_view_->OnVideoSizeChanged(width, height); |
351 } | 338 } |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 if (!player) | 782 if (!player) |
796 return; | 783 return; |
797 player->Start(); | 784 player->Start(); |
798 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { | 785 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { |
799 video_view_->OpenVideo(); | 786 video_view_->OpenVideo(); |
800 fullscreen_player_is_released_ = false; | 787 fullscreen_player_is_released_ = false; |
801 } | 788 } |
802 } | 789 } |
803 | 790 |
804 } // namespace content | 791 } // namespace content |
OLD | NEW |