Bug 1654657 - part5 : request to become a main controller when controller enters fullscreen. r=chunmin

Rename `NotifyControllerBeingUsedInPictureInPictureMode()` to `RequestUpdateMainController()` and call that method when a controller enters fullscreen.

Differential Revision: https://phabricator.services.mozilla.com/D85517
This commit is contained in:
alwu 2020-08-06 21:37:00 +00:00
Родитель a731020d84
Коммит b57d06ab50
3 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -168,7 +168,7 @@ void MediaControlService::NotifyControllerPlaybackStateChanged(
}
}
void MediaControlService::NotifyControllerBeingUsedInPictureInPictureMode(
void MediaControlService::RequestUpdateMainController(
MediaController* aController) {
MOZ_DIAGNOSTIC_ASSERT(aController);
MOZ_DIAGNOSTIC_ASSERT(

Просмотреть файл

@ -51,10 +51,9 @@ class MediaControlService final : public nsIObserver {
// This method would be called when the controller changes its playback state.
void NotifyControllerPlaybackStateChanged(MediaController* aController);
// This method would be called when the controller starts to being used in the
// picture-in-picture mode.
void NotifyControllerBeingUsedInPictureInPictureMode(
MediaController* aController);
// This method is used to help a media controller become a main controller, if
// it fits the requirement.
void RequestUpdateMainController(MediaController* aController);
// The main controller is the controller which can receive the media control
// key events and would show its metadata to virtual controller interface.

Просмотреть файл

@ -344,7 +344,7 @@ void MediaController::SetIsInPictureInPictureMode(
UpdateActivatedStateIfNeeded();
if (RefPtr<MediaControlService> service = MediaControlService::GetService();
service && mIsInPictureInPictureMode) {
service->NotifyControllerBeingUsedInPictureInPictureMode(this);
service->RequestUpdateMainController(this);
}
UpdateDeactivationTimerIfNeeded();
mPictureInPictureModeChangedEvent.Notify(mIsInPictureInPictureMode);
@ -358,6 +358,10 @@ void MediaController::NotifyMediaFullScreenState(uint64_t aBrowsingContextId,
LOG("%s fullscreen", aIsInFullScreen ? "Entered" : "Left");
mIsInFullScreenMode = aIsInFullScreen;
UpdateActivatedStateIfNeeded();
if (RefPtr<MediaControlService> service = MediaControlService::GetService();
service && mIsInFullScreenMode) {
service->RequestUpdateMainController(this);
}
mFullScreenChangedEvent.Notify(mIsInFullScreenMode);
}