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

Side by Side Diff: chrome/browser/resources/chromeos/provided_file_systems.js

Issue 301873002: [fsp] Show request logs in chrome://provided-file-systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 6 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 | Annotate | Revision Log
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 <include src="../../../../third_party/polymer/platform/platform.js"> 5 <include src="../../../../third_party/polymer/platform/platform.js">
6 <include src="../../../../third_party/polymer/polymer/polymer.js"> 6 <include src="../../../../third_party/polymer/polymer/polymer.js">
7 7
8 // Define the file-systems element. 8 // Defines the file-systems element.
9 Polymer('file-systems', { 9 Polymer('file-systems', {
10 /**
11 * Called when the element is created.
12 */
10 ready: function() { 13 ready: function() {
11 }, 14 },
12 15
13 /** 16 /**
17 * Selects an active file system from the list.
18 * @param {Event} event Event.
19 * @param {number} detail Detail.
20 * @param {HTMLElement} sender Sender.
21 */
22 rowClicked: function(event, detail, sender) {
23 var requestEventsNode = document.querySelector('#request-events');
24 requestEventsNode.hidden = false;
25 requestEventsNode.model = [];
26
27 console.log(sender.dataset.extensionId, sender.dataset.id);
28 chrome.send('selectFileSystem', [sender.dataset.extensionId,
29 sender.dataset.id]);
30 },
31
32 /**
14 * List of provided file system information maps. 33 * List of provided file system information maps.
15 * @type {Array.<Object>} 34 * @type {Array.<Object>}
16 */ 35 */
17 model: [] 36 model: []
18 }); 37 });
19 38
39 // Defines the request-log element.
40 Polymer('request-events', {
41 /**
42 * Called when the element is created.
43 */
44 ready: function() {
45 },
46
47 /**
48 * Formats time to a hh:mm:ss.xxxx format.
49 * @param {Date} time Input time.
50 * @return {string} Output string in a human-readable format.
51 */
52 formatTime: function(time) {
53 return ('0' + time.getHours()).slice(-2) + ':' +
54 ('0' + time.getMinutes()).slice(-2) + ':' +
55 ('0' + time.getSeconds()).slice(-2) + '.' +
56 ('000' + time.getMilliseconds()).slice(-3);
57 },
58
59 /**
60 * Formats a boolean value to human-readable form.
61 * @param {boolean=} opt_hasMore Input value.
62 * @return {string} Output string in a human-readable format.
63 */
64 formatHasMore: function(opt_hasMore) {
65 if (opt_hasMore == undefined)
66 return '';
67
68 return opt_hasMore ? 'HAS_MORE' : 'LAST';
69 },
70
71 /**
72 * List of events.
73 * @type {Array.<Object>}
74 */
75 model: []
76 });
77
20 /* 78 /*
21 * Updates the mounted file system list. 79 * Updates the mounted file system list.
22 * @param {Object} fileSystems Dictionary containing provided file system 80 * @param {Array.<Object>} fileSystems Array containing provided file system
23 * information. 81 * information.
24 *
25 */ 82 */
26 function updateFileSystems(fileSystems) { 83 function updateFileSystems(fileSystems) {
27 var mountedFileSystems = document.querySelector('#mounted-file-systems'); 84 var fileSystemsNode = document.querySelector('#file-systems');
28 mountedFileSystems.model = fileSystems; 85 fileSystemsNode.model = fileSystems;
29 Platform.performMicrotaskCheckpoint(); 86 }
87
88 /**
89 * Called when a request is created.
90 * @param {Object} event Event.
91 */
92 function onRequestEvent(event) {
93 var requestEventsNode = document.querySelector('#request-events');
94 event.time = new Date(event.time); // Convert to a real Date object.
95 requestEventsNode.model.push(event);
30 } 96 }
31 97
32 document.addEventListener('DOMContentLoaded', function() { 98 document.addEventListener('DOMContentLoaded', function() {
33 chrome.send('updateFileSystems'); 99 chrome.send('updateFileSystems');
34 100
35 // Refresh periodically. 101 // Refresh periodically.
36 setInterval(function() { 102 setInterval(function() {
37 chrome.send('updateFileSystems'); 103 chrome.send('updateFileSystems');
38 }, 1000); 104 }, 1000);
39 }); 105 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698