summaryrefslogtreecommitdiffstats
path: root/third_party/rust/tabs/src/tabs.udl
blob: c251faeef7c6da0701cc049d59fd6eaa94f2b0d7 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
[Custom]
typedef string TabsGuid;

[External="sync15"]
typedef extern DeviceType;

namespace tabs {

};

[Error]
interface TabsApiError {
    SyncError(string reason);
    SqlError(string reason);
    UnexpectedTabsError(string reason);
};


interface TabsStore {
    constructor(string path);

    sequence<ClientRemoteTabs> get_all();

    void set_local_tabs(sequence<RemoteTabRecord> remote_tabs);

    [Self=ByArc]
    void register_with_sync_manager();

    [Self=ByArc]
    TabsBridgedEngine bridged_engine();

};

dictionary RemoteTabRecord {
    string title;
    sequence<string> url_history;
    string? icon;
    // Number of ms since the unix epoch (as reported by the client's clock)
    i64 last_used;
    boolean inactive = false;
};

dictionary ClientRemoteTabs {
    string client_id;
    string client_name;
    DeviceType device_type;
    // Number of ms since the unix epoch (as reported by the server's clock)
    i64 last_modified;
    sequence<RemoteTabRecord> remote_tabs;
};

// Note the canonical docs for this are in https://searchfox.org/mozilla-central/source/services/interfaces/mozIBridgedSyncEngine.idl
// It's only actually used in desktop, but it's fine to expose this everywhere.
// NOTE: all timestamps here are milliseconds.
interface TabsBridgedEngine {
    //readonly attribute long storageVersion;
    // readonly attribute boolean allowSkippedRecord;

    // XXX - better logging story than this?
    // attribute mozIServicesLogSink logger;

    [Throws=TabsApiError]
    i64 last_sync();

    [Throws=TabsApiError]
    void set_last_sync(i64 last_sync);

    [Throws=TabsApiError]
    string? sync_id();

    [Throws=TabsApiError]
    string reset_sync_id();

    [Throws=TabsApiError]
    string ensure_current_sync_id([ByRef]string new_sync_id);

    [Throws=TabsApiError]
    void prepare_for_sync([ByRef]string client_data);

    [Throws=TabsApiError]
    void sync_started();

    [Throws=TabsApiError]
    void store_incoming(sequence<string> incoming_envelopes_as_json);

    [Throws=TabsApiError]
    sequence<string> apply();

    [Throws=TabsApiError]
    void set_uploaded(i64 new_timestamp, sequence<TabsGuid> uploaded_ids);

    [Throws=TabsApiError]
    void sync_finished();

    [Throws=TabsApiError]
    void reset();

    [Throws=TabsApiError]
    void wipe();
};