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

Unified Diff: components/offline_pages/downloads/download_notifying_observer.h

Issue 2260963003: [Offline pages] Enabling notifications for pages saved later (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing missed TODO Created 4 years, 4 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: components/offline_pages/downloads/download_notifying_observer.h
diff --git a/components/offline_pages/downloads/download_notifying_observer.h b/components/offline_pages/downloads/download_notifying_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..f090492081406a7ae52a3e54d57f7d3eee8878d0
--- /dev/null
+++ b/components/offline_pages/downloads/download_notifying_observer.h
@@ -0,0 +1,51 @@
+// 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_DOWNLOADS_DOWNLOAD_NOTIFYING_OBSERVER_H_
+#define COMPONENTS_OFFLINE_PAGES_DOWNLOADS_DOWNLOAD_NOTIFYING_OBSERVER_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "components/offline_pages/background/request_coordinator.h"
+
+namespace offline_pages {
+
+struct OfflinePageDownloadNotifier;
+class SavePageRequest;
+
+// Class observing the save page requests and issuing corresponding user
+// notifications as requests are added or updated.
+class DownloadNotifyingObserver : public RequestCoordinator::Observer,
+ public base::SupportsUserData::Data {
+ public:
+ ~DownloadNotifyingObserver() override;
+
+ static DownloadNotifyingObserver* GetFromRequestCoordinator(
+ RequestCoordinator* request_coordinator);
+ static void CreateAndStartObserving(
+ RequestCoordinator* request_coordinator,
+ std::unique_ptr<OfflinePageDownloadNotifier> notifier);
+
+ // RequestCoordinator::Observer implementation:
+ void OnAdded(const SavePageRequest& request) override;
+ void OnChanged(const SavePageRequest& request) override;
+ void OnCompleted(const SavePageRequest& request,
+ RequestCoordinator::SavePageStatus status) override;
+
+ private:
+ friend class DownloadNotifyingObserverTest;
+
+ explicit DownloadNotifyingObserver(
+ std::unique_ptr<OfflinePageDownloadNotifier> notifier);
+
+ // Used to issue notifications related to save page requests.
+ std::unique_ptr<OfflinePageDownloadNotifier> notifier_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadNotifyingObserver);
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_DOWNLOADS_DOWNLOAD_NOTIFYING_OBSERVER_H_
« no previous file with comments | « components/offline_pages/downloads/BUILD.gn ('k') | components/offline_pages/downloads/download_notifying_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698