BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / download / notification / download_notification_manager.h
blobdbc84e86dfe2c016b4275fad842373331c25859b
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_item_notification.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "content/public/browser/download_item.h"
15 class DownloadNotificationManagerForProfile;
17 class DownloadNotificationManager : public DownloadUIController::Delegate {
18 public:
19 static bool IsEnabled();
21 explicit DownloadNotificationManager(Profile* profile);
22 ~DownloadNotificationManager() override;
24 void OnAllDownloadsRemoving(Profile* profile);
25 // DownloadUIController::Delegate:
26 void OnNewDownloadReady(content::DownloadItem* item) override;
28 DownloadNotificationManagerForProfile* GetForProfile(Profile* profile) const;
30 private:
31 friend class test::DownloadItemNotificationTest;
33 Profile* main_profile_ = nullptr;
34 std::map<Profile*, DownloadNotificationManagerForProfile*>
35 manager_for_profile_;
37 STLValueDeleter<std::map<Profile*, DownloadNotificationManagerForProfile*>>
38 items_deleter_;
41 class DownloadNotificationManagerForProfile
42 : public content::DownloadItem::Observer {
43 public:
44 DownloadNotificationManagerForProfile(
45 Profile* profile, DownloadNotificationManager* parent_manager);
46 ~DownloadNotificationManagerForProfile() override;
48 // DownloadItem::Observer overrides:
49 void OnDownloadUpdated(content::DownloadItem* download) override;
50 void OnDownloadOpened(content::DownloadItem* download) override;
51 void OnDownloadRemoved(content::DownloadItem* download) override;
52 void OnDownloadDestroyed(content::DownloadItem* download) override;
54 void OnNewDownloadReady(content::DownloadItem* item);
56 private:
57 friend class test::DownloadItemNotificationTest;
59 Profile* profile_ = nullptr;
60 DownloadNotificationManager* parent_manager_; // weak
61 std::set<content::DownloadItem*> downloading_items_;
62 std::map<content::DownloadItem*, DownloadItemNotification*> items_;
64 STLValueDeleter<std::map<content::DownloadItem*, DownloadItemNotification*>>
65 items_deleter_;
68 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_