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

Side by Side Diff: chrome/browser/notifications/profile_notification.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PROFILE_NOTIFICATION_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/notifications/notification.h" 10 #include "chrome/browser/notifications/notification.h"
11 #include "chrome/browser/notifications/notification_ui_manager.h" 11 #include "chrome/browser/notifications/notification_ui_manager.h"
12 12
13 // This class keeps a Notification objects and its corresponding Profile, so 13 // This class keeps a Notification objects and its corresponding Profile, so
14 // that when the Notification UI manager needs to return or cancel all 14 // that when the Notification UI manager needs to return or cancel all
15 // notifications for a given Profile we have the ability to do this. 15 // notifications for a given Profile we have the ability to do this.
16 class ProfileNotification { 16 class ProfileNotification {
17 public: 17 public:
18 // Returns a string that uniquely identifies a profile + delegate_id pair. 18 // Returns a string that uniquely identifies a profile + delegate_id pair.
19 // The profile_id is used as an identifier to identify a profile instance; it 19 // The profile_id is used as an identifier to identify a profile instance; it
20 // cannot be NULL. The ID becomes invalid when a profile is destroyed. 20 // cannot be NULL. The ID becomes invalid when a profile is destroyed.
21 static std::string GetProfileNotificationId(const std::string& delegate_id, 21 static std::string GetProfileNotificationId(const std::string& delegate_id,
22 ProfileID profile_id); 22 ProfileID profile_id);
23 23
24 ProfileNotification(Profile* profile, const Notification& notification); 24 ProfileNotification(Profile* profile, const Notification& notification);
25 ~ProfileNotification(); 25 ~ProfileNotification();
26 26
27 Profile* profile() const { return profile_; } 27 ProfileID profile_id() const { return profile_id_; }
28 const Notification& notification() const { return notification_; } 28 const Notification& notification() const { return notification_; }
29 29
30 private: 30 private:
31 // Weak, guaranteed not to be used after profile removal by parent class. 31 // Used for equality comparision in notification maps.
32 Profile* profile_; 32 ProfileID profile_id_;
33 33
34 Notification notification_; 34 Notification notification_;
35 }; 35 };
36 36
37 #endif // CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_ 37 #endif // CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698