Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: chrome/browser/background_fetch/background_fetch_client_impl.h

Issue 2777063008: Connect BackgroundFetch to the OfflineItemCollection
Patch Set: Fixed incognito check and added tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f2a01771c6be6b2cd38cd62179741c6cee65fa81
--- /dev/null
+++ b/chrome/browser/background_fetch/background_fetch_client_impl.h
@@ -0,0 +1,70 @@
+// 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 <string>
+
+#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 {
+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(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 GetVisualsForItem(const offline_items_collection::ContentId& id,
+ const VisualsCallback& callback) 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.
+ Delegate* delegate_;
+
+ // The name of the namespace registered with the aggregator.
+ std::string namespace_;
+
+ DISALLOW_COPY_AND_ASSIGN(BackgroundFetchClientImpl);
+};
+
+#endif // CHROME_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_CLIENT_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698