Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 // Use chrome.syncedNotificationsPrivate API to be aware of notifications that | |
| 6 // are generated on the server. | |
| 7 [nodoc] namespace syncedNotificationsPrivate { | |
|
not at google - send to devlin
2014/05/02 21:37:38
no need for [nodoc] if you don't add an .html file
dewittj
2014/05/03 00:07:49
Done.
| |
| 8 | |
| 9 // Potential sync change types. | |
| 10 enum ChangeType { | |
| 11 added, | |
| 12 updated, | |
| 13 deleted | |
| 14 }; | |
| 15 | |
| 16 // Whether or not to resync all data items if the data type context changes. | |
| 17 enum RefreshRequest { | |
| 18 refresh_needed, | |
| 19 no_refresh | |
| 20 }; | |
| 21 | |
| 22 enum SyncDataType { | |
| 23 synced_notification, | |
| 24 app_info | |
| 25 }; | |
| 26 | |
| 27 dictionary SyncData { | |
| 28 SyncDataType datatype; | |
| 29 ArrayBuffer dataItem; | |
| 30 }; | |
| 31 | |
| 32 // Datatype that represents a single sync change to a notification or an app inf o. | |
|
not at google - send to devlin
2014/05/02 21:37:38
For whole file: keep IDL line length to 80 chars o
dewittj
2014/05/03 00:07:49
Done.
| |
| 33 dictionary SyncChange { | |
| 34 SyncData data; | |
| 35 ChangeType changeType; | |
| 36 }; | |
| 37 | |
| 38 // Gets an array of SyncChange objects representing the current sync state. | |
| 39 callback GetInitialDataCallback = void (SyncData[] changes); | |
| 40 | |
| 41 interface Functions { | |
| 42 | |
| 43 // Get all data from sync representing the current state (for use at startup). | |
|
not at google - send to devlin
2014/05/02 21:37:38
Gets all data...
dewittj
2014/05/03 00:07:49
Done.
| |
| 44 // This returns both Synced Notifications and AppInfos (with the datatype enum set | |
| 45 // appropriately). | |
| 46 static void getInitialData(GetInitialDataCallback callback); | |
| 47 | |
| 48 // Sending a changed (read state) notification back up to sync. To keep the s ync from | |
|
not at google - send to devlin
2014/05/02 21:37:38
Sends a changed...
dewittj
2014/05/03 00:07:49
Done.
| |
| 49 // needing to understand the protocol, we send the whole object, not just the new read state. | |
| 50 static void updateNotification(ArrayBuffer changedNotification); | |
| 51 | |
| 52 // Setting the Locale and DPI scale factor and list of sending services, encod ed as a binary | |
|
not at google - send to devlin
2014/05/02 21:37:38
Sets the locale...
dewittj
2014/05/03 00:07:49
Done.
| |
| 53 // protobuf. Sync will persist these values for this and future sessions. | |
| 54 static void setRenderContext(RefreshRequest refresh, | |
| 55 ArrayBuffer dataTypeContext); | |
| 56 | |
| 57 }; | |
| 58 | |
| 59 interface Events { | |
| 60 // Called by sync when we get new notifications or app infos from the server. | |
| 61 static void onDataChanges(SyncChange[] changes); | |
| 62 | |
| 63 // Called by sync when sync starts up (in case it starts after the app). This is used in the race | |
| 64 // condition where Sync starts after this chrome app so we still get starting data. | |
| 65 static void onSyncStartup(SyncData[] data); | |
| 66 }; | |
| 67 | |
| 68 }; | |
| 69 | |
| OLD | NEW |