| 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_
|
|
|