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

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: Feedback updates (does not yet rename Coordinator though). 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
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..da8580ef3481b8bc7312a531cee088b9dce9b69e
--- /dev/null
+++ b/components/offline_pages/background_offliner.h
@@ -0,0 +1,44 @@
+// 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 BackgroundOffliner {
+ public:
+ // Completion status of processing an offline page request.
+ enum CompletionStatus {
+ SAVED = 0,
+ CANCELED = 1,
+ FAILED_CONSIDER_RETRY = 2,
+ FAILED_DO_NOT_RETRY = 3,
+ };
+
+ typedef base::Callback<void(CompletionStatus)> CompletionCallback;
+
+ virtual ~BackgroundOffliner() {}
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698