summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/notification.h
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 01:19:06 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 01:19:06 +0000
commit3b845753b707daca3fe3e733263065f162b7162b (patch)
treeb674a4d72a118323da1fad83f8caa43f57a86b32 /chrome/browser/notifications/notification.h
parentfee8f0222a5f2a377ba5d7f2d3383481c02eafac (diff)
downloadchromium_src-3b845753b707daca3fe3e733263065f162b7162b.zip
chromium_src-3b845753b707daca3fe3e733263065f162b7162b.tar.gz
chromium_src-3b845753b707daca3fe3e733263065f162b7162b.tar.bz2
* Moved sticky/controls frag to chromeos::BalloonViewImpl
* Added AddSystemNotification to add system notification and UpdateNotification to update a notification. * refactored NotificationObjectProxy and added NotificationDelegate class. * Added notification_browser.cc. BUG=33306 TEST=added notification_browser.cc with minimal test. I'll add more in next step. Review URL: http://codereview.chromium.org/1013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/notification.h')
-rw-r--r--chrome/browser/notifications/notification.h35
1 files changed, 12 insertions, 23 deletions
diff --git a/chrome/browser/notifications/notification.h b/chrome/browser/notifications/notification.h
index f80a65f..a58c2ad 100644
--- a/chrome/browser/notifications/notification.h
+++ b/chrome/browser/notifications/notification.h
@@ -1,16 +1,16 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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_NOTIFICATIONS_NOTIFICATION_H_
#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_
-#include <string>
-
#include "base/basictypes.h"
#include "chrome/browser/notifications/notification_object_proxy.h"
#include "googleurl/src/gurl.h"
+class NotificationDelegate;
+
// Representation of an notification to be shown to the user. All
// notifications at this level are HTML, although they may be
// data: URLs representing simple text+icon notifications.
@@ -18,21 +18,18 @@ class Notification {
public:
Notification(const GURL& origin_url, const GURL& content_url,
const std::wstring& display_source,
- NotificationObjectProxy* proxy,
- bool sticky)
+ NotificationDelegate* delegate)
: origin_url_(origin_url),
content_url_(content_url),
display_source_(display_source),
- proxy_(proxy),
- sticky_(sticky) {
+ delegate_(delegate) {
}
Notification(const Notification& notification)
: origin_url_(notification.origin_url()),
content_url_(notification.content_url()),
display_source_(notification.display_source()),
- proxy_(notification.proxy()),
- sticky_(notification.sticky()) {
+ delegate_(notification.delegate()) {
}
// The URL (may be data:) containing the contents for the notification.
@@ -44,20 +41,16 @@ class Notification {
// A display string for the source of the notification.
const std::wstring& display_source() const { return display_source_; }
- void Display() const { proxy()->Display(); }
- void Error() const { proxy()->Error(); }
- void Close(bool by_user) const { proxy()->Close(by_user); }
-
- bool sticky() const {
- return sticky_;
- }
+ void Display() const { delegate()->Display(); }
+ void Error() const { delegate()->Error(); }
+ void Close(bool by_user) const { delegate()->Close(by_user); }
bool IsSame(const Notification& other) const {
- return (*proxy_).IsSame(*(other.proxy()));
+ return delegate()->id() == other.delegate()->id();
}
private:
- NotificationObjectProxy* proxy() const { return proxy_.get(); }
+ NotificationDelegate* delegate() const { return delegate_.get(); }
// The Origin of the page/worker which created this notification.
GURL origin_url_;
@@ -72,11 +65,7 @@ class Notification {
// A proxy object that allows access back to the JavaScript object that
// represents the notification, for firing events.
- scoped_refptr<NotificationObjectProxy> proxy_;
-
- // A sticky flag. A sticky notification cannot be dismissed by a
- // user.
- bool sticky_;
+ scoped_refptr<NotificationDelegate> delegate_;
// Disallow assign. Copy constructor written above.
void operator=(const Notification&);