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

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

Issue 2719813005: CrOS: Add print statements to help debug BrowserProcessImpl::Unpin crash. (Closed)
Patch Set: Use DVLOG instead. Created 3 years, 9 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 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
12 14
13 class ScopedKeepAlive; 15 class ScopedKeepAlive;
14 16
15 // This class keeps a Notification objects and its corresponding Profile, so 17 // This class keeps a Notification objects and its corresponding Profile, so
16 // that when the Notification UI manager needs to return or cancel all 18 // that when the Notification UI manager needs to return or cancel all
17 // notifications for a given Profile we have the ability to do this. 19 // notifications for a given Profile we have the ability to do this.
18 class ProfileNotification { 20 class ProfileNotification : public content::NotificationObserver {
19 public: 21 public:
20 // Returns a string that uniquely identifies a profile + delegate_id pair. 22 // Returns a string that uniquely identifies a profile + delegate_id pair.
21 // The profile_id is used as an identifier to identify a profile instance; it 23 // The profile_id is used as an identifier to identify a profile instance; it
22 // cannot be NULL. The ID becomes invalid when a profile is destroyed. 24 // cannot be NULL. The ID becomes invalid when a profile is destroyed.
23 static std::string GetProfileNotificationId(const std::string& delegate_id, 25 static std::string GetProfileNotificationId(const std::string& delegate_id,
24 ProfileID profile_id); 26 ProfileID profile_id);
25 27
26 ProfileNotification(Profile* profile, const Notification& notification); 28 ProfileNotification(Profile* profile, const Notification& notification);
27 ~ProfileNotification(); 29 ~ProfileNotification() override;
28 30
29 ProfileID profile_id() const { return profile_id_; } 31 ProfileID profile_id() const { return profile_id_; }
30 const Notification& notification() const { return notification_; } 32 const Notification& notification() const { return notification_; }
31 33
34 // content::NotificationObserver:
35 // TODO(sammiequon): This is used to help debug the crash in crbug.com/660962.
36 // Remove this when the crash is fixed or if verified to not be related to
37 // this.
38 void Observe(int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) override;
41
32 private: 42 private:
33 // Used for equality comparision in notification maps. 43 // Used for equality comparision in notification maps.
34 ProfileID profile_id_; 44 ProfileID profile_id_;
35 45
36 Notification notification_; 46 Notification notification_;
37 47
38 std::unique_ptr<ScopedKeepAlive> keep_alive_; 48 std::unique_ptr<ScopedKeepAlive> keep_alive_;
39 49
50 content::NotificationRegistrar registrar_;
51
40 DISALLOW_COPY_AND_ASSIGN(ProfileNotification); 52 DISALLOW_COPY_AND_ASSIGN(ProfileNotification);
41 }; 53 };
42 54
43 #endif // CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_ 55 #endif // CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698