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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaInfo.java

Issue 1159113006: [Android] A prototype of the interactive media notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser tests Created 5 years, 6 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/ui/MediaInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..58870c8f5496fd57ea8d588ffb3ac3d49b42cdae
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaInfo.java
@@ -0,0 +1,84 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
mlamouri (slow - plz ping) 2015/06/18 16:43:22 2015
whywhat 2015/06/19 16:00:34 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.media.ui;
+
+import android.text.TextUtils;
+
+/**
+ * Exposes information about the current media to the external clients.
+ */
+public class MediaInfo {
+
+ // Playback state enum.
+ public static final int PLAYING = 0;
+ public static final int PAUSED = 1;
+
+ /**
+ * The title of the media
+ */
+ public String title;
+
+ /**
+ * The current state of the media
+ */
+ public int state;
mlamouri (slow - plz ping) 2015/06/18 16:43:22 Why not a boolean? We could move to an enum later
whywhat 2015/06/19 16:00:34 Done.
+
+ /**
+ * The eTLD+1 of the media
mlamouri (slow - plz ping) 2015/06/18 16:43:22 I believe this is the origin, not eTLD+1. Also, n
whywhat 2015/06/19 16:00:34 Well, the origin doesn't have a simple definition,
mlamouri (slow - plz ping) 2015/06/22 14:34:17 Origin has a fairly simple definition: scheme + su
whywhat 2015/06/23 19:39:10 It doesn't show the default port for https. Just
+ */
+ public String broadDomain;
mlamouri (slow - plz ping) 2015/06/18 16:43:22 Why not call it origin?
whywhat 2015/06/19 16:00:34 See above. Also, the MediaCapture notification use
+
+ /**
+ * The id of the tab containing the media
+ */
+ public int tabId;
+
+ /**
+ * Create a new MediaInfo
+ * @param title
+ * @param state
+ * @param broadDomain
+ * @param tabId
+ */
+ public MediaInfo(
+ String title,
+ int state,
+ String broadDomain,
+ int tabId) {
+ this.title = title;
+ this.state = state;
+ this.broadDomain = broadDomain;
+ this.tabId = tabId;
+ }
+
+ /**
+ * Copy a media info
+ * @param other the source.
+ */
+ public MediaInfo(MediaInfo other) {
+ this(other.title, other.state, other.broadDomain, other.tabId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) return true;
+ if (!(obj instanceof MediaInfo)) return false;
+
+ MediaInfo other = (MediaInfo) obj;
+ return state == other.state
+ && tabId == other.tabId
+ && TextUtils.equals(title, other.title)
+ && TextUtils.equals(broadDomain, other.broadDomain);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = state;
+ result = 31 * result + (title == null ? 0 : title.hashCode());
+ result = 31 * result + (broadDomain == null ? 0 : broadDomain.hashCode());
+ result = 31 * result + tabId;
+ return result;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698