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

Side by Side Diff: components/offline_pages/background/request_coordinator.h

Issue 1914333002: Adding a BUILD file for both gyp and gn for the new background_offlining (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More CR feedback per fgorski. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
7 7
8 #include "base/callback.h"
9
8 namespace offline_pages { 10 namespace offline_pages {
9 11
10 // Coordinates queueing and processing save page later requests. 12 // Coordinates queueing and processing save page later requests.
11 class RequestCoordinator { 13 class RequestCoordinator {
12 public: 14 public:
13 // Callback to report when the processing of a triggered task is complete. 15 // Callback to report when the processing of a triggered task is complete.
14 typedef base::Callback<void()> ProcessingDoneCallback; 16 typedef base::Callback<void()> ProcessingDoneCallback;
15 17
16 struct SavePageRequest { 18 struct SavePageRequest {
17 // TODO(dougarnett): define and consider making stand-alone. 19 // TODO(dougarnett): define and consider making stand-alone.
18 }; 20 };
19 21
20 // TODO(dougarnett): How to inject Offliner factories and policy objects. 22 // TODO(dougarnett): How to inject Offliner factories and policy objects.
21 RequestCoordinator(); 23 RequestCoordinator();
22 24
23 ~RequestCoordinator() {} 25 ~RequestCoordinator();
24 26
25 // Queues |request| to later load and save when system conditions allow. 27 // Queues |request| to later load and save when system conditions allow.
26 bool SavePageLater(const SavePageRequest& request); 28 bool SavePageLater(const SavePageRequest& request);
27 29
28 // Starts processing of one or more queued save page later requests. 30 // Starts processing of one or more queued save page later requests.
29 // Returns whether processing was started and that caller should expect 31 // Returns whether processing was started and that caller should expect
30 // a callback. If processing was already active, returns false. 32 // a callback. If processing was already active, returns false.
31 bool StartProcessing(const ProcessingDoneCallback& callback); 33 bool StartProcessing(const ProcessingDoneCallback& callback);
32 34
33 // Stops the current request processing if active. This is a way for 35 // Stops the current request processing if active. This is a way for
34 // caller to abort processing; otherwise, processing will complete on 36 // caller to abort processing; otherwise, processing will complete on
35 // its own. In either case, the callback will be called when processing 37 // its own. In either case, the callback will be called when processing
36 // is stopped or complete. 38 // is stopped or complete.
37 void StopProcessing(); 39 void StopProcessing();
38 40
39 // TODO(dougarnett): add policy support methods. 41 // TODO(dougarnett): add policy support methods.
40 }; 42 };
41 43
42 } // namespace offline_pages 44 } // namespace offline_pages
43 45
44 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ 46 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
OLDNEW
« no previous file with comments | « components/offline_pages/background/BUILD.gn ('k') | components/offline_pages/background/request_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698