Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / notifications / notification.h
blobd07ef76f9c46d93d8e585b96fd68f1746505ba9b
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.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h"
13 #include "base/values.h"
14 #include "chrome/browser/notifications/notification_delegate.h"
15 #include "ui/message_center/notification.h"
16 #include "ui/message_center/notification_types.h"
17 #include "url/gurl.h"
19 namespace gfx {
20 class Image;
23 // Representation of a notification to be shown to the user.
24 class Notification : public message_center::Notification {
25 public:
26 Notification(const GURL& origin_url,
27 const base::string16& title,
28 const base::string16& body,
29 const gfx::Image& icon,
30 const base::string16& display_source,
31 const std::string& tag,
32 NotificationDelegate* delegate);
34 Notification(
35 message_center::NotificationType type,
36 const base::string16& title,
37 const base::string16& body,
38 const gfx::Image& icon,
39 const message_center::NotifierId& notifier_id,
40 const base::string16& display_source,
41 const GURL& origin_url,
42 const std::string& tag,
43 const message_center::RichNotificationData& rich_notification_data,
44 NotificationDelegate* delegate);
46 Notification(const std::string& id, const Notification& notification);
48 Notification(const Notification& notification);
49 ~Notification() override;
50 Notification& operator=(const Notification& notification);
52 // A unique identifier used to update (replace) or remove a notification.
53 const std::string& tag() const { return tag_; }
55 // Id of the delegate embedded inside this instance.
56 std::string delegate_id() const { return delegate()->id(); }
58 NotificationDelegate* delegate() const { return delegate_.get(); }
60 private:
61 // The user-supplied tag for the notification.
62 std::string tag_;
64 // A proxy object that allows access back to the JavaScript object that
65 // represents the notification, for firing events.
66 scoped_refptr<NotificationDelegate> delegate_;
69 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_