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

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

Issue 10823039: gdata: Add GCache Contents section to chrome:drive-internals (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add css Created 8 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 * Updates the Authentication Status section. 6 * Updates the Authentication Status section.
7 * @param {Object} auth_status Dictionary containing auth status. 7 * @param {Object} auth_status Dictionary containing auth status.
8 */ 8 */
9 function UpdateAuthStatus(auth_status) { 9 function UpdateAuthStatus(auth_status) {
10 $('has-refresh-token').textContent = auth_status['has-refresh-token']; 10 $('has-refresh-token').textContent = auth_status['has-refresh-token'];
11 $('has-access-token').textContent = auth_status['has-access-token']; 11 $('has-access-token').textContent = auth_status['has-access-token'];
12 } 12 }
13 13
14 /**
15 * Updates the GCache Contents section.
16 * @param {Array} gcache_contents List of dictionaries describing metadata
James Hawkins 2012/07/26 17:50:02 nit: gcacheContents
17 * of files and directories under the GCache directory.
18 */
19 function UpdateGCacheContents(gcache_contents) {
20 var tbody = $('gcache-contents');
21 // Add a header row.
22 var tr = document.createElement('tr');
23 tr.appendChild(createElementFromText('th', 'Path'));
24 tr.appendChild(createElementFromText('th', 'Size'));
25 tr.appendChild(createElementFromText('th', 'Last Modified'));
26 tbody.appendChild(tr);
27
28 for (var i = 0; i < gcache_contents.length; ++i) {
James Hawkins 2012/07/26 17:50:02 nit: i++
satorux1 2012/07/26 19:18:14 Done.
29 var entry = gcache_contents[i];
30 var tr = document.createElement('tr');
31
32 // Add some suffix based on the type.
33 var path = entry.path;
34 if (entry.is_directory)
35 path += '/';
36 else if (entry.is_symbolic_link)
37 path += '@';
38
39 tr.appendChild(createElementFromText('td', path));
40 tr.appendChild(createElementFromText('td', entry.size));
41 tr.appendChild(createElementFromText('td', entry.last_modified));
42 tbody.appendChild(tr);
43 }
44 }
45
46 /**
47 * Creates an element of |elementName| from |text|.
James Hawkins 2012/07/26 17:50:02 nit: s/of/named/
James Hawkins 2012/07/26 17:50:02 nit: s/from/containing the content/
satorux1 2012/07/26 19:18:14 Done.
48 * @param {string} elementName Name of the new element to be created.
49 * @param {string} text Text to be contained in the new element.
50 * @return {HTMLElement} The newly created HTML element.
51 */
52 function createElementFromText(elementName, text) {
53 var element = document.createElement(elementName);
54 element.appendChild(document.createTextNode(text));
55 return element;
56 }
57
14 document.addEventListener('DOMContentLoaded', function() { 58 document.addEventListener('DOMContentLoaded', function() {
15 chrome.send('pageLoaded'); 59 chrome.send('pageLoaded');
16 }); 60 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698