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

Unified Diff: components/offline_pages/background/offliner.h

Issue 1922533003: Defines initial inner circle of interfaces for background offlining. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed forward reference of SavePageRequest to empty stuct for this CL per dewittj feedback. Created 4 years, 8 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
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/background/offliner.h
diff --git a/components/offline_pages/background/offliner.h b/components/offline_pages/background/offliner.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a253f659c5d351733b2e8262326bd660f4f58e7
--- /dev/null
+++ b/components/offline_pages/background/offliner.h
@@ -0,0 +1,48 @@
+// 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.
+
+#ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
+#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
+
+#include "base/callback.h"
+
+namespace offline_pages {
+
+class SavePageRequest;
+
+// Interface of a class responsible for constructing an offline page given
+// a request with a URL.
+class Offliner {
+ public:
+ // Completion status of processing an offline page request.
+ enum CompletionStatus {
+ SAVED = 0,
+ CANCELED = 1,
+ FAILED_CONSIDER_RETRY = 2,
+ FAILED_DO_NOT_RETRY = 3,
+ };
+
+ // Reports the completion status of a request.
+ // TODO(dougarnett): consider passing back a request id instead of request.
+ typedef base::Callback<void(const SavePageRequest& request, CompletionStatus)>
+ CompletionCallback;
+
+ Offliner() {}
+ virtual ~Offliner() {}
+
+ // Processes |request| to load and save an offline page.
+ // Returns whether the request was accepted or not.
+ virtual bool LoadAndSave(
+ const SavePageRequest& request,
+ const CompletionCallback& callback) = 0;
+
+ // Clears the currently processing request, if any.
+ virtual void Cancel() = 0;
+
+ // TODO(dougarnett): add policy support methods.
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698