OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.chrome.browser.media.ui; | |
6 | |
7 import android.text.TextUtils; | |
8 | |
9 /** | |
10 * Exposes information about the current media to the external clients. | |
11 */ | |
12 public class MediaInfo { | |
13 | |
14 // Playback state enum. | |
15 public static final int PLAYING = 0; | |
16 public static final int PAUSED = 1; | |
17 | |
18 /** | |
19 * The title of the media | |
20 */ | |
21 public String title; | |
22 | |
23 /** | |
24 * The current state of the media, paused or not. | |
25 */ | |
26 public boolean isPaused; | |
27 | |
28 /** | |
29 * The origin (scheme + host) of the tab containing the media | |
mlamouri (slow - plz ping)
2015/06/22 14:34:17
Does it include the port? If not, just say "origin
whywhat
2015/06/23 19:39:10
It doesn't if the port is the default. Should just
| |
30 */ | |
31 public String origin; | |
32 | |
33 /** | |
34 * The id of the tab containing the media | |
35 */ | |
36 public int tabId; | |
37 | |
38 /** | |
39 * Create a new MediaInfo | |
40 * @param title | |
41 * @param state | |
42 * @param origin | |
43 * @param tabId | |
44 */ | |
45 public MediaInfo( | |
46 String title, | |
47 boolean isPaused, | |
48 String origin, | |
49 int tabId) { | |
50 this.title = title; | |
51 this.isPaused = isPaused; | |
52 this.origin = origin; | |
53 this.tabId = tabId; | |
54 } | |
55 | |
56 /** | |
57 * Copy a media info | |
58 * @param other the source. | |
59 */ | |
60 public MediaInfo(MediaInfo other) { | |
61 this(other.title, other.isPaused, other.origin, other.tabId); | |
62 } | |
63 | |
64 @Override | |
65 public boolean equals(Object obj) { | |
66 if (obj == this) return true; | |
67 if (!(obj instanceof MediaInfo)) return false; | |
68 | |
69 MediaInfo other = (MediaInfo) obj; | |
70 return isPaused == other.isPaused | |
71 && tabId == other.tabId | |
72 && TextUtils.equals(title, other.title) | |
73 && TextUtils.equals(origin, other.origin); | |
74 } | |
75 | |
76 @Override | |
77 public int hashCode() { | |
78 int result = isPaused ? 1 : 0; | |
79 result = 31 * result + (title == null ? 0 : title.hashCode()); | |
80 result = 31 * result + (origin == null ? 0 : origin.hashCode()); | |
81 result = 31 * result + tabId; | |
82 return result; | |
83 } | |
84 } | |
OLD | NEW |