OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @typedef {{ | 6 * @typedef {{ |
7 * onlineUrl: string, | 7 * onlineUrl: string, |
8 * creationTime: number, | 8 * creationTime: number, |
9 * id: string, | 9 * id: string, |
10 * namespace: string, | 10 * namespace: string, |
(...skipping 10 matching lines...) Expand all Loading... |
21 * status: string, | 21 * status: string, |
22 * onlineUrl: string, | 22 * onlineUrl: string, |
23 * creationTime: number, | 23 * creationTime: number, |
24 * id: string, | 24 * id: string, |
25 * namespace: string, | 25 * namespace: string, |
26 * lastAttempt: number | 26 * lastAttempt: number |
27 * }} | 27 * }} |
28 */ | 28 */ |
29 var SavePageRequest; | 29 var SavePageRequest; |
30 | 30 |
| 31 /** |
| 32 * @typedef {{ |
| 33 * modelIsLogging: boolean, |
| 34 * queueIsLogging: boolean |
| 35 * }} |
| 36 */ |
| 37 var IsLogging; |
| 38 |
31 cr.define('offlineInternals', function() { | 39 cr.define('offlineInternals', function() { |
32 /** @interface */ | 40 /** @interface */ |
33 function OfflineInternalsBrowserProxy() {} | 41 function OfflineInternalsBrowserProxy() {} |
34 | 42 |
35 OfflineInternalsBrowserProxy.prototype = { | 43 OfflineInternalsBrowserProxy.prototype = { |
36 /** | 44 /** |
37 * Gets current list of stored pages. | 45 * Gets current list of stored pages. |
38 * @return {!Promise<!Array<OfflinePage>>} A promise firing when the | 46 * @return {!Promise<!Array<OfflinePage>>} A promise firing when the |
39 * list is fetched. | 47 * list is fetched. |
40 */ | 48 */ |
(...skipping 12 matching lines...) Expand all Loading... |
53 */ | 61 */ |
54 deleteAllPages: function() {}, | 62 deleteAllPages: function() {}, |
55 | 63 |
56 /** | 64 /** |
57 * Deletes a set of pages from stored pages | 65 * Deletes a set of pages from stored pages |
58 * @param {!Array<string>} ids A list of page IDs to delete. | 66 * @param {!Array<string>} ids A list of page IDs to delete. |
59 * @return {!Promise<!string>} A promise firing when the selected | 67 * @return {!Promise<!string>} A promise firing when the selected |
60 * pages are deleted. | 68 * pages are deleted. |
61 */ | 69 */ |
62 deleteSelectedPages: function(ids) {}, | 70 deleteSelectedPages: function(ids) {}, |
| 71 |
| 72 /** |
| 73 * Sets whether to record logs for stored pages. |
| 74 * @param {boolean} shouldLog True if logging should be enabled. |
| 75 */ |
| 76 setRecordPageModel: function(shouldLog) {}, |
| 77 |
| 78 /** |
| 79 * Sets whether to record logs for scheduled requests. |
| 80 * @param {boolean} shouldLog True if logging should be enabled. |
| 81 */ |
| 82 setRecordRequestQueue: function(shouldLog) {}, |
| 83 |
| 84 /** |
| 85 * Gets the currently recorded logs. |
| 86 * @return {!Promise<!Array<string>>} A promise firing when the |
| 87 * logs are retrieved. |
| 88 */ |
| 89 getEventLogs: function() {}, |
| 90 |
| 91 /** |
| 92 * Gets the state of logging (on/off). |
| 93 * @return {!Promise<!IsLogging>} A promise firing when the state |
| 94 * is retrieved. |
| 95 */ |
| 96 getLoggingState: function() {}, |
63 }; | 97 }; |
64 | 98 |
65 /** | 99 /** |
66 * @constructor | 100 * @constructor |
67 * @implements {offlineInternals.OfflineInternalsBrowserProxy} | 101 * @implements {offlineInternals.OfflineInternalsBrowserProxy} |
68 */ | 102 */ |
69 function OfflineInternalsBrowserProxyImpl() {} | 103 function OfflineInternalsBrowserProxyImpl() {} |
70 cr.addSingletonGetter(OfflineInternalsBrowserProxyImpl); | 104 cr.addSingletonGetter(OfflineInternalsBrowserProxyImpl); |
71 | 105 |
72 OfflineInternalsBrowserProxyImpl.prototype = { | 106 OfflineInternalsBrowserProxyImpl.prototype = { |
73 /** @override */ | 107 /** @override */ |
74 getStoredPages: function() { | 108 getStoredPages: function() { |
75 return cr.sendWithPromise('getStoredPages'); | 109 return cr.sendWithPromise('getStoredPages'); |
76 }, | 110 }, |
77 | 111 |
78 /** @override */ | 112 /** @override */ |
79 getRequestQueue: function() { | 113 getRequestQueue: function() { |
80 return cr.sendWithPromise('getRequestQueue'); | 114 return cr.sendWithPromise('getRequestQueue'); |
81 }, | 115 }, |
82 | 116 |
83 /** @override */ | 117 /** @override */ |
84 deleteAllPages: function() { | 118 deleteAllPages: function() { |
85 return cr.sendWithPromise('deleteAllPages'); | 119 return cr.sendWithPromise('deleteAllPages'); |
86 }, | 120 }, |
87 | 121 |
88 /** @override */ | 122 /** @override */ |
89 deleteSelectedPages: function(ids) { | 123 deleteSelectedPages: function(ids) { |
90 return cr.sendWithPromise('deleteSelectedPages', ids); | 124 return cr.sendWithPromise('deleteSelectedPages', ids); |
| 125 }, |
| 126 |
| 127 /** @override */ |
| 128 setRecordPageModel: function(shouldLog) { |
| 129 chrome.send('setRecordPageModel'); |
| 130 }, |
| 131 |
| 132 /** @override */ |
| 133 setRecordRequestQueue: function(shouldLog) { |
| 134 chrome.send('setRecordRequestQueue'); |
| 135 }, |
| 136 |
| 137 /** @override */ |
| 138 getEventLogs: function() { |
| 139 return cr.sendWithPromise('getEventLogs'); |
| 140 }, |
| 141 |
| 142 /** @override */ |
| 143 getLoggingState: function() { |
| 144 return cr.sendWithPromise('getLoggingState'); |
91 } | 145 } |
92 }; | 146 }; |
93 | 147 |
94 return { | 148 return { |
95 OfflineInternalsBrowserProxy: OfflineInternalsBrowserProxy, | 149 OfflineInternalsBrowserProxy: OfflineInternalsBrowserProxy, |
96 OfflineInternalsBrowserProxyImpl: OfflineInternalsBrowserProxyImpl | 150 OfflineInternalsBrowserProxyImpl: OfflineInternalsBrowserProxyImpl |
97 }; | 151 }; |
98 }); | 152 }); |
OLD | NEW |