OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ | |
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ | |
7 | |
8 #include <stdint.h> | |
fgorski
2016/04/25 21:07:37
nit: do you need this?
dougarnett
2016/04/25 21:49:08
Done.
| |
9 | |
10 #include "base/callback.h" | |
11 | |
12 namespace offline_pages { | |
13 | |
14 class SavePageRequest; | |
15 | |
16 // Interface of a class responsible for constructing an offline page given | |
17 // a request with a URL. | |
18 class BackgroundOffliner { | |
19 public: | |
20 // Completion status of processing an offline page request. | |
21 enum CompletionStatus { | |
22 SAVED = 0, | |
23 CANCELED = 1, | |
24 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
| |
25 FAILED_CONSIDER_RETRY = 3, | |
26 FAILED_DO_NOT_RETRY = 4, | |
27 }; | |
28 | |
29 typedef base::Callback<void(CompletionStatus)> CompletionCallback; | |
30 | |
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
| |
31 virtual ~BackgroundOffliner() {} | |
32 | |
33 // Processes |request| to load and save an offline page. | |
34 // Only one request may be outstanding and will return false if a new | |
35 // 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
| |
36 virtual bool LoadAndSave( | |
37 const SavePageRequest& request, | |
38 const CompletionCallback& callback) = 0; | |
39 | |
40 // Clears the currently processing request, if any. | |
41 virtual void CancelCurrent() = 0; | |
fgorski
2016/04/25 21:07:37
Just Cancel.
dougarnett
2016/04/25 21:49:08
Done.
| |
42 | |
43 // TODO(dougarnett): add policy support methods. | |
44 }; | |
45 | |
46 } // namespace offline_pages | |
47 | |
48 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ | |
OLD | NEW |