| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 /** | 5 /** |
| 6 * WebUI to monitor the Sync File System Service. | 6 * WebUI to monitor the Sync File System Service. |
| 7 */ | 7 */ |
| 8 var SyncService = (function() { | 8 var SyncService = (function() { |
| 9 'use strict'; | 9 'use strict'; |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * Handles callback from getNotificationSource. | 36 * Handles callback from getNotificationSource. |
| 37 * @param {string} Notification source as a string. | 37 * @param {string} Notification source as a string. |
| 38 */ | 38 */ |
| 39 SyncService.onGetNotificationSource = function(sourceString) { | 39 SyncService.onGetNotificationSource = function(sourceString) { |
| 40 $('notification-source').textContent = sourceString; | 40 $('notification-source').textContent = sourceString; |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | |
| 44 * Creates an element named |elementName| containing the content |text|. | |
| 45 * @param {string} elementName Name of the new element to be created. | |
| 46 * @param {string} text Text to be contained in the new element. | |
| 47 * @param {Object} opt_attributes Optional attribute dictionary for the element. | |
| 48 * @return {HTMLElement} The newly created HTML element. | |
| 49 */ | |
| 50 function createElementFromText(elementName, text, opt_attributes) { | |
| 51 var element = document.createElement(elementName); | |
| 52 element.appendChild(document.createTextNode(text)); | |
| 53 if (opt_attributes) { | |
| 54 for (var key in opt_attributes) | |
| 55 element.setAttribute(key, opt_attributes[key]); | |
| 56 } | |
| 57 return element; | |
| 58 } | |
| 59 | |
| 60 // Keeps track of the last log event seen so it's not reprinted. | 43 // Keeps track of the last log event seen so it's not reprinted. |
| 61 var lastLogEventId = -1; | 44 var lastLogEventId = -1; |
| 62 | 45 |
| 63 /** | 46 /** |
| 64 * Request debug log. | 47 * Request debug log. |
| 65 */ | 48 */ |
| 66 function getLog() { | 49 function getLog() { |
| 67 chrome.send('getLog', [lastLogEventId]); | 50 chrome.send('getLog', [lastLogEventId]); |
| 68 } | 51 } |
| 69 | 52 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 95 getServiceStatus(); | 78 getServiceStatus(); |
| 96 getNotificationSource(); | 79 getNotificationSource(); |
| 97 | 80 |
| 98 // TODO: Look for a way to push entries to the page when necessary. | 81 // TODO: Look for a way to push entries to the page when necessary. |
| 99 window.setInterval(getLog, 1000); | 82 window.setInterval(getLog, 1000); |
| 100 } | 83 } |
| 101 | 84 |
| 102 document.addEventListener('DOMContentLoaded', main); | 85 document.addEventListener('DOMContentLoaded', main); |
| 103 return SyncService; | 86 return SyncService; |
| 104 })(); | 87 })(); |
| OLD | NEW |