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_REQUEST_COORDINATOR_H_ | |
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_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 namespace offline_pages { | |
11 | |
12 class SavePageRequest; | |
13 | |
14 // Coordinates queueing and processing save page later requests. | |
15 class BackgroundRequestCoordinator { | |
Pete Williamson
2016/04/25 20:12:16
"BackgroundRequestCoordinator" is a long name. Wh
fgorski
2016/04/25 21:07:38
Both ideas seem fine.
c/o/background ??
dougarnett
2016/04/25 21:54:13
Yes, like the subdirectory idea
dougarnett
2016/04/25 23:23:39
Ok, I have move these files to a background subdir
| |
16 public: | |
17 // Completion status of processing an offline page request. | |
Pete Williamson
2016/04/25 20:12:16
We probably want completion status in only one hea
dougarnett
2016/04/25 21:49:08
woops - thanks
| |
18 enum CompletionStatus { | |
19 SAVED = 0, | |
20 CANCELED = 1, | |
21 TIMEOUT = 2, | |
22 FAILED_CONSIDER_RETRY = 3, | |
23 FAILED_DO_NOT_RETRY = 4, | |
24 }; | |
25 | |
26 // Callback to report when the processing of a triggered task is complete. | |
27 typedef base::Callback<void()> ProcessingDoneCallback; | |
Pete Williamson
2016/04/25 20:12:16
The processing done callback should have a paramet
fgorski
2016/04/25 21:07:38
And should pass completion status...
dougarnett
2016/04/25 21:49:08
Am thinking this is single callback for however mu
dougarnett
2016/04/25 21:54:13
Although returning a saved page count or such coul
Pete Williamson
2016/04/25 21:59:57
I guess I'm thinking about two different callbacks
Pete Williamson
2016/04/25 22:18:31
I agree that the callback should be defined in the
Pete Williamson
2016/04/25 23:13:09
Oops, looks like we were not in agreement after al
| |
28 | |
29 virtual ~BackgroundRequestCoordinator() {} | |
Pete Williamson
2016/04/25 20:12:16
We should add a constructor, too. That brings up
fgorski
2016/04/25 21:07:38
I think we mentioned this will be a KeyedService.
dougarnett
2016/04/25 21:49:08
And also discussed prospect of injecting factories
| |
30 | |
31 // Queues |request| to later load and save when system conditions allow. | |
32 virtual bool SavePageLater(const SavePageRequest& request) = 0; | |
33 | |
34 // Starts processing of one or more queued save page later requests. | |
35 virtual void StartProcessing(const ProcessingDoneCallback& callback) = 0; | |
36 | |
37 // Stops the current request processing if active. | |
38 virtual void StopProcessing() = 0; | |
39 | |
40 // TODO(dougarnett): add policy support methods. | |
41 }; | |
42 | |
43 } // namespace offline_pages | |
44 | |
45 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | |
OLD | NEW |