blob: 07f057c117ed1d4d9e900608f7525077f6dfe64f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.db;
import java.util.ArrayList;
import android.os.Parcel;
import android.os.Parcelable;
/**
* A thin representation of a remote client.
* <p>
* We use the hash of the client's GUID as the ID elsewhere.
*/
public class RemoteClient implements Parcelable {
public final String guid;
public final String name;
public final long lastModified;
public final String deviceType;
public final ArrayList<RemoteTab> tabs;
public RemoteClient(String guid, String name, long lastModified, String deviceType) {
this.guid = guid;
this.name = name;
this.lastModified = lastModified;
this.deviceType = deviceType;
this.tabs = new ArrayList<>();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeString(guid);
parcel.writeString(name);
parcel.writeLong(lastModified);
parcel.writeString(deviceType);
parcel.writeTypedList(tabs);
}
public static final Creator<RemoteClient> CREATOR = new Creator<RemoteClient>() {
@Override
public RemoteClient createFromParcel(final Parcel source) {
final String guid = source.readString();
final String name = source.readString();
final long lastModified = source.readLong();
final String deviceType = source.readString();
final RemoteClient client = new RemoteClient(guid, name, lastModified, deviceType);
source.readTypedList(client.tabs, RemoteTab.CREATOR);
return client;
}
@Override
public RemoteClient[] newArray(final int size) {
return new RemoteClient[size];
}
};
public boolean isDesktop() {
return "desktop".equals(deviceType);
}
}
|