Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 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 | |
| 25 */ | |
| 26 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.
| |
| 27 | |
| 28 /** | |
| 29 * 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
| |
| 30 */ | |
| 31 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
| |
| 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 broadDomain | |
| 43 * @param tabId | |
| 44 */ | |
| 45 public MediaInfo( | |
| 46 String title, | |
| 47 int state, | |
| 48 String broadDomain, | |
| 49 int tabId) { | |
| 50 this.title = title; | |
| 51 this.state = state; | |
| 52 this.broadDomain = broadDomain; | |
| 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.state, other.broadDomain, 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 state == other.state | |
| 71 && tabId == other.tabId | |
| 72 && TextUtils.equals(title, other.title) | |
| 73 && TextUtils.equals(broadDomain, other.broadDomain); | |
| 74 } | |
| 75 | |
| 76 @Override | |
| 77 public int hashCode() { | |
| 78 int result = state; | |
| 79 result = 31 * result + (title == null ? 0 : title.hashCode()); | |
| 80 result = 31 * result + (broadDomain == null ? 0 : broadDomain.hashCode() ); | |
| 81 result = 31 * result + tabId; | |
| 82 return result; | |
| 83 } | |
| 84 } | |
| OLD | NEW |