Skip to content

Commit

Permalink
Remove DisableFullscreenEncryptedMediaPlayback().
Browse files Browse the repository at this point in the history
The new fullscreen mode supports compositing, which means that the permission request infobar will appear on top of the fullscreen player. Therefore, there's no need to disable the fullscreen playback.

This CL removes all logics related to DisableFullscreenEncryptedMediaPlayback().

BUG=360239

Review URL: https://codereview.chromium.org/236163003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265397 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
xhwang@chromium.org committed Apr 22, 2014
1 parent 7736cf4 commit 298c6e1
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ void ProtectedMediaIdentifierPermissionContext::DecidePermission(
id,
requesting_frame,
callback));
rvh->DisableFullscreenEncryptedMediaPlayback();
break;
default:
NOTREACHED();
Expand Down
58 changes: 4 additions & 54 deletions content/browser/media/android/browser_media_player_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ BrowserMediaPlayerManager::BrowserMediaPlayerManager(
RenderViewHost* render_view_host)
: WebContentsObserver(WebContents::FromRenderViewHost(render_view_host)),
fullscreen_player_id_(-1),
pending_fullscreen_player_id_(-1),
fullscreen_player_is_released_(false),
web_contents_(WebContents::FromRenderViewHost(render_view_host)),
weak_ptr_factory_(this) {
Expand Down Expand Up @@ -355,7 +354,7 @@ void BrowserMediaPlayerManager::DestroyAllMediaPlayers() {
}
}

