summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/notifications/system_notification.h
diff options
context:
space:
mode:
authorseanparent@google.com <seanparent@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 21:59:01 +0000
committerseanparent@google.com <seanparent@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 21:59:01 +0000
commit0fecda62ce784048c032bbe31c7aeaeb8d5cdeab (patch)
tree304f230ebe78ffbcea1a217fa4fd88f23b854bc3 /chrome/browser/chromeos/notifications/system_notification.h
parent5fde9812dbd02a294af8eb5966548fae2884bd98 (diff)
downloadchromium_src-0fecda62ce784048c032bbe31c7aeaeb8d5cdeab.zip
chromium_src-0fecda62ce784048c032bbe31c7aeaeb8d5cdeab.tar.gz
chromium_src-0fecda62ce784048c032bbe31c7aeaeb8d5cdeab.tar.bz2
Notification for battery with <= 15 minutes remaining.
BUG=521 TEST=none Review URL: http://codereview.chromium.org/1079007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/notifications/system_notification.h')
-rw-r--r--chrome/browser/chromeos/notifications/system_notification.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/notifications/system_notification.h b/chrome/browser/chromeos/notifications/system_notification.h
new file mode 100644
index 0000000..d78fec0
--- /dev/null
+++ b/chrome/browser/chromeos/notifications/system_notification.h
@@ -0,0 +1,69 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
+#define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/move.h"
+#include "base/ref_counted.h"
+#include "base/string16.h"
+#include "chrome/browser/chromeos/notifications/balloon_collection_impl.h"
+#include "chrome/browser/notifications/notification_delegate.h"
+
+class Profile;
+
+namespace chromeos {
+
+// The system notification object handles the display of a system notification
+
+class SystemNotification {
+ public:
+ // The profile is the current user profile. The id is any string used
+ // to uniquely identify this notification. The title is the title of
+ // the message to be displayed. On creation, the message is hidden.
+ SystemNotification(Profile* profile, std::string id, string16 title);
+
+ ~SystemNotification();
+
+ // Show will show or update the message for this notification
+ void Show(const string16& message);
+
+ // Hide will dismiss the notification, if the notification is already
+ // hidden it does nothing
+ void Hide();
+
+ // Current visibility state for this notification
+ bool visible() const { return visible_; }
+
+ private:
+ class Delegate : public NotificationDelegate {
+ public:
+ explicit Delegate(std::string id) : id_(base::move(id)) {}
+ void Display() {}
+ void Error() {}
+ void Close(bool by_user) {}
+ std::string id() const { return id_; }
+
+ private:
+ std::string id_;
+
+ DISALLOW_COPY_AND_ASSIGN(Delegate);
+ };
+
+ Profile* profile_;
+ BalloonCollectionImpl* collection_;
+ scoped_refptr<Delegate> delegate_;
+ string16 title_;
+ bool visible_;
+
+ DISALLOW_COPY_AND_ASSIGN(SystemNotification);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_SYSTEM_NOTIFICATION_H_
+