| 1 |
[Custom] |
| 2 |
typedef string TabsGuid; |
| 3 |
|
| 4 |
// a local timestamp, a custom type to avoid using the int directly. |
| 5 |
[Custom] |
| 6 |
typedef i64 Timestamp; |
| 7 |
|
| 8 |
[External="sync15"] |
| 9 |
typedef enum DeviceType; |
| 10 |
|
| 11 |
namespace tabs { |
| 12 |
|
| 13 |
}; |
| 14 |
|
| 15 |
[Error] |
| 16 |
interface TabsApiError { |
| 17 |
SyncError(string reason); |
| 18 |
SqlError(string reason); |
| 19 |
UnexpectedTabsError(string reason); |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
interface TabsStore { |
| 24 |
constructor(string path); |
| 25 |
|
| 26 |
void close_connection(); |
| 27 |
|
| 28 |
sequence<ClientRemoteTabs> get_all(); |
| 29 |
|
| 30 |
void set_local_tabs(sequence<RemoteTabRecord> remote_tabs); |
| 31 |
|
| 32 |
[Self=ByArc] |
| 33 |
RemoteCommandStore new_remote_command_store(); |
| 34 |
|
| 35 |
[Self=ByArc] |
| 36 |
void register_with_sync_manager(); |
| 37 |
|
| 38 |
[Self=ByArc] |
| 39 |
TabsBridgedEngine bridged_engine(); |
| 40 |
|
| 41 |
}; |
| 42 |
|
| 43 |
dictionary RemoteTabRecord { |
| 44 |
string title; |
| 45 |
sequence<string> url_history; |
| 46 |
string? icon; |
| 47 |
/// Number of ms since the unix epoch (as reported by the client's clock) |
| 48 |
i64 last_used; |
| 49 |
boolean inactive = false; |
| 50 |
}; |
| 51 |
|
| 52 |
dictionary ClientRemoteTabs { |
| 53 |
string client_id; |
| 54 |
string client_name; |
| 55 |
DeviceType device_type; |
| 56 |
/// Number of ms since the unix epoch (as reported by the server's clock) |
| 57 |
i64 last_modified; |
| 58 |
sequence<RemoteTabRecord> remote_tabs; |
| 59 |
}; |
| 60 |
|
| 61 |
/// A command which should be sent to a remote device. |
| 62 |
[Enum] |
| 63 |
interface RemoteCommand { |
| 64 |
CloseTab(string url); |
| 65 |
// CloseInactive(); ?? |
| 66 |
}; |
| 67 |
|
| 68 |
interface RemoteCommandStore { |
| 69 |
/// Add a new command, after which it will be pending. Returns false if the command is already active. |
| 70 |
[Throws=TabsApiError] |
| 71 |
boolean add_remote_command([ByRef] string device_id, [ByRef] RemoteCommand command); |
| 72 |
|
| 73 |
/// Add a new command with an explicit timestamp. Primarily used by tests. |
| 74 |
[Throws=TabsApiError] |
| 75 |
boolean add_remote_command_at([ByRef] string device_id, [ByRef] RemoteCommand command, Timestamp when); |
| 76 |
|
| 77 |
/// Removes the remote command. Typically used to implement "undo" but may also be used by the queue |
| 78 |
/// processor when it gives up trying to send a command. |
| 79 |
[Throws=TabsApiError] |
| 80 |
boolean remove_remote_command([ByRef] string device_id, [ByRef] RemoteCommand command); |
| 81 |
|
| 82 |
/// Return all unsent commands. This is for the code sending the commands, result is sorted by time_requested. |
| 83 |
[Throws=TabsApiError] |
| 84 |
sequence<PendingCommand> get_unsent_commands(); |
| 85 |
|
| 86 |
/// Flag a command as sent. |
| 87 |
[Throws=TabsApiError] |
| 88 |
boolean set_pending_command_sent([ByRef]PendingCommand command); |
| 89 |
}; |
| 90 |
|
| 91 |
/// Represents a "pending" command. |
| 92 |
dictionary PendingCommand { |
| 93 |
string device_id; |
| 94 |
RemoteCommand command; |
| 95 |
Timestamp time_requested; |
| 96 |
Timestamp? time_sent; |
| 97 |
}; |
| 98 |
|
| 99 |
/// Note the canonical docs for this are in https://searchfox.org/mozilla-central/source/services/interfaces/mozIBridgedSyncEngine.idl |
| 100 |
/// It's only actually used in desktop, but it's fine to expose this everywhere. |
| 101 |
/// NOTE: all timestamps here are milliseconds. |
| 102 |
interface TabsBridgedEngine { |
| 103 |
// readonly attribute long storageVersion; |
| 104 |
// readonly attribute boolean allowSkippedRecord; |
| 105 |
|
| 106 |
// XXX - better logging story than this? |
| 107 |
// attribute mozIServicesLogSink logger; |
| 108 |
|
| 109 |
[Throws=TabsApiError] |
| 110 |
i64 last_sync(); |
| 111 |
|
| 112 |
[Throws=TabsApiError] |
| 113 |
void set_last_sync(i64 last_sync); |
| 114 |
|
| 115 |
[Throws=TabsApiError] |
| 116 |
string? sync_id(); |
| 117 |
|
| 118 |
[Throws=TabsApiError] |
| 119 |
string reset_sync_id(); |
| 120 |
|
| 121 |
[Throws=TabsApiError] |
| 122 |
string ensure_current_sync_id([ByRef]string new_sync_id); |
| 123 |
|
| 124 |
[Throws=TabsApiError] |
| 125 |
void prepare_for_sync([ByRef]string client_data); |
| 126 |
|
| 127 |
[Throws=TabsApiError] |
| 128 |
void sync_started(); |
| 129 |
|
| 130 |
[Throws=TabsApiError] |
| 131 |
void store_incoming(sequence<string> incoming_envelopes_as_json); |
| 132 |
|
| 133 |
[Throws=TabsApiError] |
| 134 |
sequence<string> apply(); |
| 135 |
|
| 136 |
[Throws=TabsApiError] |
| 137 |
void set_uploaded(i64 new_timestamp, sequence<TabsGuid> uploaded_ids); |
| 138 |
|
| 139 |
[Throws=TabsApiError] |
| 140 |
void sync_finished(); |
| 141 |
|
| 142 |
[Throws=TabsApiError] |
| 143 |
void reset(); |
| 144 |
|
| 145 |
[Throws=TabsApiError] |
| 146 |
void wipe(); |
| 147 |
}; |