Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / download / notification / download_notification_manager.h
blob64dabd30034a4cfff76a71ffb7e57c406e230fc6
1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_
6 #define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_
8 #include <set>
10 #include "chrome/browser/download/download_ui_controller.h"
11 #include "chrome/browser/download/notification/download_group_notification.h"
12 #include "chrome/browser/download/notification/download_item_notification.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "content/public/browser/download_item.h"
16 class DownloadNotificationManagerForProfile;
18 class DownloadNotificationManager : public DownloadUIController::Delegate {
19 public:
20 static bool IsEnabled();
22 explicit DownloadNotificationManager(Profile* profile);
23 ~DownloadNotificationManager() override;
25 void OnAllDownloadsRemoving(Profile* profile);
26 // DownloadUIController::Delegate:
27 void OnNewDownloadReady(content::DownloadItem* item) override;
29 DownloadNotificationManagerForProfile* GetForProfile(Profile* profile) const;
31 private:
32 friend class test::DownloadItemNotificationTest;
34 Profile* main_profile_ = nullptr;
35 std::map<Profile*, DownloadNotificationManagerForProfile*>
36 manager_for_profile_;
38 STLValueDeleter<std::map<Profile*, DownloadNotificationManagerForProfile*>>
39 items_deleter_;
42 class DownloadNotificationManagerForProfile
43 : public content::DownloadItem::Observer {
44 public:
45 DownloadNotificationManagerForProfile(
46 Profile* profile, DownloadNotificationManager* parent_manager);
47 ~DownloadNotificationManagerForProfile() override;
49 // DownloadItem::Observer overrides:
50 void OnDownloadUpdated(content::DownloadItem* download) override;
51 void OnDownloadOpened(content::DownloadItem* download) override;
52 void OnDownloadRemoved(content::DownloadItem* download) override;
53 void OnDownloadDestroyed(content::DownloadItem* download) override;
55 void OnNewDownloadReady(content::DownloadItem* item);
57 DownloadGroupNotification* GetGroupNotification() const;
59 private:
60 friend class test::DownloadItemNotificationTest;
62 Profile* profile_ = nullptr;
63 DownloadNotificationManager* parent_manager_; // weak
64 std::set<content::DownloadItem*> downloading_items_;
65 std::map<content::DownloadItem*, DownloadItemNotification*> items_;
66 scoped_ptr<DownloadGroupNotification> group_notification_;
68 STLValueDeleter<std::map<content::DownloadItem*, DownloadItemNotification*>>
69 items_deleter_;
72 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_