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

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: 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..88f936ba7dc55ae34d0edd3c2fc3f1f4d45dfa72
--- /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 <stdint.h>
fgorski 2016/04/25 21:07:37 nit: do you need this?
dougarnett 2016/04/25 21:49:08 Done.
+
+#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,
+ TIMEOUT = 2,
fgorski 2016/04/25 21:07:37 Would timeout be a different thing than one of the
dougarnett 2016/04/25 21:49:08 There is a question about what the Coordinator wil
+ FAILED_CONSIDER_RETRY = 3,
+ FAILED_DO_NOT_RETRY = 4,
+ };
+
+ typedef base::Callback<void(CompletionStatus)> CompletionCallback;
+
Pete Williamson 2016/04/25 20:12:16 Seems like we need a constructor, which brings up
dougarnett 2016/04/25 21:49:08 Yep, good stuff. Trying to get minimum/basline con
+ virtual ~BackgroundOffliner() {}
+
+ // Processes |request| to load and save an offline page.
+ // Only one request may be outstanding and will return false if a new
+ // request is not accepted.
Pete Williamson 2016/04/25 20:12:16 Will we always be limited to one request? To me t
fgorski 2016/04/25 21:07:37 +1 on only one request
dougarnett 2016/04/25 21:49:08 Ok, generalized the wording. I do think we stick t
+ virtual bool LoadAndSave(
+ const SavePageRequest& request,
+ const CompletionCallback& callback) = 0;
+
+ // Clears the currently processing request, if any.
+ virtual void CancelCurrent() = 0;
fgorski 2016/04/25 21:07:37 Just Cancel.
dougarnett 2016/04/25 21:49:08 Done.
+
+ // 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