OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var chrome = chrome || {}; | 5 var chrome = chrome || {}; |
6 // TODO(akalin): Add mocking code for e.g. chrome.send() so that we | 6 // TODO(akalin): Add mocking code for e.g. chrome.send() so that we |
7 // can test this without rebuilding chrome. | 7 // can test this without rebuilding chrome. |
8 chrome.sync = chrome.sync || {}; | 8 chrome.sync = chrome.sync || {}; |
9 (function () { | 9 (function () { |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 } | 61 } |
62 } | 62 } |
63 }; | 63 }; |
64 | 64 |
65 chrome.sync.events = { | 65 chrome.sync.events = { |
66 'service': [ | 66 'service': [ |
67 'onServiceStateChanged' | 67 'onServiceStateChanged' |
68 ], | 68 ], |
69 | 69 |
| 70 // See chrome/browser/sync/engine/syncapi.h for docs. |
70 'notifier': [ | 71 'notifier': [ |
71 'onNotificationStateChange', | 72 'onNotificationStateChange', |
72 'onIncomingNotification' | 73 'onIncomingNotification' |
73 ], | 74 ], |
74 | 75 |
75 'manager': [ | 76 'manager': [ |
76 'onChangesApplied', | 77 'onChangesApplied', |
77 'onChangesComplete', | 78 'onChangesComplete', |
78 'onSyncCycleCompleted', | 79 'onSyncCycleCompleted', |
79 'onAuthError', | 80 'onAuthError', |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 callback.apply(null, args); | 128 callback.apply(null, args); |
128 }; | 129 }; |
129 | 130 |
130 return fn; | 131 return fn; |
131 } | 132 } |
132 | 133 |
133 var syncFunctions = [ | 134 var syncFunctions = [ |
134 // Sync service functions. | 135 // Sync service functions. |
135 'getAboutInfo', | 136 'getAboutInfo', |
136 | 137 |
137 // Notification functions. | 138 // Notification functions. See chrome/browser/sync/engine/syncapi.h |
| 139 // for docs. |
138 'getNotificationState', | 140 'getNotificationState', |
139 'getNotificationInfo', | 141 'getNotificationInfo', |
140 | 142 |
141 // Node lookup functions. | 143 // Node lookup functions. See chrome/browser/sync/engine/syncapi.h |
142 'getRootNode', | 144 // for docs. |
143 'getNodesById', | 145 'getRootNodeDetails', |
| 146 'getNodeSummariesById', |
| 147 'getNodeDetailsById', |
144 'getChildNodeIds', | 148 'getChildNodeIds', |
145 'findNodesContainingString' | 149 'findNodesContainingString' |
146 ]; | 150 ]; |
147 | 151 |
148 for (var i = 0; i < syncFunctions.length; ++i) { | 152 for (var i = 0; i < syncFunctions.length; ++i) { |
149 var syncFunction = syncFunctions[i]; | 153 var syncFunction = syncFunctions[i]; |
150 chrome.sync[syncFunction] = makeSyncFunction(syncFunction); | 154 chrome.sync[syncFunction] = makeSyncFunction(syncFunction); |
151 } | 155 } |
152 | 156 |
153 /** | 157 /** |
154 * Returns an object which measures elapsed time. | 158 * Returns an object which measures elapsed time. |
155 */ | 159 */ |
156 chrome.sync.makeTimer = function() { | 160 chrome.sync.makeTimer = function() { |
157 var start = new Date(); | 161 var start = new Date(); |
158 | 162 |
159 return { | 163 return { |
160 /** | 164 /** |
161 * @return {number} The number of seconds since the timer was | 165 * @return {number} The number of seconds since the timer was |
162 * created. | 166 * created. |
163 */ | 167 */ |
164 get elapsedSeconds() { | 168 get elapsedSeconds() { |
165 return ((new Date()).getTime() - start.getTime()) / 1000.0; | 169 return ((new Date()).getTime() - start.getTime()) / 1000.0; |
166 } | 170 } |
167 }; | 171 }; |
168 }; | 172 }; |
169 | 173 |
170 })(); | 174 })(); |
OLD | NEW |