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/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 base::Bind(&WebMediaPlayerAndroid::DidLoadMediaInfo, | 241 base::Bind(&WebMediaPlayerAndroid::DidLoadMediaInfo, |
242 weak_factory_.GetWeakPtr()))); | 242 weak_factory_.GetWeakPtr()))); |
243 // TODO(qinmin): The url might be redirected when android media player | 243 // TODO(qinmin): The url might be redirected when android media player |
244 // requests the stream. As a result, we cannot guarantee there is only | 244 // requests the stream. As a result, we cannot guarantee there is only |
245 // a single origin. Remove the following line when b/12573548 is fixed. | 245 // a single origin. Remove the following line when b/12573548 is fixed. |
246 // Check http://crbug.com/334204. | 246 // Check http://crbug.com/334204. |
247 info_loader_->set_single_origin(false); | 247 info_loader_->set_single_origin(false); |
248 info_loader_->Start(frame_); | 248 info_loader_->Start(frame_); |
249 } | 249 } |
250 | 250 |
251 if (player_manager_->ShouldEnterFullscreen(frame_)) | |
252 player_manager_->EnterFullscreen(player_id_, frame_); | |
253 | |
254 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); | 251 UpdateNetworkState(WebMediaPlayer::NetworkStateLoading); |
255 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); | 252 UpdateReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
256 } | 253 } |
257 | 254 |
258 void WebMediaPlayerAndroid::DidLoadMediaInfo(MediaInfoLoader::Status status) { | 255 void WebMediaPlayerAndroid::DidLoadMediaInfo(MediaInfoLoader::Status status) { |
259 DCHECK(!media_source_delegate_); | 256 DCHECK(!media_source_delegate_); |
260 if (status == MediaInfoLoader::kFailed) { | 257 if (status == MediaInfoLoader::kFailed) { |
261 info_loader_.reset(); | 258 info_loader_.reset(); |
262 UpdateNetworkState(WebMediaPlayer::NetworkStateNetworkError); | 259 UpdateNetworkState(WebMediaPlayer::NetworkStateNetworkError); |
263 return; | 260 return; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 "RenderFrameObserver::OnDestruct() gets called when " | 935 "RenderFrameObserver::OnDestruct() gets called when " |
939 "the RenderFrame goes away."; | 936 "the RenderFrame goes away."; |
940 } | 937 } |
941 | 938 |
942 void WebMediaPlayerAndroid::InitializePlayer( | 939 void WebMediaPlayerAndroid::InitializePlayer( |
943 int demuxer_client_id) { | 940 int demuxer_client_id) { |
944 GURL first_party_url = frame_->document().firstPartyForCookies(); | 941 GURL first_party_url = frame_->document().firstPartyForCookies(); |
945 player_manager_->Initialize( | 942 player_manager_->Initialize( |
946 player_type_, player_id_, url_, first_party_url, demuxer_client_id, | 943 player_type_, player_id_, url_, first_party_url, demuxer_client_id, |
947 frame_->document().url()); | 944 frame_->document().url()); |
| 945 if (player_manager_->ShouldEnterFullscreen(frame_)) |
| 946 player_manager_->EnterFullscreen(player_id_, frame_); |
948 } | 947 } |
949 | 948 |
950 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { | 949 void WebMediaPlayerAndroid::Pause(bool is_media_related_action) { |
951 player_manager_->Pause(player_id_, is_media_related_action); | 950 player_manager_->Pause(player_id_, is_media_related_action); |
952 UpdatePlayingState(false); | 951 UpdatePlayingState(false); |
953 } | 952 } |
954 | 953 |
955 void WebMediaPlayerAndroid::DrawRemotePlaybackText( | 954 void WebMediaPlayerAndroid::DrawRemotePlaybackText( |
956 const std::string& remote_playback_message) { | 955 const std::string& remote_playback_message) { |
957 | 956 |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 player_manager_->EnterFullscreen(player_id_, frame_); | 1601 player_manager_->EnterFullscreen(player_id_, frame_); |
1603 SetNeedsEstablishPeer(false); | 1602 SetNeedsEstablishPeer(false); |
1604 } | 1603 } |
1605 } | 1604 } |
1606 | 1605 |
1607 bool WebMediaPlayerAndroid::canEnterFullscreen() const { | 1606 bool WebMediaPlayerAndroid::canEnterFullscreen() const { |
1608 return player_manager_->CanEnterFullscreen(frame_); | 1607 return player_manager_->CanEnterFullscreen(frame_); |
1609 } | 1608 } |
1610 | 1609 |
1611 } // namespace content | 1610 } // namespace content |
OLD | NEW |