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

Side by Side Diff: chrome/browser/download/notification/download_notification_manager.h

Issue 1389273004: Update first download notification correctly if there are multiple notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update the download manually in the test Created 5 years, 2 months 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
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
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
48 // DownloadItem::Observer overrides: 52 // DownloadItem::Observer overrides:
49 void OnDownloadUpdated(content::DownloadItem* download) override; 53 void OnDownloadUpdated(content::DownloadItem* download) override;
50 void OnDownloadOpened(content::DownloadItem* download) override; 54 void OnDownloadOpened(content::DownloadItem* download) override;
51 void OnDownloadRemoved(content::DownloadItem* download) override; 55 void OnDownloadRemoved(content::DownloadItem* download) override;
52 void OnDownloadDestroyed(content::DownloadItem* download) override; 56 void OnDownloadDestroyed(content::DownloadItem* download) override;
53 57
54 void OnNewDownloadReady(content::DownloadItem* item); 58 void OnNewDownloadReady(content::DownloadItem* item);
55 59
56 private: 60 private:
57 friend class test::DownloadItemNotificationTest; 61 friend class test::DownloadItemNotificationTest;
58 62
63 void OverrideMessageCenterForTest(
64 message_center::MessageCenter* message_center);
65
59 Profile* profile_ = nullptr; 66 Profile* profile_ = nullptr;
60 DownloadNotificationManager* parent_manager_; // weak 67 DownloadNotificationManager* parent_manager_; // weak
61 std::set<content::DownloadItem*> downloading_items_; 68 std::set<content::DownloadItem*> downloading_items_;
62 std::map<content::DownloadItem*, DownloadItemNotification*> items_; 69 std::map<content::DownloadItem*, DownloadItemNotification*> items_;
63 70
71 // Pointer to the message center instance.
72 message_center::MessageCenter* message_center_;
73
64 STLValueDeleter<std::map<content::DownloadItem*, DownloadItemNotification*>> 74 STLValueDeleter<std::map<content::DownloadItem*, DownloadItemNotification*>>
65 items_deleter_; 75 items_deleter_;
66 }; 76 };
67 77
68 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_ 78 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698