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 3 // found in the LICENSE file. 4 5 (function() { 6 var trafficToTextButton = document.getElementById('traffic-to-text'); 7 var trafficDump = document.getElementById('traffic-dump'); 8 trafficToTextButton.addEventListener('click', function(event) { 9 chrome.sync.getClientServerTraffic(printData); 10 }); 11 12 function printData(trafficRecord) { 13 var trafficData = ''; 14 trafficData += '===\n'; 15 trafficData += 'Client Server Traffic\n'; 16 trafficData += '===\n'; 17 trafficData += JSON.stringify(trafficRecord, null, 2); 18 trafficData += '\n'; 19 20 trafficDump.textContent = trafficData; 21 } 22 })(); 23