OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // require cr.js | 5 // require cr.js |
6 // require cr/event_target.js | 6 // require cr/event_target.js |
7 // require cr/util.js | 7 // require cr/util.js |
8 | 8 |
9 cr.define('chrome.sync', function() { | 9 cr.define('chrome.sync', function() { |
10 'use strict'; | 10 'use strict'; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 /** | 48 /** |
49 * Registers to receive a stream of events through | 49 * Registers to receive a stream of events through |
50 * chrome.sync.dispatchEvent(). | 50 * chrome.sync.dispatchEvent(). |
51 */ | 51 */ |
52 var registerForEvents = function() { | 52 var registerForEvents = function() { |
53 chrome.send('registerForEvents'); | 53 chrome.send('registerForEvents'); |
54 }; | 54 }; |
55 | 55 |
56 /** | 56 /** |
| 57 * Registers to receive a stream of status counter update events |
| 58 * chrome.sync.dispatchEvent(). |
| 59 */ |
| 60 var registerForPerTypeCounters = function() { |
| 61 chrome.send('registerForPerTypeCounters'); |
| 62 } |
| 63 |
| 64 /** |
57 * Asks the browser to refresh our snapshot of sync state. Should result | 65 * Asks the browser to refresh our snapshot of sync state. Should result |
58 * in an onAboutInfoUpdated event being emitted. | 66 * in an onAboutInfoUpdated event being emitted. |
59 */ | 67 */ |
60 var requestUpdatedAboutInfo = function() { | 68 var requestUpdatedAboutInfo = function() { |
61 chrome.send('requestUpdatedAboutInfo'); | 69 chrome.send('requestUpdatedAboutInfo'); |
62 }; | 70 }; |
63 | 71 |
64 /** | 72 /** |
65 * Asks the browser to send us the list of registered types. Should result | 73 * Asks the browser to send us the list of registered types. Should result |
66 * in an onReceivedListOfTypes event being emitted. | 74 * in an onReceivedListOfTypes event being emitted. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 requestCallbacks[id] = undefined; | 112 requestCallbacks[id] = undefined; |
105 }; | 113 }; |
106 | 114 |
107 return { | 115 return { |
108 makeTimer: makeTimer, | 116 makeTimer: makeTimer, |
109 dispatchEvent: dispatchEvent, | 117 dispatchEvent: dispatchEvent, |
110 events: new cr.EventTarget(), | 118 events: new cr.EventTarget(), |
111 getAllNodes: getAllNodes, | 119 getAllNodes: getAllNodes, |
112 getAllNodesCallback: getAllNodesCallback, | 120 getAllNodesCallback: getAllNodesCallback, |
113 registerForEvents: registerForEvents, | 121 registerForEvents: registerForEvents, |
| 122 registerForPerTypeCounters: registerForPerTypeCounters, |
114 requestUpdatedAboutInfo: requestUpdatedAboutInfo, | 123 requestUpdatedAboutInfo: requestUpdatedAboutInfo, |
115 requestListOfTypes: requestListOfTypes, | 124 requestListOfTypes: requestListOfTypes, |
116 }; | 125 }; |
117 }); | 126 }); |
OLD | NEW |