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

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

Issue 10382118: Don't show system notifications while the screen is locked. (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: Rebase Created 8 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_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ 6 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" / / MessageCallback 14 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" / / MessageCallback
15 #include "chrome/browser/notifications/notification_delegate.h" 15 #include "chrome/browser/notifications/notification_delegate.h"
16 #include "chromeos/dbus/power_manager_client.h"
16 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
17 18
19 class Notification;
18 class Profile; 20 class Profile;
19 21
20 namespace chromeos { 22 namespace chromeos {
21 23
22 class BalloonCollectionImplAura; 24 class BalloonCollectionImplAura;
23 typedef class BalloonCollectionImplAura BalloonCollectionImplType; 25 typedef class BalloonCollectionImplAura BalloonCollectionImplType;
24 26
25 // The system notification object handles the display of a system notification 27 // The system notification object handles the display of a system notification
26 28
27 class SystemNotification { 29 class SystemNotification : public PowerManagerClient::Observer {
28 public: 30 public:
29 // The profile is the current user profile. The id is any string used 31 // The profile is the current user profile. The id is any string used
30 // to uniquely identify this notification. The title is the title of 32 // to uniquely identify this notification. The title is the title of
31 // the message to be displayed. On creation, the message is hidden. 33 // the message to be displayed. On creation, the message is hidden.
32 SystemNotification(Profile* profile, 34 SystemNotification(Profile* profile,
33 const std::string& id, 35 const std::string& id,
34 int icon_resource_id, 36 int icon_resource_id,
35 const string16& title); 37 const string16& title);
36 38
37 // Allows to provide custom NotificationDelegate. 39 // Allows to provide custom NotificationDelegate.
38 SystemNotification(Profile* profile, 40 SystemNotification(Profile* profile,
39 NotificationDelegate* delegate, 41 NotificationDelegate* delegate,
40 int icon_resource_id, 42 int icon_resource_id,
41 const string16& title); 43 const string16& title);
42 44
43 virtual ~SystemNotification(); 45 virtual ~SystemNotification();
44 46
47 // PowerManagerClient::Observer override.
48 virtual void UnlockScreen() OVERRIDE;
49
45 void set_title(const string16& title) { title_ = title; } 50 void set_title(const string16& title) { title_ = title; }
46 51
47 // Show will show or update the message for this notification 52 // Show will show or update the message for this notification
48 // on a transition to urgent, the notification will be shown if it was 53 // on a transition to urgent, the notification will be shown if it was
49 // previously hidden or minimized by the user. 54 // previously hidden or minimized by the user.
50 void Show(const string16& message, bool urgent, bool sticky); 55 void Show(const string16& message, bool urgent, bool sticky);
51 56
52 // Same as Show() above with a footer link at the bottom and a callback 57 // Same as Show() above with a footer link at the bottom and a callback
53 // for when the link is clicked. 58 // for when the link is clicked.
54 void Show(const string16& message, const string16& link_text, 59 void Show(const string16& message, const string16& link_text,
(...skipping 20 matching lines...) Expand all
75 virtual void Click() OVERRIDE {} 80 virtual void Click() OVERRIDE {}
76 virtual std::string id() const OVERRIDE; 81 virtual std::string id() const OVERRIDE;
77 82
78 private: 83 private:
79 std::string id_; 84 std::string id_;
80 85
81 DISALLOW_COPY_AND_ASSIGN(Delegate); 86 DISALLOW_COPY_AND_ASSIGN(Delegate);
82 }; 87 };
83 88
84 void Init(int icon_resource_id); 89 void Init(int icon_resource_id);
90 void ShowNotification(const Notification& notify);
85 91
86 Profile* profile_; 92 Profile* profile_;
87 BalloonCollectionImplType* collection_; 93 BalloonCollectionImplType* collection_;
88 scoped_refptr<NotificationDelegate> delegate_; 94 scoped_refptr<NotificationDelegate> delegate_;
95 string16 message_;
96 string16 link_;
97 BalloonViewHost::MessageCallback callback_;
89 GURL icon_; 98 GURL icon_;
90 string16 title_; 99 string16 title_;
91 bool visible_; 100 bool visible_;
101 bool sticky_;
92 bool urgent_; 102 bool urgent_;
103 bool show_on_unlock_;
93 104
94 DISALLOW_COPY_AND_ASSIGN(SystemNotification); 105 DISALLOW_COPY_AND_ASSIGN(SystemNotification);
95 }; 106 };
96 107
97 } // namespace chromeos 108 } // namespace chromeos
98 109
99 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_ 110 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698