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

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

Issue 15582004: Move NotificationDelegate into message_center. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some more cosmetic fixes. Created 7 years, 7 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) 2013 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_NOTIFICATION_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "ui/message_center/notification_delegate.h"
11 12
12 namespace content { 13 namespace content {
13 class RenderViewHost; 14 class RenderViewHost;
14 } 15 }
15 16
16 // Delegate for a notification. This class has two roles: to implement callback 17 // Delegate for a notification. This class has two roles: to implement callback
17 // methods for notification, and to provide an identity of the associated 18 // methods for notification, and to provide an identity of the associated
18 // notification. 19 // notification.
19 class NotificationDelegate 20 class NotificationDelegate : public message_center::NotificationDelegate {
20 : public base::RefCountedThreadSafe<NotificationDelegate> {
21 public: 21 public:
22 // To be called when the desktop notification is actually shown.
23 virtual void Display() = 0;
24
25 // To be called when the desktop notification cannot be shown due to an
26 // error.
27 virtual void Error() = 0;
28
29 // To be called when the desktop notification is closed. If closed by a
30 // user explicitly (as opposed to timeout/script), |by_user| should be true.
31 virtual void Close(bool by_user) = 0;
32
33 // To be called when a desktop notification is clicked.
34 virtual void Click() = 0;
35
36 // To be called when the user clicks a button in a notification. TODO(miket):
37 // consider providing default implementations of the pure virtuals of this
38 // interface, to avoid pinging so many OWNERs each time we enhance it.
39 virtual void ButtonClick(int button_index);
40
41 // Returns unique id of the notification.
42 virtual std::string id() const = 0; 22 virtual std::string id() const = 0;
43
44 // Returns the id of renderer process which creates the notification, or -1. 23 // Returns the id of renderer process which creates the notification, or -1.
45 virtual int process_id() const; 24 virtual int process_id() const;
46 25
47 // Returns the RenderViewHost that generated the notification, or NULL. 26 // Returns the RenderViewHost that generated the notification, or NULL.
48 virtual content::RenderViewHost* GetRenderViewHost() const = 0; 27 virtual content::RenderViewHost* GetRenderViewHost() const = 0;
49 28
50 // Lets the delegate know that no more rendering will be necessary. 29 // Lets the delegate know that no more rendering will be necessary.
51 virtual void ReleaseRenderViewHost(); 30 virtual void ReleaseRenderViewHost();
52 31
53 protected: 32 protected:
54 virtual ~NotificationDelegate() {} 33 virtual ~NotificationDelegate() {}
55
56 private:
57 friend class base::RefCountedThreadSafe<NotificationDelegate>;
58 }; 34 };
59 35
60 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_ 36 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698