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

Side by Side Diff: components/offline_pages/downloads/download_notifying_observer.h

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_DOWNLOADS_DOWNLOAD_NOTIFYING_OBSERVER_H_
6 #define COMPONENTS_OFFLINE_PAGES_DOWNLOADS_DOWNLOAD_NOTIFYING_OBSERVER_H_
7
8 #include <memory>
9
10 #include "base/guid.h"
11 #include "base/macros.h"
12 #include "components/offline_pages/background/request_coordinator.h"
13 #include "components/offline_pages/client_policy_controller.h"
14
15 namespace offline_pages {
16
17 struct ClientId;
18 struct OfflinePageDownloadNotifier;
19 class ClientPolicyController;
20 class SavePageRequest;
21
22 // Class observing the save page requests and issuing corresponding user
23 // notifications as requests are added or updated.
24 class DownloadNotifyingObserver : public RequestCoordinator::Observer,
25 public base::SupportsUserData::Data {
26 public:
27 ~DownloadNotifyingObserver() override;
28
29 static DownloadNotifyingObserver* GetFromRequestCoordinator(
30 RequestCoordinator* request_coordinator);
31 static void CreateAndStartObserving(
32 RequestCoordinator* request_coordinator,
33 std::unique_ptr<OfflinePageDownloadNotifier> notifier);
34
35 // RequestCoordinator::Observer implementation:
36 void OnAdded(const SavePageRequest& request) override;
37 void OnChanged(const SavePageRequest& request) override;
38 void OnCompleted(
39 const SavePageRequest& request,
40 RequestCoordinator::BackgroundSavePageResult status) override;
41
42 private:
43 friend class DownloadNotifyingObserverTest;
44
45 DownloadNotifyingObserver(
46 std::unique_ptr<OfflinePageDownloadNotifier> notifier,
47 ClientPolicyController* policy_controller);
48
49 bool IsVisibleInUI(const ClientId& id);
50
51 void NotifyRequestStateChange(const SavePageRequest& request);
52
53 // Used to issue notifications related to save page requests.
54 std::unique_ptr<OfflinePageDownloadNotifier> notifier_;
55 // Used to determine policy-related permissions. Not owned.
56 ClientPolicyController* policy_controller_;
57
58 DISALLOW_COPY_AND_ASSIGN(DownloadNotifyingObserver);
59 };
60
61 } // namespace offline_pages
62
63 #endif // COMPONENTS_OFFLINE_PAGES_DOWNLOADS_DOWNLOAD_NOTIFYING_OBSERVER_H_
OLDNEW
« 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