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

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: Fix the ever-changing Mac unit tests. 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 // Returns true if the delegate can handle click event.
37 virtual bool HasClickedListener();
38
39 // To be called when the user clicks a button in a notification. TODO(miket):
40 // consider providing default implementations of the pure virtuals of this
41 // interface, to avoid pinging so many OWNERs each time we enhance it.
42 virtual void ButtonClick(int button_index);
43
44 // Returns unique id of the notification. 22 // Returns unique id of the notification.
45 virtual std::string id() const = 0; 23 virtual std::string id() const = 0;
46 24
47 // Returns the id of renderer process which creates the notification, or -1. 25 // Returns the id of renderer process which creates the notification, or -1.
48 virtual int process_id() const; 26 virtual int process_id() const;
49 27
50 // Returns the RenderViewHost that generated the notification, or NULL. 28 // Returns the RenderViewHost that generated the notification, or NULL.
51 virtual content::RenderViewHost* GetRenderViewHost() const = 0; 29 virtual content::RenderViewHost* GetRenderViewHost() const = 0;
52 30
53 // Lets the delegate know that no more rendering will be necessary. 31 // Lets the delegate know that no more rendering will be necessary.
54 virtual void ReleaseRenderViewHost(); 32 virtual void ReleaseRenderViewHost();
55 33
56 protected: 34 protected:
57 virtual ~NotificationDelegate() {} 35 virtual ~NotificationDelegate() {}
58
59 private:
60 friend class base::RefCountedThreadSafe<NotificationDelegate>;
61 }; 36 };
62 37
63 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_ 38 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification.cc ('k') | chrome/browser/notifications/notification_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698