Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5077)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java

Issue 1652163002: Refactor Clank cast code to use MediaNotificationManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@MediaUi
Patch Set: Respond to final batch of nits Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java
index 0fb775025e683f83372f8f5ff479fe0d8127be24..8ad4cc6b342b6560b2834662d6defc0448fad5eb 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerController.java
@@ -43,8 +43,7 @@ public class RemoteMediaPlayerController implements MediaRouteController.UiListe
private static final String DEFAULT_CASTING_MESSAGE = "Casting to Chromecast";
- private TransportControl mNotificationControl;
- private TransportControl mLockScreenControl;
+ private CastNotificationControl mNotificationControl;
private Context mCastContextApplicationContext;
// The Activity that was in the foreground when the video was cast.
@@ -163,9 +162,6 @@ public class RemoteMediaPlayerController implements MediaRouteController.UiListe
if (mNotificationControl != null) {
mNotificationControl.setRouteController(controller);
}
- if (mLockScreenControl != null) {
- mLockScreenControl.setRouteController(controller);
- }
controller.prepareMediaRoute();
controller.addUiListener(this);
@@ -255,14 +251,12 @@ public class RemoteMediaPlayerController implements MediaRouteController.UiListe
* @param initialState the initial state of the notification
* @param mediaRouteController the mediaRouteController for which these are needed
*/
- public void startNotificationAndLockScreen(PlayerState initialState,
+ public void startNotification(PlayerState initialState,
MediaRouteController mediaRouteController) {
mCurrentRouteController = mediaRouteController;
createNotificationControl();
- getNotification().show(initialState);
- createLockScreen();
- TransportControl lockScreen = getLockScreen();
- if (lockScreen != null) lockScreen.show(initialState);
+ CastNotificationControl notificationControl = getNotificationControl();
+ if (notificationControl != null) notificationControl.show(initialState);
}
/**
@@ -280,48 +274,28 @@ public class RemoteMediaPlayerController implements MediaRouteController.UiListe
mCurrentRouteController = controller;
}
- private TransportControl getNotification() {
+ private CastNotificationControl getNotificationControl() {
return mNotificationControl;
}
- /**
- *
- */
private void createNotificationControl() {
- mNotificationControl = NotificationTransportControl.getOrCreate(
- mChromeVideoActivity.get(), mCurrentRouteController);
- mNotificationControl.setError(null);
- mNotificationControl.setScreenName(mCurrentRouteController.getRouteName());
- mNotificationControl.addListener(mCurrentRouteController);
- }
-
- private TransportControl getLockScreen() {
- return mLockScreenControl;
- }
-
- private void createLockScreen() {
- mLockScreenControl = LockScreenTransportControl.getOrCreate(
+ mNotificationControl = CastNotificationControl.getOrCreate(
mChromeVideoActivity.get(), mCurrentRouteController);
- mLockScreenControl.setError(null);
- mLockScreenControl.setScreenName(mCurrentRouteController.getRouteName());
- mLockScreenControl.addListener(mCurrentRouteController);
- mLockScreenControl.setPosterBitmap(getPoster());
+ mNotificationControl.setPosterBitmap(getPoster());
}
@Override
public void onPrepared(MediaRouteController mediaRouteController) {
- startNotificationAndLockScreen(PlayerState.PLAYING, mediaRouteController);
+ startNotification(PlayerState.PLAYING, mediaRouteController);
}
@Override
public void onPlaybackStateChanged(PlayerState oldState, PlayerState newState) {
if (newState == PlayerState.PLAYING || newState == PlayerState.LOADING
|| newState == PlayerState.PAUSED) {
- TransportControl notificationControl = getNotification();
+ CastNotificationControl notificationControl = getNotificationControl();
if (notificationControl != null) notificationControl.show(newState);
- TransportControl lockScreen = getLockScreen();
- if (lockScreen != null) lockScreen.show(newState);
}
}
@@ -382,9 +356,6 @@ public class RemoteMediaPlayerController implements MediaRouteController.UiListe
if (mNotificationControl != null) {
mNotificationControl.setRouteController(mCurrentRouteController);
}
- if (mLockScreenControl != null) {
- mLockScreenControl.setRouteController(mCurrentRouteController);
- }
}
@VisibleForTesting

Powered by Google App Engine
This is Rietveld 408576698