Chromium Code Reviews| 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..86e09e1fbae2932be99ee607776127ea92fc79a9 |
| --- /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 final String title; |
| + |
| + /** |
| + * The current state of the media, paused or not. |
| + */ |
| + public final boolean isPaused; |
| + |
| + /** |
| + * The origin of the tab containing the media. |
| + */ |
| + public final String origin; |
| + |
| + /** |
| + * The id of the tab containing the media. |
| + */ |
| + public final int tabId; |
| + |
| + /** |
| + * Create a new MediaInfo. |
| + * @param title |
| + * @param state |
| + * @param origin |
| + * @param tabId |
| + */ |
| + public MediaInfo( |
| + String title, |
| + boolean isPaused, |
|
Ted C
2015/06/26 00:43:53
these won't all fit on a single line?
whywhat
2015/06/26 19:29:31
Even in 80 characters :D
|
| + String origin, |
| + int tabId) { |
| + this.title = title; |
| + this.isPaused = isPaused; |
| + this.origin = origin; |
| + this.tabId = tabId; |
| + } |
| + |
| + /** |
| + * Copy a media info. |
| + * @param other the source to copy from. |
| + */ |
| + 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; |
| + } |
| +} |