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

Side by Side Diff: content/browser/resources/indexed_db/indexeddb_internals.js

Issue 13949013: Implement download link in chrome://indexeddb-internals/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use FILE_PATH_LITERAL Created 7 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 cr.define('indexeddb', function() { 5 cr.define('indexeddb', function() {
6 'use strict'; 6 'use strict';
7 7
8 function initialize() { 8 function initialize() {
9 chrome.send('getAllOrigins'); 9 chrome.send('getAllOrigins');
10 } 10 }
11 11
12 function onOriginsReady(origins, path) { 12 function progressNodeFor(link) {
13 return link.parentNode.querySelector('.download-status');
14 }
15
16 function downloadOriginData(event) {
17 var link = event.target;
18 progressNodeFor(link).style.display = 'inline';
19 chrome.send('downloadOriginData', [link.idb_partition_path,
20 link.idb_origin_url]);
21 return false;
22 }
23
24 // Fired from the backend after the data has been zipped up, and the
25 // download manager has begun downloading the file.
26 function onOriginDownloadReady(partition_path, origin_url) {
27 var downloadLinks = document.querySelectorAll('a.download');
28 for (var i = 0; i < downloadLinks.length; ++i) {
29 var link = downloadLinks[i];
30 if (partition_path == link.idb_partition_path &&
31 origin_url == link.idb_origin_url) {
32 progressNodeFor(link).style.display = 'none';
33 }
34 }
35 }
36
37 // Fired from the backend with a single partition's worth of
38 // IndexedDB metadata.
39 function onOriginsReady(origins, partition_path) {
13 var template = jstGetTemplate('indexeddb-list-template'); 40 var template = jstGetTemplate('indexeddb-list-template');
14 var container = $('indexeddb-list'); 41 var container = $('indexeddb-list');
15 container.appendChild(template); 42 container.appendChild(template);
16 jstProcess(new JsEvalContext({ idbs: origins, path: path}), template); 43 jstProcess(new JsEvalContext({ idbs: origins,
44 partition_path: partition_path}), template);
45
46 var downloadLinks = container.querySelectorAll('a.download');
47 for (var i = 0; i < downloadLinks.length; ++i) {
48 downloadLinks[i].addEventListener('click', downloadOriginData, false);
49 }
17 } 50 }
18 51
19 return { 52 return {
20 initialize: initialize, 53 initialize: initialize,
21 onOriginsReady: onOriginsReady, 54 onOriginDownloadReady: onOriginDownloadReady,
55 onOriginsReady: onOriginsReady,
22 }; 56 };
23 }); 57 });
24 58
25 document.addEventListener('DOMContentLoaded', indexeddb.initialize); 59 document.addEventListener('DOMContentLoaded', indexeddb.initialize);
OLDNEW
« no previous file with comments | « content/browser/resources/indexed_db/indexeddb_internals.html ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698