Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chrome/browser/resources/sync_file_system_internals/task_log.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 var TaskLog = (function() { 5 var TaskLog = (function() {
6 'use strict'; 6 'use strict';
7 7
8 var nextTaskLogSeq = 1; 8 var nextTaskLogSeq = 1;
9 var TaskLog = {}; 9 var TaskLog = {};
10 10
11 function observeTaskLog() { 11 function observeTaskLog() {
12 chrome.send('observeTaskLog'); 12 chrome.send('observeTaskLog');
13 } 13 }
14 14
15 /** 15 /**
16 * Handles per-task log event. 16 * Handles per-task log event.
17 * @param {Object} taskLog a dictionary containing 'duration', 17 * @param {Object} taskLog a dictionary containing 'duration',
18 * 'task_description', 'result_description' and 'details'. 18 * 'task_description', 'result_description' and 'details'.
19 */ 19 */
20 TaskLog.onTaskLogRecorded = function(taskLog) { 20 TaskLog.onTaskLogRecorded =
21 var details = document.createElement('td'); 21 function(taskLog) {
22 details.classList.add('task-log-details'); 22 var details = document.createElement('td');
23 details.classList.add('task-log-details');
23 24
24 var label = document.createElement('label'); 25 var label = document.createElement('label');
25 details.appendChild(label); 26 details.appendChild(label);
26 27
27 var collapseCheck = document.createElement('input'); 28 var collapseCheck = document.createElement('input');
28 collapseCheck.setAttribute('type', 'checkbox'); 29 collapseCheck.setAttribute('type', 'checkbox');
29 collapseCheck.classList.add('task-log-collapse-check'); 30 collapseCheck.classList.add('task-log-collapse-check');
30 label.appendChild(collapseCheck); 31 label.appendChild(collapseCheck);
31 32
32 var ul = document.createElement('ul'); 33 var ul = document.createElement('ul');
33 for (var i = 0; i < taskLog.details.length; ++i) 34 for (var i = 0; i < taskLog.details.length; ++i)
34 ul.appendChild(createElementFromText('li', taskLog.details[i])); 35 ul.appendChild(createElementFromText('li', taskLog.details[i]));
35 label.appendChild(ul); 36 label.appendChild(ul);
36 37
37 var tr = document.createElement('tr'); 38 var tr = document.createElement('tr');
38 tr.appendChild(createElementFromText( 39 tr.appendChild(createElementFromText(
39 'td', taskLog.duration, {'class': 'task-log-duration'})); 40 'td', taskLog.duration, {'class': 'task-log-duration'}));
40 tr.appendChild(createElementFromText( 41 tr.appendChild(createElementFromText(
41 'td', taskLog.task_description, {'class': 'task-log-description'})); 42 'td', taskLog.task_description, {'class': 'task-log-description'}));
42 tr.appendChild(createElementFromText( 43 tr.appendChild(createElementFromText(
43 'td', taskLog.result_description, {'class': 'task-log-result'})); 44 'td', taskLog.result_description, {'class': 'task-log-result'}));
44 tr.appendChild(details); 45 tr.appendChild(details);
45 46
46 $('task-log-entries').appendChild(tr); 47 $('task-log-entries').appendChild(tr);
47 } 48 }
48 49
49 /** 50 /**
50 * Get initial sync service values and set listeners to get updated values. 51 * Get initial sync service values and set listeners to get updated
51 */ 52 * values.
52 function main() { 53 */
53 observeTaskLog(); 54 function
54 } 55 main() {
56 observeTaskLog();
57 }
55 58
56 document.addEventListener('DOMContentLoaded', main); 59 document.addEventListener('DOMContentLoaded', main);
57 return TaskLog; 60 return TaskLog;
58 })(); 61 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698