Chromium Code Reviews| Index: components/offline_pages/background/offliner.h |
| diff --git a/components/offline_pages/background/offliner.h b/components/offline_pages/background/offliner.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5a253f659c5d351733b2e8262326bd660f4f58e7 |
| --- /dev/null |
| +++ b/components/offline_pages/background/offliner.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ |
| +#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ |
| + |
| +#include "base/callback.h" |
| + |
| +namespace offline_pages { |
| + |
| +class SavePageRequest; |
| + |
| +// Interface of a class responsible for constructing an offline page given |
| +// a request with a URL. |
| +class Offliner { |
| + public: |
| + // Completion status of processing an offline page request. |
| + enum CompletionStatus { |
| + SAVED = 0, |
| + CANCELED = 1, |
| + FAILED_CONSIDER_RETRY = 2, |
| + FAILED_DO_NOT_RETRY = 3, |
| + }; |
| + |
| + // Reports the completion status of a request. |
| + // TODO(dougarnett): consider passing back a request id instead of request. |
| + typedef base::Callback<void(const SavePageRequest& request, CompletionStatus)> |
|
dewittj
2016/04/26 18:28:00
I think that technically a forward declaration of
dougarnett
2016/04/26 18:45:59
replaced with struct for this CL/iteration
|
| + CompletionCallback; |
| + |
| + Offliner() {} |
| + virtual ~Offliner() {} |
| + |
| + // Processes |request| to load and save an offline page. |
| + // Returns whether the request was accepted or not. |
| + virtual bool LoadAndSave( |
| + const SavePageRequest& request, |
| + const CompletionCallback& callback) = 0; |
| + |
| + // Clears the currently processing request, if any. |
| + virtual void Cancel() = 0; |
| + |
| + // TODO(dougarnett): add policy support methods. |
| +}; |
| + |
| +} // namespace offline_pages |
| + |
| +#endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_H_ |