Chromium Code Reviews| Index: chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js |
| diff --git a/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js b/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a8f5352af9f34c94f1d57d47550cf4445aba8951 |
| --- /dev/null |
| +++ b/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js |
| @@ -0,0 +1,98 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// 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() { |
| + /** @interface */ |
| + function OfflineInternalsBrowserProxy() {} |
| + |
| + OfflineInternalsBrowserProxy.prototype = { |
| + /** |
| + * Gets current list of stored pages. |
| + * @return {!Promise<Array<OfflinePage>>} A promise firing when the |
|
dpapad
2016/06/16 23:58:27
Is the returned array ever null? If not, !Array<Of
chili
2016/06/17 00:10:40
Done.
|
| + * list is fetched. |
| + */ |
| + getStoredPages: function() {}, |
| + |
| + /** |
| + * Gets current offline queue requests. |
| + * @return {!Promise<Array<SavePageRequest>>} A promise firing when the |
| + * request queue is fetched. |
| + */ |
| + getRequestQueue: function() {}, |
| + |
| + /** |
| + * Deletes all the pages in stored pages. |
| + * @return {!Promise<string>} A promise firing when the pages are deleted. |
| + */ |
| + deleteAllPages: function() {}, |
| + |
| + /** |
| + * Deletes a set of pages from stored pages |
| + * @param {!Array<string>} ids A list of page IDs to delete. |
| + * @return {!Promise<string>} A promise firing when the selected |
| + * pages are deleted. |
| + */ |
| + deleteSelectedPages: function(ids) {}, |
| + }; |
| + |
| + /** |
| + * @constructor |
| + * @implements {offlineProxy.OfflineInternalsBrowserProxy} |
|
dpapad
2016/06/16 23:58:27
Is this code being compiled? offlineProxy namespac
chili
2016/06/17 00:10:40
Done.
|
| + */ |
| + function OfflineInternalsBrowserProxyImpl() {} |
| + cr.addSingletonGetter(OfflineInternalsBrowserProxyImpl); |
| + |
| + OfflineInternalsBrowserProxyImpl.prototype = { |
| + /** @override */ |
| + getStoredPages: function() { |
| + return cr.sendWithPromise('getStoredPages'); |
| + }, |
| + |
| + /** @override */ |
| + getRequestQueue: function() { |
| + return cr.sendWithPromise('getRequestQueue'); |
| + }, |
| + |
| + /** @override */ |
| + deleteAllPages: function() { |
| + return cr.sendWithPromise('deleteAllPages'); |
| + }, |
| + |
| + /** @override */ |
| + deleteSelectedPages: function(ids) { |
| + return cr.sendWithPromise('deleteSelectedPages', ids); |
| + } |
| + }; |
| + |
| + return { |
| + OfflineInternalsBrowserProxy: OfflineInternalsBrowserProxy, |
| + OfflineInternalsBrowserProxyImpl: OfflineInternalsBrowserProxyImpl |
| + }; |
| +}); |