| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 class Dictionary; | 47 class Dictionary; |
| 48 class ExecutionContext; | 48 class ExecutionContext; |
| 49 class NotificationPermissionCallback; | 49 class NotificationPermissionCallback; |
| 50 | 50 |
| 51 class Notification : public RefCountedGarbageCollected<Notification>, public Scr
iptWrappable, public ActiveDOMObject, public EventTargetWithInlineData { | 51 class Notification : public RefCountedGarbageCollected<Notification>, public Scr
iptWrappable, public ActiveDOMObject, public EventTargetWithInlineData { |
| 52 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedGarbageCollected<Notification>); | 52 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedGarbageCollected<Notification>); |
| 53 | 53 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); |
| 54 public: | 54 public: |
| 55 static Notification* create(ExecutionContext*, const String& title, const Di
ctionary& options); | 55 static Notification* create(ExecutionContext*, const String& title, const Di
ctionary& options); |
| 56 | 56 |
| 57 virtual ~Notification(); | 57 virtual ~Notification(); |
| 58 | 58 |
| 59 void close(); | 59 void close(); |
| 60 | 60 |
| 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(click); | 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(click); |
| 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); | 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); |
| 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 | 84 |
| 85 // EventTarget interface. | 85 // EventTarget interface. |
| 86 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return A
ctiveDOMObject::executionContext(); } | 86 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return A
ctiveDOMObject::executionContext(); } |
| 87 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE FINAL; | 87 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE FINAL; |
| 88 virtual const AtomicString& interfaceName() const OVERRIDE; | 88 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 89 | 89 |
| 90 // ActiveDOMObject interface. | 90 // ActiveDOMObject interface. |
| 91 virtual void stop() OVERRIDE; | 91 virtual void stop() OVERRIDE; |
| 92 virtual bool hasPendingActivity() const OVERRIDE; | 92 virtual bool hasPendingActivity() const OVERRIDE; |
| 93 | 93 |
| 94 void trace(Visitor*) { } | |
| 95 | |
| 96 private: | 94 private: |
| 97 Notification(const String& title, ExecutionContext*, NotificationClient*); | 95 Notification(const String& title, ExecutionContext*, NotificationClient*); |
| 98 | 96 |
| 99 // Calling show() may start asynchronous operation. If this object has | 97 // Calling show() may start asynchronous operation. If this object has |
| 100 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being | 98 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being |
| 101 // collected while m_state is Showing, and so this instance stays alive | 99 // collected while m_state is Showing, and so this instance stays alive |
| 102 // until the operation completes. Otherwise, you need to hold a ref on this | 100 // until the operation completes. Otherwise, you need to hold a ref on this |
| 103 // instance until the operation completes. | 101 // instance until the operation completes. |
| 104 void show(); | 102 void show(); |
| 105 | 103 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 127 NotificationState m_state; | 125 NotificationState m_state; |
| 128 | 126 |
| 129 NotificationClient* m_client; | 127 NotificationClient* m_client; |
| 130 | 128 |
| 131 OwnPtr<AsyncMethodRunner<Notification> > m_asyncRunner; | 129 OwnPtr<AsyncMethodRunner<Notification> > m_asyncRunner; |
| 132 }; | 130 }; |
| 133 | 131 |
| 134 } // namespace WebCore | 132 } // namespace WebCore |
| 135 | 133 |
| 136 #endif // Notification_h | 134 #endif // Notification_h |
| OLD | NEW |