void BrowserMediaPlayerManager::OnProtectedSurfaceRequested(int player_id) {
void BrowserMediaPlayerManager::RequestFullScreen(int player_id) {
if (fullscreen_player_id_ == player_id)
return;

Expand All @@ -365,20 +364,9 @@ void BrowserMediaPlayerManager::OnProtectedSurfaceRequested(int player_id) {
return;
}

// If the player is pending approval, wait for the approval to happen.
if (cdm_ids_pending_approval_.end() !=
cdm_ids_pending_approval_.find(player_id)) {
pending_fullscreen_player_id_ = player_id;
return;
}

// Send an IPC to the render process to request the video element to enter
// fullscreen. OnEnterFullscreen() will be called later on success.
// This guarantees the fullscreen video will be rendered correctly.
// During the process, DisableFullscreenEncryptedMediaPlayback() may get
// called before or after OnEnterFullscreen(). If it is called before
// OnEnterFullscreen(), the player will not enter fullscreen. And it will
// retry the process once CreateSession() is allowed to proceed.
// TODO(qinmin): make this flag default on android.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableGestureRequirementForMediaFullscreen)) {
Expand Down Expand Up @@ -477,26 +465,8 @@ void BrowserMediaPlayerManager::OnRequestExternalSurface(
}
#endif // defined(VIDEO_HOLE)

void BrowserMediaPlayerManager::DisableFullscreenEncryptedMediaPlayback() {
if (fullscreen_player_id_ == -1)
return;

// If the fullscreen player is not playing back encrypted video, do nothing.
MediaDrmBridge* drm_bridge = GetDrmBridge(fullscreen_player_id_);
if (!drm_bridge)
return;

// Exit fullscreen.
pending_fullscreen_player_id_ = fullscreen_player_id_;
OnExitFullscreen(fullscreen_player_id_);
}

void BrowserMediaPlayerManager::OnEnterFullscreen(int player_id) {
DCHECK_EQ(fullscreen_player_id_, -1);
if (cdm_ids_pending_approval_.find(player_id) !=
cdm_ids_pending_approval_.end()) {
return;
}

#if defined(VIDEO_HOLE)
if (external_video_surface_container_)
Expand Down Expand Up @@ -652,10 +622,6 @@ void BrowserMediaPlayerManager::OnCreateSession(
return;
}

if (cdm_ids_approved_.find(cdm_id) == cdm_ids_approved_.end()) {
cdm_ids_pending_approval_.insert(cdm_id);
}

BrowserContext* context =
web_contents()->GetRenderProcessHost()->GetBrowserContext();

Expand Down Expand Up @@ -826,26 +792,10 @@ void BrowserMediaPlayerManager::CreateSessionIfPermitted(
OnSessionError(cdm_id, session_id, media::MediaKeys::kUnknownError, 0);
return;
}
cdm_ids_pending_approval_.erase(cdm_id);
cdm_ids_approved_.insert(cdm_id);

if (!drm_bridge->CreateSession(
session_id, content_type, &init_data[0], init_data.size())) {
return;
}

// TODO(xhwang): Move the following code to OnSessionReady.

// TODO(qinmin): For prefixed EME implementation, |cdm_id| and player_id are
// identical. This will not be the case for unpredixed EME. See:
// http://crbug.com/338910
if (pending_fullscreen_player_id_ != cdm_id)
return;

pending_fullscreen_player_id_ = -1;
MediaPlayerAndroid* player = GetPlayer(cdm_id);
if (player->IsPlaying())
OnProtectedSurfaceRequested(cdm_id);
// This could fail, in which case a SessionError will be fired.
drm_bridge->CreateSession(
session_id, content_type, &init_data[0], init_data.size());
}

void BrowserMediaPlayerManager::ReleaseFullscreenPlayer(
Expand Down
16 changes: 1 addition & 15 deletions content/browser/media/android/browser_media_player_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class CONTENT_EXPORT BrowserMediaPlayerManager
virtual media::MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE;
virtual media::MediaDrmBridge* GetDrmBridge(int cdm_id) OVERRIDE;
virtual void DestroyAllMediaPlayers() OVERRIDE;
virtual void OnProtectedSurfaceRequested(int player_id) OVERRIDE;
virtual void RequestFullScreen(int player_id) OVERRIDE;
virtual void OnSessionCreated(int cdm_id,
uint32 session_id,
const std::string& web_session_id) OVERRIDE;
Expand All @@ -112,10 +112,6 @@ class CONTENT_EXPORT BrowserMediaPlayerManager
void OnFrameInfoUpdated();
#endif // defined(VIDEO_HOLE)

// Called to disble the current fullscreen playback if the video is encrypted.
// TODO(qinmin): remove this once we have the new fullscreen mode.
void DisableFullscreenEncryptedMediaPlayback();

protected:
// Clients must use Create() or subclass constructor.
explicit BrowserMediaPlayerManager(RenderViewHost* render_view_host);
Expand Down Expand Up @@ -222,13 +218,6 @@ class CONTENT_EXPORT BrowserMediaPlayerManager
// An array of managed media DRM bridges.
ScopedVector<media::MediaDrmBridge> drm_bridges_;

// A set of media keys IDs that are pending approval or approved to access
// device DRM credentials.
// These 2 sets does not cover all the EME videos. If a video only streams
// clear data, it will not be included in either set.
std::set<int> cdm_ids_pending_approval_;
std::set<int> cdm_ids_approved_;

// The fullscreen video view object or NULL if video is not played in
// fullscreen.
scoped_ptr<ContentVideoView> video_view_;
Expand All @@ -240,9 +229,6 @@ class CONTENT_EXPORT BrowserMediaPlayerManager
// Player ID of the fullscreen media player.
int fullscreen_player_id_;

// The player ID pending to enter fullscreen.
int pending_fullscreen_player_id_;

// Whether the fullscreen player has been Release()-d.
bool fullscreen_player_is_released_;

Expand Down
4 changes: 0 additions & 4 deletions content/browser/renderer_host/render_view_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,6 @@ void RenderViewHostImpl::ActivateNearestFindResult(int request_id,
void RenderViewHostImpl::RequestFindMatchRects(int current_version) {
Send(new ViewMsg_FindMatchRects(GetRoutingID(), current_version));
}

void RenderViewHostImpl::DisableFullscreenEncryptedMediaPlayback() {
media_player_manager_->DisableFullscreenEncryptedMediaPlayback();
}
#endif

void RenderViewHostImpl::DragTargetDragEnter(
Expand Down
1 change: 0 additions & 1 deletion content/browser/renderer_host/render_view_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ class CONTENT_EXPORT RenderViewHostImpl
float x,
float y) OVERRIDE;
virtual void RequestFindMatchRects(int current_version) OVERRIDE;
virtual void DisableFullscreenEncryptedMediaPlayback() OVERRIDE;
#endif

void set_delegate(RenderViewHostDelegate* d) {
Expand Down
3 changes: 0 additions & 3 deletions content/public/browser/render_view_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost {

// Asks the renderer to send the rects of the current find matches.
virtual void RequestFindMatchRects(int current_version) = 0;

// Disables fullscreen media playback for encrypted video.
virtual void DisableFullscreenEncryptedMediaPlayback() = 0;
#endif

private:
Expand Down
2 changes: 1 addition & 1 deletion media/base/android/media_player_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MEDIA_EXPORT MediaPlayerManager {
virtual media::MediaDrmBridge* GetDrmBridge(int cdm_id) = 0;

// Called by the player to get a hardware protected surface.
virtual void OnProtectedSurfaceRequested(int player_id) = 0;
virtual void RequestFullScreen(int player_id) = 0;

// The following five methods are related to EME.
// TODO(xhwang): These methods needs to be decoupled from MediaPlayerManager
Expand Down
2 changes: 1 addition & 1 deletion media/base/android/media_source_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void MediaSourcePlayer::Start() {
playing_ = true;

if (IsProtectedSurfaceRequired())
manager()->OnProtectedSurfaceRequested(player_id());
manager()->RequestFullScreen(player_id());

StartInternal();
}
Expand Down
2 changes: 1 addition & 1 deletion media/base/android/media_source_player_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MockMediaPlayerManager : public MediaPlayerManager {
virtual MediaPlayerAndroid* GetPlayer(int player_id) OVERRIDE { return NULL; }
virtual void DestroyAllMediaPlayers() OVERRIDE {}
virtual MediaDrmBridge* GetDrmBridge(int cdm_id) OVERRIDE { return NULL; }
virtual void OnProtectedSurfaceRequested(int player_id) OVERRIDE {}
virtual void RequestFullScreen(int player_id) OVERRIDE {}
virtual void OnSessionCreated(int cdm_id,
uint32 session_id,
const std::string& web_session_id) OVERRIDE {}
Expand Down

0 comments on commit 298c6e1

Please sign in to comment.