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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 /** | 72 /** |
73 * 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 |
74 * in an onReceivedListOfTypes event being emitted. | 74 * in an onReceivedListOfTypes event being emitted. |
75 */ | 75 */ |
76 var requestListOfTypes = function() { | 76 var requestListOfTypes = function() { |
77 chrome.send('requestListOfTypes'); | 77 chrome.send('requestListOfTypes'); |
78 }; | 78 }; |
79 | 79 |
80 /** | 80 /** |
| 81 * Asks the browser if we should show the User Events tab or not. |
| 82 */ |
| 83 var requestUserEventsVisibility = function() { |
| 84 chrome.send('requestUserEventsVisibility'); |
| 85 }; |
| 86 |
| 87 /** |
| 88 * Sends data to construct a user event that should be committed. |
| 89 */ |
| 90 var writeUserEvent = function(eventTimeUsec, navigationId) { |
| 91 chrome.send('writeUserEvent', [eventTimeUsec, navigationId]); |
| 92 }; |
| 93 |
| 94 /** |
81 * Counter to uniquely identify requests while they're in progress. | 95 * Counter to uniquely identify requests while they're in progress. |
82 * Used in the implementation of GetAllNodes. | 96 * Used in the implementation of GetAllNodes. |
83 */ | 97 */ |
84 var requestId = 0; | 98 var requestId = 0; |
85 | 99 |
86 /** | 100 /** |
87 * A map from counter values to asynchronous request callbacks. | 101 * A map from counter values to asynchronous request callbacks. |
88 * Used in the implementation of GetAllNodes. | 102 * Used in the implementation of GetAllNodes. |
89 * @type {{number: !Function}} | 103 * @type {{number: !Function}} |
90 */ | 104 */ |
(...skipping 24 matching lines...) Expand all Loading... |
115 return { | 129 return { |
116 makeTimer: makeTimer, | 130 makeTimer: makeTimer, |
117 dispatchEvent: dispatchEvent, | 131 dispatchEvent: dispatchEvent, |
118 events: new cr.EventTarget(), | 132 events: new cr.EventTarget(), |
119 getAllNodes: getAllNodes, | 133 getAllNodes: getAllNodes, |
120 getAllNodesCallback: getAllNodesCallback, | 134 getAllNodesCallback: getAllNodesCallback, |
121 registerForEvents: registerForEvents, | 135 registerForEvents: registerForEvents, |
122 registerForPerTypeCounters: registerForPerTypeCounters, | 136 registerForPerTypeCounters: registerForPerTypeCounters, |
123 requestUpdatedAboutInfo: requestUpdatedAboutInfo, | 137 requestUpdatedAboutInfo: requestUpdatedAboutInfo, |
124 requestListOfTypes: requestListOfTypes, | 138 requestListOfTypes: requestListOfTypes, |
| 139 requestUserEventsVisibility: requestUserEventsVisibility, |
| 140 writeUserEvent: writeUserEvent, |
125 }; | 141 }; |
126 }); | 142 }); |
OLD | NEW |