| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } | 558 } |
| 559 | 559 |
| 560 if (ContentVideoView::GetInstance()) { | 560 if (ContentVideoView::GetInstance()) { |
| 561 // In Android WebView, two ContentViewCores could both try to enter | 561 // In Android WebView, two ContentViewCores could both try to enter |
| 562 // fullscreen video, we just ignore the second one. | 562 // fullscreen video, we just ignore the second one. |
| 563 Send(new MediaPlayerMsg_DidExitFullscreen(RoutingID(), player_id)); | 563 Send(new MediaPlayerMsg_DidExitFullscreen(RoutingID(), player_id)); |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 | 566 |
| 567 // There's no ContentVideoView instance so create one. | 567 // There's no ContentVideoView instance so create one. |
| 568 video_view_.reset(new ContentVideoView(this, GetContentViewCore())); | 568 // If we know the video frame size, use it. |
| 569 gfx::Size natural_video_size; |
| 570 MediaPlayerAndroid* player = GetFullscreenPlayer(); |
| 571 if (player && player->IsPlayerReady()) { |
| 572 natural_video_size = |
| 573 gfx::Size(player->GetVideoWidth(), player->GetVideoHeight()); |
| 574 } |
| 575 |
| 576 video_view_.reset( |
| 577 new ContentVideoView(this, GetContentViewCore(), natural_video_size)); |
| 578 |
| 569 base::android::ScopedJavaLocalRef<jobject> j_content_video_view = | 579 base::android::ScopedJavaLocalRef<jobject> j_content_video_view = |
| 570 video_view_->GetJavaObject(base::android::AttachCurrentThread()); | 580 video_view_->GetJavaObject(base::android::AttachCurrentThread()); |
| 571 if (!j_content_video_view.is_null()) { | 581 if (!j_content_video_view.is_null()) { |
| 572 fullscreen_player_id_ = player_id; | 582 fullscreen_player_id_ = player_id; |
| 573 } else { | 583 } else { |
| 574 Send(new MediaPlayerMsg_DidExitFullscreen(RoutingID(), player_id)); | 584 Send(new MediaPlayerMsg_DidExitFullscreen(RoutingID(), player_id)); |
| 575 video_view_.reset(); | 585 video_view_.reset(); |
| 576 } | 586 } |
| 577 #endif // defined(USE_AURA) | 587 #endif // defined(USE_AURA) |
| 578 } | 588 } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 if (!player) | 807 if (!player) |
| 798 return; | 808 return; |
| 799 player->Start(); | 809 player->Start(); |
| 800 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { | 810 if (fullscreen_player_id_ == player_id && fullscreen_player_is_released_) { |
| 801 video_view_->OpenVideo(); | 811 video_view_->OpenVideo(); |
| 802 fullscreen_player_is_released_ = false; | 812 fullscreen_player_is_released_ = false; |
| 803 } | 813 } |
| 804 } | 814 } |
| 805 | 815 |
| 806 } // namespace content | 816 } // namespace content |
| OLD | NEW |