Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2535)

Unified Diff: chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js

Issue 2069933002: [Offline pages] Extract internals page interaction with browser to a proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@i2
Patch Set: Compiling and working Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6f5993a745ae83da630364a03d5e8173590fac29
--- /dev/null
+++ b/chrome/browser/resources/offline_pages/offline_internals_browser_proxy.js
@@ -0,0 +1,95 @@
+// 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('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.
+ /** @interface */
+ function OfflineInternalsBrowserProxy() {}
+
+ OfflineInternalsBrowserProxy.prototype = {
+ /**
+ * Gets current list of stored pages.
+ * @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.
+ */
+ 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.
+
+ /**
+ * Gets current offline queue requests.
+ * @return {!Promise} A promise firing when the request queue is fetched.
+ */
+ onGetRequestQueue: function() {},
+
+ /**
+ * Deletes all the pages in stored pages.
+ * @return {!Promise} A promise firing when the pages are deleted.
+ */
+ onDeleteAllPages: function() {},
+
+ /**
+ * Deletes a set of pages from stored pages
+ * @param {!Array<string>} ids A list of page IDs to delete.
+ * @return {!Promise} A promise firing when the selected pages are deleted.
+ */
+ onDeleteSelectedPages: function(ids) {},
+ };
+
+ /**
+ * @constructor
+ * @implements {offlineProxy.OfflineInternalsBrowserProxy}
+ */
+ function OfflineInternalsBrowserProxyImpl() {}
+ cr.addSingletonGetter(OfflineInternalsBrowserProxyImpl);
+
+ OfflineInternalsBrowserProxyImpl.prototype = {
+ /** @override */
+ onGetStoredPages: function() {
+ 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.
+ },
+
+ /** @override */
+ onGetRequestQueue: function() {
+ return cr.sendWithPromise('getRequestQueue');
+ },
+
+ /** @override */
+ onDeleteAllPages: function() {
+ return cr.sendWithPromise('deleteAllPages');
+ },
+
+ /** @override */
+ onDeleteSelectedPages: function(ids) {
+ return cr.sendWithPromise('deleteSelectedPages', ids);
+ }
+ };
+
+ return {
+ OfflineInternalsBrowserProxy: OfflineInternalsBrowserProxy,
+ OfflineInternalsBrowserProxyImpl: OfflineInternalsBrowserProxyImpl
+ };
+});
« no previous file with comments | « chrome/browser/resources/offline_pages/offline_internals.js ('k') | chrome/browser/ui/webui/offline_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698