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

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: Fixed Mounir's comments 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..01c53f706a91d47f981f4938d64a8f1abcf3e23c
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaInfo.java
@@ -0,0 +1,79 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// 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 {
+ /**
+ * The title of the media.
+ */
+ public String title;
+
+ /**
+ * The current state of the media, paused or not.
+ */
+ public boolean isPaused;
+
+ /**
+ * The origin of the tab containing the media.
+ */
+ public String origin;
+
+ /**
+ * The id of the tab containing the media.
+ */
+ public int tabId;
+
+ /**
+ * Create a new MediaInfo.
+ * @param title
+ * @param state
+ * @param origin
+ * @param tabId
+ */
+ public MediaInfo(
+ String title,
+ boolean isPaused,
+ String origin,
+ int tabId) {
+ this.title = title;
+ this.isPaused = isPaused;
+ this.origin = origin;
+ this.tabId = tabId;
+ }
+
+ /**
+ * Copy a media info.
+ * @param other the source.
mlamouri (slow - plz ping) 2015/06/24 16:15:02 nit: the source to copy from.
whywhat 2015/06/24 18:36:15 Done.
+ */
+ public MediaInfo(MediaInfo other) {
+ this(other.title, other.isPaused, other.origin, other.tabId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) return true;
+ if (!(obj instanceof MediaInfo)) return false;
+
+ MediaInfo other = (MediaInfo) obj;
+ return isPaused == other.isPaused
+ && tabId == other.tabId
+ && TextUtils.equals(title, other.title)
+ && TextUtils.equals(origin, other.origin);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = isPaused ? 1 : 0;
+ result = 31 * result + (title == null ? 0 : title.hashCode());
+ result = 31 * result + (origin == null ? 0 : origin.hashCode());
+ result = 31 * result + tabId;
+ return result;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698