| 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 (function() { | 5 (function() { |
| 6 var dumpToTextButton = $('dump-to-text'); | 6 var dumpToTextButton = $('dump-to-text'); |
| 7 var dataDump = $('data-dump'); | 7 var dataDump = $('data-dump'); |
| 8 dumpToTextButton.addEventListener('click', function(event) { | 8 dumpToTextButton.addEventListener('click', function(event) { |
| 9 // TODO(akalin): Add info like Chrome version, OS, date dumped, etc. | 9 // TODO(akalin): Add info like Chrome version, OS, date dumped, etc. |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 function makeDateUserAgentHeader() { | 119 function makeDateUserAgentHeader() { |
| 120 var now = new Date(); | 120 var now = new Date(); |
| 121 var userAgent = window.navigator.userAgent; | 121 var userAgent = window.navigator.userAgent; |
| 122 var dateUaHeader = [now.toISOString(), userAgent].join(','); | 122 var dateUaHeader = [now.toISOString(), userAgent].join(','); |
| 123 return dateUaHeader; | 123 return dateUaHeader; |
| 124 } | 124 } |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * Builds a summary of current state and exports it as a downloaded file. | 127 * Builds a summary of current state and exports it as a downloaded file. |
| 128 * | 128 * |
| 129 * @param {!Array.<{type: string, nodes: !Array<!Object>}>} nodesMap | 129 * @param {!Array<{type: string, nodes: !Array<!Object>}>} nodesMap |
| 130 * Summary of local state by model type. | 130 * Summary of local state by model type. |
| 131 */ | 131 */ |
| 132 function triggerDataDownload(nodesMap) { | 132 function triggerDataDownload(nodesMap) { |
| 133 // Prepend a header with ISO date and useragent. | 133 // Prepend a header with ISO date and useragent. |
| 134 var output = [makeDateUserAgentHeader()]; | 134 var output = [makeDateUserAgentHeader()]; |
| 135 output.push('====='); | 135 output.push('====='); |
| 136 | 136 |
| 137 var aboutInfo = JSON.stringify(chrome.sync.aboutInfo, null, 2); | 137 var aboutInfo = JSON.stringify(chrome.sync.aboutInfo, null, 2); |
| 138 output.push(aboutInfo); | 138 output.push(aboutInfo); |
| 139 | 139 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 'onReceivedListOfTypes', | 192 'onReceivedListOfTypes', |
| 193 onReceivedListOfTypes); | 193 onReceivedListOfTypes); |
| 194 chrome.sync.requestListOfTypes(); | 194 chrome.sync.requestListOfTypes(); |
| 195 }); | 195 }); |
| 196 | 196 |
| 197 var dumpToFileLink = $('dump-to-file'); | 197 var dumpToFileLink = $('dump-to-file'); |
| 198 dumpToFileLink.addEventListener('click', function(event) { | 198 dumpToFileLink.addEventListener('click', function(event) { |
| 199 chrome.sync.getAllNodes(triggerDataDownload); | 199 chrome.sync.getAllNodes(triggerDataDownload); |
| 200 }); | 200 }); |
| 201 })(); | 201 })(); |
| OLD | NEW |