| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 var label = document.createElement('label'); | 157 var label = document.createElement('label'); |
| 158 // Assigning to label.for doesn't work. | 158 // Assigning to label.for doesn't work. |
| 159 label.setAttribute('for', type); | 159 label.setAttribute('for', type); |
| 160 label.innerText = type; | 160 label.innerText = type; |
| 161 div.appendChild(label); | 161 div.appendChild(label); |
| 162 | 162 |
| 163 containerElt.appendChild(div); | 163 containerElt.appendChild(div); |
| 164 }); | 164 }); |
| 165 } | 165 } |
| 166 | 166 |
| 167 function populateDatatypes(childNodeSummaries) { | |
| 168 var types = childNodeSummaries.map(function(n) { | |
| 169 return n.type; | |
| 170 }); | |
| 171 types = types.sort(); | |
| 172 createTypesCheckboxes(types); | |
| 173 } | |
| 174 | |
| 175 document.addEventListener('DOMContentLoaded', function() { | 167 document.addEventListener('DOMContentLoaded', function() { |
| 176 chrome.sync.getRootNodeDetails(function(rootNode) { | 168 chrome.sync.getListOfTypes(function(types) { |
| 177 chrome.sync.getChildNodeIds(rootNode.id, function(childNodeIds) { | 169 types.sort(); |
| 178 chrome.sync.getNodeSummariesById(childNodeIds, populateDatatypes); | 170 createTypesCheckboxes(types); |
| 179 }); | |
| 180 }); | 171 }); |
| 181 }); | 172 }); |
| 182 | 173 |
| 183 var dumpToFileLink = $('dump-to-file'); | 174 var dumpToFileLink = $('dump-to-file'); |
| 184 dumpToFileLink.addEventListener('click', function(event) { | 175 dumpToFileLink.addEventListener('click', function(event) { |
| 185 chrome.sync.getAllNodes(triggerDataDownload); | 176 chrome.sync.getAllNodes(triggerDataDownload); |
| 186 }); | 177 }); |
| 187 })(); | 178 })(); |
| OLD | NEW |