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

Side by Side Diff: ui/message_center/notification_delegate.h

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

Powered by Google App Engine
This is Rietveld 408576698