OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "chrome/browser/download/download_ui_controller.h" | 10 #include "chrome/browser/download/download_ui_controller.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 items_deleter_; | 38 items_deleter_; |
39 }; | 39 }; |
40 | 40 |
41 class DownloadNotificationManagerForProfile | 41 class DownloadNotificationManagerForProfile |
42 : public content::DownloadItem::Observer { | 42 : public content::DownloadItem::Observer { |
43 public: | 43 public: |
44 DownloadNotificationManagerForProfile( | 44 DownloadNotificationManagerForProfile( |
45 Profile* profile, DownloadNotificationManager* parent_manager); | 45 Profile* profile, DownloadNotificationManager* parent_manager); |
46 ~DownloadNotificationManagerForProfile() override; | 46 ~DownloadNotificationManagerForProfile() override; |
47 | 47 |
48 message_center::MessageCenter* message_center() const { | |
49 return message_center_; | |
50 } | |
51 | |
52 // DownloadItem::Observer overrides: | 48 // DownloadItem::Observer overrides: |
53 void OnDownloadUpdated(content::DownloadItem* download) override; | 49 void OnDownloadUpdated(content::DownloadItem* download) override; |
54 void OnDownloadOpened(content::DownloadItem* download) override; | 50 void OnDownloadOpened(content::DownloadItem* download) override; |
55 void OnDownloadRemoved(content::DownloadItem* download) override; | 51 void OnDownloadRemoved(content::DownloadItem* download) override; |
56 void OnDownloadDestroyed(content::DownloadItem* download) override; | 52 void OnDownloadDestroyed(content::DownloadItem* download) override; |
57 | 53 |
58 void OnNewDownloadReady(content::DownloadItem* item); | 54 void OnNewDownloadReady(content::DownloadItem* item); |
59 | 55 |
60 private: | 56 private: |
61 friend class test::DownloadItemNotificationTest; | 57 friend class test::DownloadItemNotificationTest; |
62 | 58 |
63 void OverrideMessageCenterForTest( | |
64 message_center::MessageCenter* message_center); | |
65 | |
66 Profile* profile_ = nullptr; | 59 Profile* profile_ = nullptr; |
67 DownloadNotificationManager* parent_manager_; // weak | 60 DownloadNotificationManager* parent_manager_; // weak |
68 std::set<content::DownloadItem*> downloading_items_; | 61 std::set<content::DownloadItem*> downloading_items_; |
69 std::map<content::DownloadItem*, DownloadItemNotification*> items_; | 62 std::map<content::DownloadItem*, DownloadItemNotification*> items_; |
70 | 63 |
71 // Pointer to the message center instance. | |
72 message_center::MessageCenter* message_center_; | |
73 | |
74 STLValueDeleter<std::map<content::DownloadItem*, DownloadItemNotification*>> | 64 STLValueDeleter<std::map<content::DownloadItem*, DownloadItemNotification*>> |
75 items_deleter_; | 65 items_deleter_; |
76 }; | 66 }; |
77 | 67 |
78 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_ | 68 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_ |
OLD | NEW |