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