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

Side by Side Diff: chrome/browser/notifications/message_center_notification_manager.h

Issue 1155453002: Passing ProfileID instead of Profile* to clarify that profile should not be used for making any cal… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 static void RegisterPrefs(PrefRegistrySimple* registry); 52 static void RegisterPrefs(PrefRegistrySimple* registry);
53 53
54 // NotificationUIManager 54 // NotificationUIManager
55 void Add(const Notification& notification, Profile* profile) override; 55 void Add(const Notification& notification, Profile* profile) override;
56 bool Update(const Notification& notification, Profile* profile) override; 56 bool Update(const Notification& notification, Profile* profile) override;
57 const Notification* FindById(const std::string& delegate_id, 57 const Notification* FindById(const std::string& delegate_id,
58 ProfileID profile_id) const override; 58 ProfileID profile_id) const override;
59 bool CancelById(const std::string& delegate_id, 59 bool CancelById(const std::string& delegate_id,
60 ProfileID profile_id) override; 60 ProfileID profile_id) override;
61 std::set<std::string> GetAllIdsByProfileAndSourceOrigin( 61 std::set<std::string> GetAllIdsByProfileAndSourceOrigin(
62 Profile* profile, 62 ProfileID profile_id,
63 const GURL& source) override; 63 const GURL& source) override;
64 std::set<std::string> GetAllIdsByProfile(Profile* profile) override; 64 std::set<std::string> GetAllIdsByProfile(ProfileID profile_id) override;
65 bool CancelAllBySourceOrigin(const GURL& source_origin) override; 65 bool CancelAllBySourceOrigin(const GURL& source_origin) override;
66 bool CancelAllByProfile(ProfileID profile_id) override; 66 bool CancelAllByProfile(ProfileID profile_id) override;
67 void CancelAll() override; 67 void CancelAll() override;
68 68
69 // MessageCenterObserver 69 // MessageCenterObserver
70 void OnNotificationRemoved(const std::string& notification_id, 70 void OnNotificationRemoved(const std::string& notification_id,
71 bool by_user) override; 71 bool by_user) override;
72 void OnCenterVisibilityChanged(message_center::Visibility) override; 72 void OnCenterVisibilityChanged(message_center::Visibility) override;
73 void OnNotificationUpdated(const std::string& notification_id) override; 73 void OnNotificationUpdated(const std::string& notification_id) override;
74 74
(...skipping 14 matching lines...) Expand all
89 message_center::MessageCenterTrayDelegate* delegate); 89 message_center::MessageCenterTrayDelegate* delegate);
90 90
91 // Returns the notification id which this manager will use to add to message 91 // Returns the notification id which this manager will use to add to message
92 // center, for this combination of delegate id and profile. 92 // center, for this combination of delegate id and profile.
93 std::string GetMessageCenterNotificationIdForTest( 93 std::string GetMessageCenterNotificationIdForTest(
94 const std::string& delegate_id, Profile* profile); 94 const std::string& delegate_id, Profile* profile);
95 95
96 private: 96 private:
97 // Adds |profile_notification| to an alternative provider extension or app. 97 // Adds |profile_notification| to an alternative provider extension or app.
98 void AddNotificationToAlternateProvider( 98 void AddNotificationToAlternateProvider(
99 ProfileNotification* profile_notification, 99 const Notification& notification,
100 Profile* profile,
100 const std::string& extension_id) const; 101 const std::string& extension_id) const;
101 102
102 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, 103 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest,
103 ManuallyCloseMessageCenter); 104 ManuallyCloseMessageCenter);
104 105
105 scoped_ptr<message_center::MessageCenterTrayDelegate> tray_; 106 scoped_ptr<message_center::MessageCenterTrayDelegate> tray_;
106 message_center::MessageCenter* message_center_; // Weak, global. 107 message_center::MessageCenter* message_center_; // Weak, global.
107 108
108 // Use a map by notification_id since this mapping is the most often used. 109 // Use a map by notification_id since this mapping is the most often used.
109 typedef std::map<std::string, ProfileNotification*> NotificationMap; 110 typedef std::map<std::string, ProfileNotification*> NotificationMap;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 157
157 #if defined(OS_WIN) 158 #if defined(OS_WIN)
158 // Provides weak pointers for the purpose of the first run timer. 159 // Provides weak pointers for the purpose of the first run timer.
159 base::WeakPtrFactory<MessageCenterNotificationManager> weak_factory_; 160 base::WeakPtrFactory<MessageCenterNotificationManager> weak_factory_;
160 #endif 161 #endif
161 162
162 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); 163 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager);
163 }; 164 };
164 165
165 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ 166 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698