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

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

Issue 1968593002: PrerenderingLoader initial integration with PrerenderManager/PrerenderHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: An initialization order fix 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_OFFLINER_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 9
10 namespace offline_pages { 10 namespace offline_pages {
11 11
12 class SavePageRequest; 12 class SavePageRequest;
13 13
14 // Interface of a class responsible for constructing an offline page given 14 // Interface of a class responsible for constructing an offline page given
15 // a request with a URL. 15 // a request with a URL.
16 class Offliner { 16 class Offliner {
17 public: 17 public:
18 // Completion status of processing an offline page request. 18 // Completion status of processing an offline page request.
19 enum CompletionStatus { 19 enum CompletionStatus {
pasko 2016/05/12 19:10:07 since there are values like "LOADED" with indicati
dougarnett 2016/05/13 00:00:24 Done.
20 SAVED = 0, 20 UNKNOWN = 0, // No completion status determined/reported yet.
pasko 2016/05/12 19:10:07 this value is not used in the code, use it in a te
dougarnett 2016/05/13 00:00:24 Actually meant to use in unit tests so added initi
21 CANCELED = 1, 21 LOADED = 1, // Page loaded but not (yet) saved.
22 FAILED_CONSIDER_RETRY = 2, 22 SAVED = 2, // Offline page snapshot saved.
23 FAILED_DO_NOT_RETRY = 3, 23 CANCELED = 3, // Request was canceled.
24 FAILED_CONSIDER_RETRY = 4, // Failed in a way that is subject to retry.
25 FAILED_DO_NOT_RETRY = 5,
pasko 2016/05/12 19:10:07 do we need numerical constants here? Scoped enums
dougarnett 2016/05/13 00:00:24 Done.
24 }; 26 };
25 27
26 // Reports the completion status of a request. 28 // Reports the completion status of a request.
27 // TODO(dougarnett): consider passing back a request id instead of request. 29 // TODO(dougarnett): consider passing back a request id instead of request.
28 typedef base::Callback<void(const SavePageRequest&, CompletionStatus)> 30 typedef base::Callback<void(const SavePageRequest&, CompletionStatus)>
29 CompletionCallback; 31 CompletionCallback;
30 32
31 Offliner() {} 33 Offliner() {}
32 virtual ~Offliner() {} 34 virtual ~Offliner() {}
33 35
34 // Processes |request| to load and save an offline page. 36 // Processes |request| to load and save an offline page.
35 // Returns whether the request was accepted or not. 37 // Returns whether the request was accepted or not.
36 virtual bool LoadAndSave( 38 virtual bool LoadAndSave(
37 const SavePageRequest& request, 39 const SavePageRequest& request,
38 const CompletionCallback& callback) = 0; 40 const CompletionCallback& callback) = 0;
39 41
40 // Clears the currently processing request, if any. 42 // Clears the currently processing request, if any.
41 virtual void Cancel() = 0; 43 virtual void Cancel() = 0;
42 44
43 // TODO(dougarnett): add policy support methods. 45 // TODO(dougarnett): add policy support methods.
44 }; 46 };
45 47
46 } // namespace offline_pages 48 } // namespace offline_pages
47 49
48 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ 50 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_
OLDNEW
« chrome/browser/android/offline_pages/prerendering_loader.cc ('K') | « chrome/chrome_tests_unit.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698