Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..19fe86a222da40ee9aa6145df4a27ae477a128db |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java |
| @@ -0,0 +1,90 @@ |
| +// Copyright 2013 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.remote; |
| + |
| +import android.text.TextUtils; |
| + |
| +/** |
| + * Exposes information about the current video to the external clients. |
| + * |
| + * @author vytautas@google.com (Vytautas Vaitukaitis) |
| + * @author johnme@google.com (John Mellor) |
| + */ |
| +public class RemoteVideoInfo { |
| + |
| + /** |
| + * This lists all the states that the remote video can be in. |
| + */ |
| + public enum PlayerState { |
| + /** The remote player is currently stopped. */ |
| + STOPPED, |
| + |
| + /** The remote player is buffering this video. */ |
| + LOADING, |
| + |
| + /** The remote player is playing this video. */ |
| + PLAYING, |
| + |
| + /** The remote player is paused. */ |
| + PAUSED, |
| + |
| + /** The remote player is in an error state. */ |
| + ERROR, |
| + |
| + /** The remote player has been replaced by another player (so the current session has |
| + * finished) */ |
| + INVALIDATED, |
| + |
| + /** The remote video has completed playing. */ |
| + FINISHED |
| + } |
| + |
| + public String title; |
| + public int durationMillis; |
| + public PlayerState state; |
| + public int currentTimeMillis; |
| + public String errorMessage; |
| + |
| + public RemoteVideoInfo(String title, int durationMillis, PlayerState state, |
| + int currentTimeMillis, String errorMessage) { |
| + this.title = title; |
| + this.durationMillis = durationMillis; |
| + this.state = state; |
| + this.currentTimeMillis = currentTimeMillis; |
| + this.errorMessage = errorMessage; |
| + } |
| + |
| + public RemoteVideoInfo(RemoteVideoInfo other) { |
| + this(other.title, other.durationMillis, other.state, other.currentTimeMillis, |
| + other.errorMessage); |
| + } |
| + |
| + @Override |
| + public boolean equals(Object obj) { |
| + if (obj == this) { |
|
qinmin
2015/03/20 19:35:46
nit: can remove the {} and move the return stateme
aberent
2015/03/23 17:35:31
Done. Also the next 'if'.
|
| + return true; |
| + } |
| + if (!(obj instanceof RemoteVideoInfo)) { |
| + return false; |
| + } |
| + |
| + RemoteVideoInfo other = (RemoteVideoInfo) obj; |
| + return durationMillis == other.durationMillis |
| + && currentTimeMillis == other.currentTimeMillis |
| + && state == other.state |
| + && TextUtils.equals(title, other.title) |
| + && TextUtils.equals(errorMessage, other.errorMessage); |
| + } |
| + |
| + @Override |
| + public int hashCode() { |
| + int result = durationMillis; |
| + result = 31 * result + currentTimeMillis; |
| + result = 31 * result + (title == null ? 0 : title.hashCode()); |
| + result = 31 * result + (state == null ? 0 : state.hashCode()); |
| + result = 31 * result + (errorMessage == null ? 0 : errorMessage.hashCode()); |
| + return result; |
| + } |
| +} |