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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "wtf/OwnPtr.h" | 42 #include "wtf/OwnPtr.h" |
43 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
44 #include "wtf/RefCounted.h" | 44 #include "wtf/RefCounted.h" |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
48 class Dictionary; | 48 class Dictionary; |
49 class ExecutionContext; | 49 class ExecutionContext; |
50 class NotificationPermissionCallback; | 50 class NotificationPermissionCallback; |
51 | 51 |
52 class Notification : public RefCountedWillBeRefCountedGarbageCollected<Notificat
ion>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInli
neData { | 52 class Notification : public RefCountedGarbageCollected<Notification>, public Scr
iptWrappable, public ActiveDOMObject, public EventTargetWithInlineData { |
53 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<N
otification>); | 53 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedGarbageCollected<Notification>); |
54 | 54 |
55 public: | 55 public: |
56 static PassRefPtrWillBeRawPtr<Notification> create(ExecutionContext*, const
String& title, const Dictionary& options); | 56 static Notification* create(ExecutionContext*, const String& title, const Di
ctionary& options); |
57 | 57 |
58 virtual ~Notification(); | 58 virtual ~Notification(); |
59 | 59 |
60 void close(); | 60 void close(); |
61 | 61 |
62 DEFINE_ATTRIBUTE_EVENT_LISTENER(click); | 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(click); |
63 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); | 63 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); |
64 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 64 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
65 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 65 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
66 | 66 |
(...skipping 18 matching lines...) Expand all Loading... |
85 | 85 |
86 // EventTarget interface. | 86 // EventTarget interface. |
87 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return A
ctiveDOMObject::executionContext(); } | 87 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return A
ctiveDOMObject::executionContext(); } |
88 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE FINAL; | 88 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE FINAL; |
89 virtual const AtomicString& interfaceName() const OVERRIDE; | 89 virtual const AtomicString& interfaceName() const OVERRIDE; |
90 | 90 |
91 // ActiveDOMObject interface. | 91 // ActiveDOMObject interface. |
92 virtual void stop() OVERRIDE; | 92 virtual void stop() OVERRIDE; |
93 virtual bool hasPendingActivity() const OVERRIDE; | 93 virtual bool hasPendingActivity() const OVERRIDE; |
94 | 94 |
95 // RefCountedWillBeRefCountedGarbageCollected<Notification> interface. | |
96 void trace(Visitor*) { } | 95 void trace(Visitor*) { } |
97 | 96 |
98 private: | 97 private: |
99 Notification(const String& title, ExecutionContext*, NotificationClient*); | 98 Notification(const String& title, ExecutionContext*, NotificationClient*); |
100 | 99 |
101 // Calling show() may start asynchronous operation. If this object has | 100 // Calling show() may start asynchronous operation. If this object has |
102 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being | 101 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being |
103 // collected while m_state is Showing, and so this instance stays alive | 102 // collected while m_state is Showing, and so this instance stays alive |
104 // until the operation completes. Otherwise, you need to hold a ref on this | 103 // until the operation completes. Otherwise, you need to hold a ref on this |
105 // instance until the operation completes. | 104 // instance until the operation completes. |
(...skipping 23 matching lines...) Expand all Loading... |
129 NotificationState m_state; | 128 NotificationState m_state; |
130 | 129 |
131 NotificationClient* m_client; | 130 NotificationClient* m_client; |
132 | 131 |
133 OwnPtr<AsyncMethodRunner<Notification> > m_asyncRunner; | 132 OwnPtr<AsyncMethodRunner<Notification> > m_asyncRunner; |
134 }; | 133 }; |
135 | 134 |
136 } // namespace WebCore | 135 } // namespace WebCore |
137 | 136 |
138 #endif // Notification_h | 137 #endif // Notification_h |
OLD | NEW |