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

Side by Side Diff: chrome/browser/chromeos/notifications/system_notification.h

Issue 10947046: Eliminate kAshNotifyDisabled and SystemNotification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/basictypes.h"
12 #include "base/string16.h"
13 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" / / MessageCallback
14 #include "chrome/browser/notifications/notification_delegate.h"
15 #include "chromeos/dbus/session_manager_client.h"
16 #include "googleurl/src/gurl.h"
17
18 class BalloonCollectionImplAsh;
19 class Notification;
20 class Profile;
21
22 namespace chromeos {
23
24 // The system notification object handles the display of a system notification
25
26 class SystemNotification : public SessionManagerClient::Observer {
27 public:
28 // The profile is the current user profile. The id is any string used
29 // to uniquely identify this notification. The title is the title of
30 // the message to be displayed. On creation, the message is hidden.
31 SystemNotification(Profile* profile,
32 const std::string& id,
33 int icon_resource_id,
34 const string16& title);
35
36 // Allows to provide custom NotificationDelegate.
37 SystemNotification(Profile* profile,
38 NotificationDelegate* delegate,
39 int icon_resource_id,
40 const string16& title);
41
42 virtual ~SystemNotification();
43
44 // SessionManagerClient::Observer override.
45 virtual void UnlockScreen() OVERRIDE;
46
47 void set_title(const string16& title) { title_ = title; }
48
49 // Show will show or update the message for this notification
50 // on a transition to urgent, the notification will be shown if it was
51 // previously hidden or minimized by the user.
52 void Show(const string16& message, bool urgent, bool sticky);
53
54 // Same as Show() above with a footer link at the bottom and a callback
55 // for when the link is clicked.
56 void Show(const string16& message, const string16& link_text,
57 const BalloonViewHost::MessageCallback& callback,
58 bool urgent, bool sticky);
59
60 // Hide will dismiss the notification, if the notification is already
61 // hidden it does nothing
62 void Hide();
63
64 // Current visibility state for this notification.
65 bool visible() const { return visible_; }
66
67 // Current urgent state for this notification.
68 bool urgent() const { return urgent_; }
69
70 private:
71 class Delegate : public NotificationDelegate {
72 public:
73 explicit Delegate(const std::string& id);
74 virtual void Display() OVERRIDE {}
75 virtual void Error() OVERRIDE {}
76 virtual void Close(bool by_user) OVERRIDE {}
77 virtual void Click() OVERRIDE {}
78 virtual std::string id() const OVERRIDE;
79 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE;
80
81 protected:
82 virtual ~Delegate();
83
84 private:
85 std::string id_;
86
87 DISALLOW_COPY_AND_ASSIGN(Delegate);
88 };
89
90 void Init(int icon_resource_id);
91 void ShowNotification(const Notification& notify);
92
93 Profile* profile_;
94 BalloonCollectionImplAsh* collection_;
95 scoped_refptr<NotificationDelegate> delegate_;
96 string16 message_;
97 string16 link_;
98 BalloonViewHost::MessageCallback callback_;
99 GURL icon_;
100 string16 title_;
101 bool visible_;
102 bool sticky_;
103 bool urgent_;
104 bool show_on_unlock_;
105
106 DISALLOW_COPY_AND_ASSIGN(SystemNotification);
107 };
108
109 } // namespace chromeos
110
111 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/network_message_observer.cc ('k') | chrome/browser/chromeos/notifications/system_notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698