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

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

Issue 2862153002: [Android, Cast] Get the notification origin from the correct tab. (Closed)
Patch Set: Marked mTabOrigin as nullable Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
index 809f55e07621ee96cc642ce9725146f0d84ef75d..e1ac3f173cc9c475038b66002702955ca4598589 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/CastNotificationControl.java
@@ -49,6 +49,14 @@ public class CastNotificationControl implements MediaRouteController.UiListener,
private String mTitle = "";
private AudioManager mAudioManager;
+ /**
+ * Contains the origin of the tab containing the video when it's cast. The origin is formatted
+ * to be presented better from the security POV if the URL is parseable. Otherwise it's just the
+ * URL of the tab if the tab exists. Can be null.
+ */
+ @Nullable
+ private String mTabOrigin;
+
private boolean mIsShowing;
private static final Object LOCK = new Object();
@@ -128,10 +136,6 @@ public class CastNotificationControl implements MediaRouteController.UiListener,
updateNotificationBuilderIfPosterIsGoodEnough();
mState = initialState;
- // Set origin once per the notification so it doesn't change if another tab becomes active.
- String origin = getCurrentTabOrigin();
- if (origin != null) mNotificationBuilder.setOrigin(origin);
-
updateNotification();
mIsShowing = true;
}
@@ -147,6 +151,7 @@ public class CastNotificationControl implements MediaRouteController.UiListener,
if (mNotificationBuilder == null) return;
mNotificationBuilder.setMetadata(new MediaMetadata(mTitle, "", ""));
+ if (mTabOrigin != null) mNotificationBuilder.setOrigin(mTabOrigin);
if (mState == PlayerState.PAUSED || mState == PlayerState.PLAYING) {
mNotificationBuilder.setPaused(mState != PlayerState.PLAYING);
@@ -190,6 +195,9 @@ public class CastNotificationControl implements MediaRouteController.UiListener,
@Override
public void onRouteSelected(String name, MediaRouteController mediaRouteController) {
+ // The notification will be shown/updated later so don't update it in case it's still
+ // showing for the previous video.
+ mTabOrigin = getCurrentTabOrigin();
}
@Override
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698