OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CLIENT_IMPL_H_ |
| 6 #define CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CLIENT_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "components/offline_items_collection/core/offline_content_provider.h" |
| 13 #include "content/public/browser/background_fetch_client.h" |
| 14 |
| 15 namespace offline_items_collection { |
| 16 struct ContentId; |
| 17 struct OfflineItem; |
| 18 } // namespace offline_items_collection |
| 19 |
| 20 class Profile; |
| 21 |
| 22 class BackgroundFetchClientImpl |
| 23 : public content::BackgroundFetchClient, |
| 24 public offline_items_collection::OfflineContentProvider, |
| 25 public KeyedService { |
| 26 public: |
| 27 explicit BackgroundFetchClientImpl(Profile* profile); |
| 28 ~BackgroundFetchClientImpl() override; |
| 29 |
| 30 // KeyedService override. |
| 31 void Shutdown() override; |
| 32 |
| 33 // content::BackgroundFetchClient implementation. |
| 34 void SetDelegate(Delegate* delegate) override; |
| 35 |
| 36 // components::offline_items_collection::OfflineContentProvider overrides. |
| 37 bool AreItemsAvailable() override; |
| 38 void OpenItem(const offline_items_collection::ContentId& content_id) override; |
| 39 void RemoveItem( |
| 40 const offline_items_collection::ContentId& content_id) override; |
| 41 void CancelDownload( |
| 42 const offline_items_collection::ContentId& content_id) override; |
| 43 void PauseDownload( |
| 44 const offline_items_collection::ContentId& content_id) override; |
| 45 void ResumeDownload( |
| 46 const offline_items_collection::ContentId& content_id) override; |
| 47 const offline_items_collection::OfflineItem* GetItemById( |
| 48 const offline_items_collection::ContentId& content_id) override; |
| 49 offline_items_collection::OfflineContentProvider::OfflineItemList |
| 50 GetAllItems() override; |
| 51 void GetVisualsForItem(const offline_items_collection::ContentId& id, |
| 52 const VisualsCallback& callback) override; |
| 53 void AddObserver(Observer* observer) override; |
| 54 void RemoveObserver(Observer* observer) override; |
| 55 |
| 56 private: |
| 57 // This object is owned by the Profile. |
| 58 Profile* profile_; |
| 59 |
| 60 // The |delegate| is owned externally and will remove itself prior to |
| 61 // deletion. |
| 62 Delegate* delegate_; |
| 63 |
| 64 // The name of the namespace registered with the aggregator. |
| 65 std::string namespace_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(BackgroundFetchClientImpl); |
| 68 }; |
| 69 |
| 70 #endif // CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CLIENT_IMPL_H_ |
OLD | NEW |