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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // TODO(dougarnett): consider passing back a request id instead of request. | 52 // TODO(dougarnett): consider passing back a request id instead of request. |
53 typedef base::Callback<void(const SavePageRequest&, RequestStatus)> | 53 typedef base::Callback<void(const SavePageRequest&, RequestStatus)> |
54 CompletionCallback; | 54 CompletionCallback; |
55 | 55 |
56 Offliner() {} | 56 Offliner() {} |
57 virtual ~Offliner() {} | 57 virtual ~Offliner() {} |
58 | 58 |
59 // Processes |request| to load and save an offline page. | 59 // Processes |request| to load and save an offline page. |
60 // Returns whether the request was accepted or not. |callback| is guaranteed | 60 // Returns whether the request was accepted or not. |callback| is guaranteed |
61 // to be called if the request was accepted and |Cancel()| is not called. | 61 // to be called if the request was accepted and |Cancel()| is not called. |
62 virtual bool LoadAndSave( | 62 virtual bool LoadAndSave(const SavePageRequest& request, |
63 const SavePageRequest& request, | 63 const CompletionCallback& callback) = 0; |
64 const CompletionCallback& callback) = 0; | |
65 | 64 |
66 // Clears the currently processing request, if any, and skips running its | 65 // Clears the currently processing request, if any, and skips running its |
67 // CompletionCallback. | 66 // CompletionCallback. |
68 virtual void Cancel() = 0; | 67 virtual void Cancel() = 0; |
69 | 68 |
70 // TODO(dougarnett): add policy support methods. | 69 // TODO(dougarnett): add policy support methods. |
71 }; | 70 }; |
72 | 71 |
73 } // namespace offline_pages | 72 } // namespace offline_pages |
74 | 73 |
75 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ | 74 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
OLD | NEW |