| Index: content/browser/resources/indexed_db/indexeddb_internals.js
|
| diff --git a/content/browser/resources/indexed_db/indexeddb_internals.js b/content/browser/resources/indexed_db/indexeddb_internals.js
|
| index 9bc3b0bd1190ba395ff9452948b1015e6a980316..378b9ad9c5a28ab4dcb1cb7d8a405f3c03cedc33 100644
|
| --- a/content/browser/resources/indexed_db/indexeddb_internals.js
|
| +++ b/content/browser/resources/indexed_db/indexeddb_internals.js
|
| @@ -9,16 +9,50 @@ cr.define('indexeddb', function() {
|
| chrome.send('getAllOrigins');
|
| }
|
|
|
| - function onOriginsReady(origins, path) {
|
| + function progressNodeFor(link) {
|
| + return link.parentNode.querySelector('.download-status');
|
| + }
|
| +
|
| + function downloadOriginData(event) {
|
| + var link = event.target;
|
| + progressNodeFor(link).style.display = 'inline';
|
| + chrome.send('downloadOriginData', [link.idb_partition_path,
|
| + link.idb_origin_url]);
|
| + return false;
|
| + }
|
| +
|
| + // Fired from the backend after the data has been zipped up, and the
|
| + // download manager has begun downloading the file.
|
| + function onOriginDownloadReady(partition_path, origin_url) {
|
| + var downloadLinks = document.querySelectorAll('a.download');
|
| + for (var i = 0; i < downloadLinks.length; ++i) {
|
| + var link = downloadLinks[i];
|
| + if (partition_path == link.idb_partition_path &&
|
| + origin_url == link.idb_origin_url) {
|
| + progressNodeFor(link).style.display = 'none';
|
| + }
|
| + }
|
| + }
|
| +
|
| + // Fired from the backend with a single partition's worth of
|
| + // IndexedDB metadata.
|
| + function onOriginsReady(origins, partition_path) {
|
| var template = jstGetTemplate('indexeddb-list-template');
|
| var container = $('indexeddb-list');
|
| container.appendChild(template);
|
| - jstProcess(new JsEvalContext({ idbs: origins, path: path}), template);
|
| + jstProcess(new JsEvalContext({ idbs: origins,
|
| + partition_path: partition_path}), template);
|
| +
|
| + var downloadLinks = container.querySelectorAll('a.download');
|
| + for (var i = 0; i < downloadLinks.length; ++i) {
|
| + downloadLinks[i].addEventListener('click', downloadOriginData, false);
|
| + }
|
| }
|
|
|
| return {
|
| - initialize: initialize,
|
| - onOriginsReady: onOriginsReady,
|
| + initialize: initialize,
|
| + onOriginDownloadReady: onOriginDownloadReady,
|
| + onOriginsReady: onOriginsReady,
|
| };
|
| });
|
|
|
|
|