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('offlineProxy', function() { | |
dpapad
2016/06/16 21:31:10
Let's use the same "offlineInternals" namespace be
chili
2016/06/16 22:31:29
Done.
| |
32 /** @interface */ | |
33 function OfflineInternalsBrowserProxy() {} | |
34 | |
35 OfflineInternalsBrowserProxy.prototype = { | |
36 /** | |
37 * Gets current list of stored pages. | |
38 * @return {!Promise} A promise firing when the list is fetched. | |
dpapad
2016/06/16 21:31:10
!Promise<!Array<OfflinePage>>
Can we add more spe
chili
2016/06/16 22:31:29
Done.
| |
39 */ | |
40 onGetStoredPages: function() {}, | |
dpapad
2016/06/16 21:31:10
I don't think the 'on' prefix is appropriate here.
chili
2016/06/16 22:31:29
Done.
| |
41 | |
42 /** | |
43 * Gets current offline queue requests. | |
44 * @return {!Promise} A promise firing when the request queue is fetched. | |
45 */ | |
46 onGetRequestQueue: function() {}, | |
47 | |
48 /** | |
49 * Deletes all the pages in stored pages. | |
50 * @return {!Promise} A promise firing when the pages are deleted. | |
51 */ | |
52 onDeleteAllPages: function() {}, | |
53 | |
54 /** | |
55 * Deletes a set of pages from stored pages | |
56 * @param {!Array<string>} ids A list of page IDs to delete. | |
57 * @return {!Promise} A promise firing when the selected pages are deleted. | |
58 */ | |
59 onDeleteSelectedPages: function(ids) {}, | |
60 }; | |
61 | |
62 /** | |
63 * @constructor | |
64 * @implements {offlineProxy.OfflineInternalsBrowserProxy} | |
65 */ | |
66 function OfflineInternalsBrowserProxyImpl() {} | |
67 cr.addSingletonGetter(OfflineInternalsBrowserProxyImpl); | |
68 | |
69 OfflineInternalsBrowserProxyImpl.prototype = { | |
70 /** @override */ | |
71 onGetStoredPages: function() { | |
72 return cr.sendWithPromise('getStoredPages'); | |
dpapad
2016/06/16 21:31:10
Following up on the previous point about naming, t
chili
2016/06/16 22:31:29
Done.
| |
73 }, | |
74 | |
75 /** @override */ | |
76 onGetRequestQueue: function() { | |
77 return cr.sendWithPromise('getRequestQueue'); | |
78 }, | |
79 | |
80 /** @override */ | |
81 onDeleteAllPages: function() { | |
82 return cr.sendWithPromise('deleteAllPages'); | |
83 }, | |
84 | |
85 /** @override */ | |
86 onDeleteSelectedPages: function(ids) { | |
87 return cr.sendWithPromise('deleteSelectedPages', ids); | |
88 } | |
89 }; | |
90 | |
91 return { | |
92 OfflineInternalsBrowserProxy: OfflineInternalsBrowserProxy, | |
93 OfflineInternalsBrowserProxyImpl: OfflineInternalsBrowserProxyImpl | |
94 }; | |
95 }); | |
OLD | NEW |