| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 cr.define('chrome.popular_sites_internals', function() { | 5 cr.define('chrome.popular_sites_internals', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 function initialize() { | 8 function initialize() { |
| 9 function submitDownload(event) { | 9 function submitDownload(event) { |
| 10 $('download-result').textContent = ''; | 10 $('download-result').textContent = ''; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 $('view-json').addEventListener('click', viewJson); | 25 $('view-json').addEventListener('click', viewJson); |
| 26 | 26 |
| 27 chrome.send('registerForEvents'); | 27 chrome.send('registerForEvents'); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function receiveDownloadResult(result) { | 30 function receiveDownloadResult(result) { |
| 31 $('download-result').textContent = result; | 31 $('download-result').textContent = result; |
| 32 } | 32 } |
| 33 | 33 |
| 34 function receiveSites(sites) { | 34 function receiveSites(sites) { |
| 35 jstProcess(new JsEvalContext(sites), $('sites')); | 35 jstProcess(new JsEvalContext(sites), $('info')); |
| 36 // Also clear the json string, since it's likely stale now. | 36 // Also clear the json string, since it's likely stale now. |
| 37 $('json-value').textContent = ''; | 37 $('json-value').textContent = ''; |
| 38 } | 38 } |
| 39 | 39 |
| 40 function receiveJson(json) { | 40 function receiveJson(json) { |
| 41 $('json-value').textContent = json; | 41 $('json-value').textContent = json; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Return an object with all of the exports. | 44 // Return an object with all of the exports. |
| 45 return { | 45 return { |
| 46 initialize: initialize, | 46 initialize: initialize, |
| 47 receiveDownloadResult: receiveDownloadResult, | 47 receiveDownloadResult: receiveDownloadResult, |
| 48 receiveSites: receiveSites, | 48 receiveSites: receiveSites, |
| 49 receiveJson: receiveJson, | 49 receiveJson: receiveJson, |
| 50 }; | 50 }; |
| 51 }); | 51 }); |
| 52 | 52 |
| 53 document.addEventListener('DOMContentLoaded', | 53 document.addEventListener('DOMContentLoaded', |
| 54 chrome.popular_sites_internals.initialize); | 54 chrome.popular_sites_internals.initialize); |
| 55 | 55 |
| OLD | NEW |