Chromium Code Reviews| Index: chrome/browser/background_fetch/background_fetch_client_impl.h |
| diff --git a/chrome/browser/background_fetch/background_fetch_client_impl.h b/chrome/browser/background_fetch/background_fetch_client_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e3b89b9773c9b46df3f3a1e5cf1b9cc2df4984c7 |
| --- /dev/null |
| +++ b/chrome/browser/background_fetch/background_fetch_client_impl.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2017 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 CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CLIENT_IMPL_H_ |
| +#define CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CLIENT_IMPL_H_ |
| + |
| +#include "base/macros.h" |
| +#include "components/keyed_service/core/keyed_service.h" |
| +#include "components/offline_items_collection/core/offline_content_provider.h" |
| +#include "content/public/browser/background_fetch_client.h" |
| + |
| +namespace offline_items_collection { |
| +class OfflineContentProvider; |
|
Peter Beverloo
2017/03/31 11:54:06
nit: you're including and using OCP, no need to fo
harkness
2017/04/03 12:47:22
Done.
|
| +struct ContentId; |
| +struct OfflineItem; |
| +} // namespace offline_items_collection |
| + |
| +class Profile; |
| + |
| +class BackgroundFetchClientImpl |
| + : public content::BackgroundFetchClient, |
| + public offline_items_collection::OfflineContentProvider, |
| + public KeyedService { |
| + public: |
| + explicit BackgroundFetchClientImpl(Profile* profile); |
| + ~BackgroundFetchClientImpl() override; |
| + |
| + // KeyedService override. |
| + void Shutdown() override; |
| + |
| + // content::BackgroundFetchClient implementation. |
| + void SetDelegate(content::BackgroundFetchClient::Delegate* delegate) override; |
| + |
| + // components::offline_items_collection::OfflineContentProvider overrides. |
| + bool AreItemsAvailable() override; |
| + void OpenItem(const offline_items_collection::ContentId& content_id) override; |
| + void RemoveItem( |
| + const offline_items_collection::ContentId& content_id) override; |
| + void CancelDownload( |
| + const offline_items_collection::ContentId& content_id) override; |
| + void PauseDownload( |
| + const offline_items_collection::ContentId& content_id) override; |
| + void ResumeDownload( |
| + const offline_items_collection::ContentId& content_id) override; |
| + const offline_items_collection::OfflineItem* GetItemById( |
| + const offline_items_collection::ContentId& content_id) override; |
| + offline_items_collection::OfflineContentProvider::OfflineItemList |
| + GetAllItems() override; |
| + void AddObserver(Observer* observer) override; |
| + void RemoveObserver(Observer* observer) override; |
| + |
| + private: |
| + // This object is owned by the Profile. |
| + Profile* profile_; |
| + |
| + // The |delegate| is owned externally and will remove itself prior to |
| + // deletion. |
| + content::BackgroundFetchClient::Delegate* delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BackgroundFetchClientImpl); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CLIENT_IMPL_H_ |