Index: chrome/browser/resources/offline_pages/offline_internals.js |
diff --git a/chrome/browser/resources/offline_pages/offline_internals.js b/chrome/browser/resources/offline_pages/offline_internals.js |
index 1f417fd8aa35fcef0af98b4e5fa047c77f80b67c..fc0fcb4a463a50edaa904c5fb6b4c2f1b9556515 100644 |
--- a/chrome/browser/resources/offline_pages/offline_internals.js |
+++ b/chrome/browser/resources/offline_pages/offline_internals.js |
@@ -2,32 +2,6 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-/** |
- * @typedef {{ |
- * onlineUrl: string, |
- * creationTime: number, |
- * id: string, |
- * namespace: string, |
- * size: string, |
- * filePath: string, |
- * lastAccessTime: number, |
- * accessCount: number |
- * }} |
- */ |
-var OfflinePage; |
- |
-/** |
- * @typedef {{ |
- * status: string, |
- * onlineUrl: string, |
- * creationTime: number, |
- * id: string, |
- * namespace: string, |
- * lastAttempt: number |
- * }} |
- */ |
-var SavePageRequest; |
- |
cr.define('offlineInternals', function() { |
'use strict'; |
@@ -37,6 +11,9 @@ cr.define('offlineInternals', function() { |
/** @type {!Array<SavePageRequest>} */ |
var savePageRequests = []; |
+ /** @type {offlineInternals.OfflineInternalsBrowserProxy} */ |
+ var browserProxy_; |
+ |
/** |
* Fill stored pages table. |
* @param {!Array<OfflinePage>} pages An array object representing |
@@ -108,15 +85,15 @@ cr.define('offlineInternals', function() { |
* Refresh all displayed information. |
*/ |
function refreshAll() { |
- cr.sendWithPromise('getStoredPagesInfo').then(fillStoredPages); |
- cr.sendWithPromise('getRequestQueueInfo').then(fillRequestQueue); |
+ browserProxy_.getStoredPages().then(fillStoredPages); |
+ browserProxy_.getRequestQueue().then(fillRequestQueue); |
} |
/** |
* Delete all pages in the offline store. |
*/ |
function deleteAllPages() { |
- cr.sendWithPromise('deleteAllPages').then(pagesDeleted); |
+ browserProxy_.deleteAllPages().then(pagesDeleted); |
} |
/** |
@@ -125,17 +102,7 @@ cr.define('offlineInternals', function() { |
*/ |
function pagesDeleted(status) { |
$('page-actions-info').textContent = status; |
- cr.sendWithPromise('getStoredPagesInfo').then(fillStoredPages); |
- } |
- |
- /** |
- * Helper function to JSON-escape and add quotes around a string. |
- * @param {string} strObj The obj to escape and add quotes around. |
- * @return {string} The escaped string. |
- */ |
- function escapeString(strObj) { |
- // CSV single quotes are encoded as "". There can also be commas. |
- return '"' + strObj.replace(/"/g, '""') + '"'; |
+ browserProxy_.getStoredPages().then(fillStoredPages); |
} |
/** |
@@ -165,7 +132,7 @@ cr.define('offlineInternals', function() { |
selectedIds.push(checkboxes[i].value); |
} |
- cr.sendWithPromise('deleteSelectedPages', selectedIds).then(pagesDeleted); |
+ browserProxy_.deleteSelectedPages(selectedIds).then(pagesDeleted); |
} |
function initialize() { |
@@ -173,6 +140,8 @@ cr.define('offlineInternals', function() { |
$('clear-selected').onclick = deleteSelectedPages; |
$('refresh').onclick = refreshAll; |
$('download').onclick = download; |
+ browserProxy_ = |
+ offlineInternals.OfflineInternalsBrowserProxyImpl.getInstance(); |
refreshAll(); |
} |