Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / browser / notifications / notification.h
blob363ece7cd47031e70354968f90b924e23d905f07
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 "third_party/WebKit/public/web/WebTextDirection.h"
16 #include "ui/message_center/notification.h"
17 #include "ui/message_center/notification_types.h"
18 #include "url/gurl.h"
20 namespace gfx {
21 class Image;
24 // Representation of a notification to be shown to the user.
25 class Notification : public message_center::Notification {
26 public:
27 Notification(const GURL& origin_url,
28 const base::string16& title,
29 const base::string16& body,
30 const gfx::Image& icon,
31 const base::string16& display_source,
32 const base::string16& replace_id,
33 NotificationDelegate* delegate);
35 Notification(
36 message_center::NotificationType type,
37 const GURL& origin_url,
38 const base::string16& title,
39 const base::string16& body,
40 const gfx::Image& icon,
41 blink::WebTextDirection dir,
42 const message_center::NotifierId& notifier_id,
43 const base::string16& display_source,
44 const base::string16& replace_id,
45 const message_center::RichNotificationData& rich_notification_data,
46 NotificationDelegate* delegate);
48 Notification(const std::string& id, const Notification& notification);
50 Notification(const Notification& notification);
51 ~Notification() override;
52 Notification& operator=(const Notification& notification);
54 // The origin URL of the script which requested the notification.
55 const GURL& origin_url() const { return origin_url_; }
57 // A unique identifier used to update (replace) or remove a notification.
58 const base::string16& replace_id() const { return replace_id_; }
60 // Id of the delegate embedded inside this instance.
61 std::string delegate_id() const { return delegate()->id(); }
63 NotificationDelegate* delegate() const { return delegate_.get(); }
65 private:
66 // The Origin of the page/worker which created this notification.
67 GURL origin_url_;
69 // The user-supplied replace ID for the notification.
70 base::string16 replace_id_;
72 // A proxy object that allows access back to the JavaScript object that
73 // represents the notification, for firing events.
74 scoped_refptr<NotificationDelegate> delegate_;
77 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_