| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 class Dictionary; | 53 class Dictionary; |
| 54 class ExceptionState; | 54 class ExceptionState; |
| 55 class NotificationCenter; | 55 class NotificationCenter; |
| 56 class NotificationPermissionCallback; | 56 class NotificationPermissionCallback; |
| 57 class ResourceError; | 57 class ResourceError; |
| 58 class ResourceResponse; | 58 class ResourceResponse; |
| 59 class ScriptExecutionContext; | 59 class ScriptExecutionContext; |
| 60 class ThreadableLoader; | 60 class ThreadableLoader; |
| 61 | 61 |
| 62 class Notification : public RefCounted<Notification>, public ScriptWrappable, pu
blic ActiveDOMObject, public EventTarget { | 62 class Notification : public RefCounted<Notification>, public ScriptWrappable, pu
blic ActiveDOMObject, public EventTargetWithInlineData { |
| 63 WTF_MAKE_FAST_ALLOCATED; | 63 WTF_MAKE_FAST_ALLOCATED; |
| 64 public: | 64 public: |
| 65 Notification(); | 65 Notification(); |
| 66 #if ENABLE(LEGACY_NOTIFICATIONS) | 66 #if ENABLE(LEGACY_NOTIFICATIONS) |
| 67 static PassRefPtr<Notification> create(const String& title, const String& bo
dy, const String& iconURI, ScriptExecutionContext*, ExceptionState&, PassRefPtr<
NotificationCenter> provider); | 67 static PassRefPtr<Notification> create(const String& title, const String& bo
dy, const String& iconURI, ScriptExecutionContext*, ExceptionState&, PassRefPtr<
NotificationCenter> provider); |
| 68 #endif | 68 #endif |
| 69 static PassRefPtr<Notification> create(ScriptExecutionContext*, const String
& title, const Dictionary& options); | 69 static PassRefPtr<Notification> create(ScriptExecutionContext*, const String
& title, const Dictionary& options); |
| 70 | 70 |
| 71 virtual ~Notification(); | 71 virtual ~Notification(); |
| 72 | 72 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 void dispatchClickEvent(); | 109 void dispatchClickEvent(); |
| 110 void dispatchCloseEvent(); | 110 void dispatchCloseEvent(); |
| 111 void dispatchErrorEvent(); | 111 void dispatchErrorEvent(); |
| 112 void dispatchShowEvent(); | 112 void dispatchShowEvent(); |
| 113 | 113 |
| 114 using RefCounted<Notification>::ref; | 114 using RefCounted<Notification>::ref; |
| 115 using RefCounted<Notification>::deref; | 115 using RefCounted<Notification>::deref; |
| 116 | 116 |
| 117 // EventTarget interface | 117 // EventTarget interface |
| 118 virtual const AtomicString& interfaceName() const; | 118 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 119 virtual ScriptExecutionContext* scriptExecutionContext() const { return Acti
veDOMObject::scriptExecutionContext(); } | 119 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { re
turn ActiveDOMObject::scriptExecutionContext(); } |
| 120 virtual bool dispatchEvent(PassRefPtr<Event>); | 120 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; |
| 121 | 121 |
| 122 // ActiveDOMObject interface | 122 // ActiveDOMObject interface |
| 123 virtual void contextDestroyed(); | 123 virtual void contextDestroyed(); |
| 124 | 124 |
| 125 void stopLoadingIcon(); | 125 void stopLoadingIcon(); |
| 126 | 126 |
| 127 // Deprecated. Use functions from NotificationCenter. | 127 // Deprecated. Use functions from NotificationCenter. |
| 128 void detachPresenter() { } | 128 void detachPresenter() { } |
| 129 | 129 |
| 130 void finalize(); | 130 void finalize(); |
| 131 | 131 |
| 132 static const String& permission(ScriptExecutionContext*); | 132 static const String& permission(ScriptExecutionContext*); |
| 133 static const String& permissionString(NotificationClient::Permission); | 133 static const String& permissionString(NotificationClient::Permission); |
| 134 static void requestPermission(ScriptExecutionContext*, PassRefPtr<Notificati
onPermissionCallback> = 0); | 134 static void requestPermission(ScriptExecutionContext*, PassRefPtr<Notificati
onPermissionCallback> = 0); |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 #if ENABLE(LEGACY_NOTIFICATIONS) | 137 #if ENABLE(LEGACY_NOTIFICATIONS) |
| 138 Notification(const String& title, const String& body, const String& iconURI,
ScriptExecutionContext*, ExceptionState&, PassRefPtr<NotificationCenter>); | 138 Notification(const String& title, const String& body, const String& iconURI,
ScriptExecutionContext*, ExceptionState&, PassRefPtr<NotificationCenter>); |
| 139 #endif | 139 #endif |
| 140 Notification(ScriptExecutionContext*, const String& title); | 140 Notification(ScriptExecutionContext*, const String& title); |
| 141 | 141 |
| 142 void setBody(const String& body) { m_body = body; } | 142 void setBody(const String& body) { m_body = body; } |
| 143 | 143 |
| 144 // EventTarget interface | 144 // EventTarget interface |
| 145 virtual void refEventTarget() { ref(); } | 145 virtual void refEventTarget() OVERRIDE { ref(); } |
| 146 virtual void derefEventTarget() { deref(); } | 146 virtual void derefEventTarget() OVERRIDE { deref(); } |
| 147 virtual EventTargetData* eventTargetData(); | |
| 148 virtual EventTargetData* ensureEventTargetData(); | |
| 149 | 147 |
| 150 void startLoadingIcon(); | 148 void startLoadingIcon(); |
| 151 void finishLoadingIcon(); | 149 void finishLoadingIcon(); |
| 152 | 150 |
| 153 void taskTimerFired(Timer<Notification>*); | 151 void taskTimerFired(Timer<Notification>*); |
| 154 | 152 |
| 155 // Text notifications. | 153 // Text notifications. |
| 156 KURL m_icon; | 154 KURL m_icon; |
| 157 String m_title; | 155 String m_title; |
| 158 String m_body; | 156 String m_body; |
| 159 | 157 |
| 160 String m_direction; | 158 String m_direction; |
| 161 String m_lang; | 159 String m_lang; |
| 162 String m_tag; | 160 String m_tag; |
| 163 | 161 |
| 164 enum NotificationState { | 162 enum NotificationState { |
| 165 Idle = 0, | 163 Idle = 0, |
| 166 Showing = 1, | 164 Showing = 1, |
| 167 Closed = 2, | 165 Closed = 2, |
| 168 }; | 166 }; |
| 169 | 167 |
| 170 NotificationState m_state; | 168 NotificationState m_state; |
| 171 | 169 |
| 172 NotificationClient* m_notificationClient; | 170 NotificationClient* m_notificationClient; |
| 173 | 171 |
| 174 EventTargetData m_eventTargetData; | |
| 175 | |
| 176 OwnPtr<Timer<Notification> > m_taskTimer; | 172 OwnPtr<Timer<Notification> > m_taskTimer; |
| 177 }; | 173 }; |
| 178 | 174 |
| 179 } // namespace WebCore | 175 } // namespace WebCore |
| 180 | 176 |
| 181 #endif // Notifications_h | 177 #endif // Notifications_h |
| OLD | NEW |