OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @typedef {{ |
| 7 * onlineUrl: string, |
| 8 * creationTime: number, |
| 9 * id: string, |
| 10 * namespace: string, |
| 11 * size: string, |
| 12 * filePath: string, |
| 13 * lastAccessTime: number, |
| 14 * accessCount: number |
| 15 * }} |
| 16 */ |
| 17 var OfflinePage; |
| 18 |
| 19 /** |
| 20 * @typedef {{ |
| 21 * status: string, |
| 22 * onlineUrl: string, |
| 23 * creationTime: number, |
| 24 * id: string, |
| 25 * namespace: string, |
| 26 * lastAttempt: number |
| 27 * }} |
| 28 */ |
| 29 var SavePageRequest; |
| 30 |
| 31 cr.define('offlineInternals', function() { |
| 32 /** @interface */ |
| 33 function OfflineInternalsBrowserProxy() {} |
| 34 |
| 35 OfflineInternalsBrowserProxy.prototype = { |
| 36 /** |
| 37 * Gets current list of stored pages. |
| 38 * @return {!Promise<!Array<OfflinePage>>} A promise firing when the |
| 39 * list is fetched. |
| 40 */ |
| 41 getStoredPages: function() {}, |
| 42 |
| 43 /** |
| 44 * Gets current offline queue requests. |
| 45 * @return {!Promise<!Array<SavePageRequest>>} A promise firing when the |
| 46 * request queue is fetched. |
| 47 */ |
| 48 getRequestQueue: function() {}, |
| 49 |
| 50 /** |
| 51 * Deletes all the pages in stored pages. |
| 52 * @return {!Promise<!string>} A promise firing when the pages are deleted. |
| 53 */ |
| 54 deleteAllPages: function() {}, |
| 55 |
| 56 /** |
| 57 * Deletes a set of pages from stored pages |
| 58 * @param {!Array<string>} ids A list of page IDs to delete. |
| 59 * @return {!Promise<!string>} A promise firing when the selected |
| 60 * pages are deleted. |
| 61 */ |
| 62 deleteSelectedPages: function(ids) {}, |
| 63 }; |
| 64 |
| 65 /** |
| 66 * @constructor |
| 67 * @implements {offlineInternals.OfflineInternalsBrowserProxy} |
| 68 */ |
| 69 function OfflineInternalsBrowserProxyImpl() {} |
| 70 cr.addSingletonGetter(OfflineInternalsBrowserProxyImpl); |
| 71 |
| 72 OfflineInternalsBrowserProxyImpl.prototype = { |
| 73 /** @override */ |
| 74 getStoredPages: function() { |
| 75 return cr.sendWithPromise('getStoredPages'); |
| 76 }, |
| 77 |
| 78 /** @override */ |
| 79 getRequestQueue: function() { |
| 80 return cr.sendWithPromise('getRequestQueue'); |
| 81 }, |
| 82 |
| 83 /** @override */ |
| 84 deleteAllPages: function() { |
| 85 return cr.sendWithPromise('deleteAllPages'); |
| 86 }, |
| 87 |
| 88 /** @override */ |
| 89 deleteSelectedPages: function(ids) { |
| 90 return cr.sendWithPromise('deleteSelectedPages', ids); |
| 91 } |
| 92 }; |
| 93 |
| 94 return { |
| 95 OfflineInternalsBrowserProxy: OfflineInternalsBrowserProxy, |
| 96 OfflineInternalsBrowserProxyImpl: OfflineInternalsBrowserProxyImpl |
| 97 }; |
| 98 }); |
OLD | NEW |