OLD | NEW |
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_CORE_BACKGROUND_OFFLINER_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 | 11 |
12 namespace offline_pages { | 12 namespace offline_pages { |
13 | 13 |
14 class SavePageRequest; | 14 class SavePageRequest; |
15 | 15 |
16 // Interface of a class responsible for constructing an offline page given | 16 // Interface of a class responsible for constructing an offline page given |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // TODO(dougarnett): consider passing back a request id instead of request. | 55 // TODO(dougarnett): consider passing back a request id instead of request. |
56 typedef base::Callback<void(const SavePageRequest&, RequestStatus)> | 56 typedef base::Callback<void(const SavePageRequest&, RequestStatus)> |
57 CompletionCallback; | 57 CompletionCallback; |
58 | 58 |
59 Offliner() {} | 59 Offliner() {} |
60 virtual ~Offliner() {} | 60 virtual ~Offliner() {} |
61 | 61 |
62 // Processes |request| to load and save an offline page. | 62 // Processes |request| to load and save an offline page. |
63 // Returns whether the request was accepted or not. |callback| is guaranteed | 63 // Returns whether the request was accepted or not. |callback| is guaranteed |
64 // to be called if the request was accepted and |Cancel()| is not called. | 64 // to be called if the request was accepted and |Cancel()| is not called. |
65 virtual bool LoadAndSave( | 65 virtual bool LoadAndSave(const SavePageRequest& request, |
66 const SavePageRequest& request, | 66 const CompletionCallback& callback) = 0; |
67 const CompletionCallback& callback) = 0; | |
68 | 67 |
69 // Clears the currently processing request, if any, and skips running its | 68 // Clears the currently processing request, if any, and skips running its |
70 // CompletionCallback. | 69 // CompletionCallback. |
71 virtual void Cancel() = 0; | 70 virtual void Cancel() = 0; |
72 | 71 |
73 // TODO(dougarnett): add policy support methods. | 72 // TODO(dougarnett): add policy support methods. |
74 }; | 73 }; |
75 | 74 |
76 } // namespace offline_pages | 75 } // namespace offline_pages |
77 | 76 |
78 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ | 77 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
OLD | NEW |