OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009, 2011, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "wtf/text/AtomicStringHash.h" | 48 #include "wtf/text/AtomicStringHash.h" |
49 | 49 |
50 #if ENABLE(NOTIFICATIONS) | 50 #if ENABLE(NOTIFICATIONS) |
51 #include "core/platform/Timer.h" | 51 #include "core/platform/Timer.h" |
52 #endif | 52 #endif |
53 | 53 |
54 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) | 54 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) |
55 namespace WebCore { | 55 namespace WebCore { |
56 | 56 |
57 class Dictionary; | 57 class Dictionary; |
58 class ExceptionState; | |
59 class NotificationCenter; | 58 class NotificationCenter; |
60 class NotificationPermissionCallback; | 59 class NotificationPermissionCallback; |
61 class ResourceError; | 60 class ResourceError; |
62 class ResourceResponse; | 61 class ResourceResponse; |
63 class ScriptExecutionContext; | 62 class ScriptExecutionContext; |
64 class ThreadableLoader; | 63 class ThreadableLoader; |
65 | 64 |
| 65 typedef int ExceptionCode; |
| 66 |
66 class Notification : public RefCounted<Notification>, public ScriptWrappable, pu
blic ActiveDOMObject, public EventTarget { | 67 class Notification : public RefCounted<Notification>, public ScriptWrappable, pu
blic ActiveDOMObject, public EventTarget { |
67 WTF_MAKE_FAST_ALLOCATED; | 68 WTF_MAKE_FAST_ALLOCATED; |
68 public: | 69 public: |
69 Notification(); | 70 Notification(); |
70 #if ENABLE(LEGACY_NOTIFICATIONS) | 71 #if ENABLE(LEGACY_NOTIFICATIONS) |
71 static PassRefPtr<Notification> create(const KURL&, ScriptExecutionContext*,
ExceptionState&, PassRefPtr<NotificationCenter> provider); | 72 static PassRefPtr<Notification> create(const KURL&, ScriptExecutionContext*,
ExceptionCode&, PassRefPtr<NotificationCenter> provider); |
72 static PassRefPtr<Notification> create(const String& title, const String& bo
dy, const String& iconURI, ScriptExecutionContext*, ExceptionState&, PassRefPtr<
NotificationCenter> provider); | 73 static PassRefPtr<Notification> create(const String& title, const String& bo
dy, const String& iconURI, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<N
otificationCenter> provider); |
73 #endif | 74 #endif |
74 #if ENABLE(NOTIFICATIONS) | 75 #if ENABLE(NOTIFICATIONS) |
75 static PassRefPtr<Notification> create(ScriptExecutionContext*, const String
& title, const Dictionary& options); | 76 static PassRefPtr<Notification> create(ScriptExecutionContext*, const String
& title, const Dictionary& options); |
76 #endif | 77 #endif |
77 | 78 |
78 virtual ~Notification(); | 79 virtual ~Notification(); |
79 | 80 |
80 void show(); | 81 void show(); |
81 #if ENABLE(LEGACY_NOTIFICATIONS) | 82 #if ENABLE(LEGACY_NOTIFICATIONS) |
82 void cancel() { close(); } | 83 void cancel() { close(); } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 void finalize(); | 145 void finalize(); |
145 | 146 |
146 #if ENABLE(NOTIFICATIONS) | 147 #if ENABLE(NOTIFICATIONS) |
147 static const String& permission(ScriptExecutionContext*); | 148 static const String& permission(ScriptExecutionContext*); |
148 static const String& permissionString(NotificationClient::Permission); | 149 static const String& permissionString(NotificationClient::Permission); |
149 static void requestPermission(ScriptExecutionContext*, PassRefPtr<Notificati
onPermissionCallback> = 0); | 150 static void requestPermission(ScriptExecutionContext*, PassRefPtr<Notificati
onPermissionCallback> = 0); |
150 #endif | 151 #endif |
151 | 152 |
152 private: | 153 private: |
153 #if ENABLE(LEGACY_NOTIFICATIONS) | 154 #if ENABLE(LEGACY_NOTIFICATIONS) |
154 Notification(const KURL&, ScriptExecutionContext*, ExceptionState&, PassRefP
tr<NotificationCenter>); | 155 Notification(const KURL&, ScriptExecutionContext*, ExceptionCode&, PassRefPt
r<NotificationCenter>); |
155 Notification(const String& title, const String& body, const String& iconURI,
ScriptExecutionContext*, ExceptionState&, PassRefPtr<NotificationCenter>); | 156 Notification(const String& title, const String& body, const String& iconURI,
ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter>); |
156 #endif | 157 #endif |
157 #if ENABLE(NOTIFICATIONS) | 158 #if ENABLE(NOTIFICATIONS) |
158 Notification(ScriptExecutionContext*, const String& title); | 159 Notification(ScriptExecutionContext*, const String& title); |
159 #endif | 160 #endif |
160 | 161 |
161 void setBody(const String& body) { m_body = body; } | 162 void setBody(const String& body) { m_body = body; } |
162 | 163 |
163 // EventTarget interface | 164 // EventTarget interface |
164 virtual void refEventTarget() { ref(); } | 165 virtual void refEventTarget() { ref(); } |
165 virtual void derefEventTarget() { deref(); } | 166 virtual void derefEventTarget() { deref(); } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 #if ENABLE(NOTIFICATIONS) | 203 #if ENABLE(NOTIFICATIONS) |
203 OwnPtr<Timer<Notification> > m_taskTimer; | 204 OwnPtr<Timer<Notification> > m_taskTimer; |
204 #endif | 205 #endif |
205 }; | 206 }; |
206 | 207 |
207 } // namespace WebCore | 208 } // namespace WebCore |
208 | 209 |
209 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) | 210 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) |
210 | 211 |
211 #endif // Notifications_h | 212 #endif // Notifications_h |
OLD | NEW |