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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); | 62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Notification); |
63 DEFINE_WRAPPERTYPEINFO(); | 63 DEFINE_WRAPPERTYPEINFO(); |
64 public: | 64 public: |
65 // Used for JavaScript instantiations of the Notification object. Will autom
atically schedule for | 65 // Used for JavaScript instantiations of the Notification object. Will autom
atically schedule for |
66 // the notification to be displayed to the user. | 66 // the notification to be displayed to the user. |
67 static Notification* create(ExecutionContext*, const String& title, const No
tificationOptions&, ExceptionState&); | 67 static Notification* create(ExecutionContext*, const String& title, const No
tificationOptions&, ExceptionState&); |
68 | 68 |
69 // Used for embedder-created Notification objects. Will initialize the Notif
ication's state as showing. | 69 // Used for embedder-created Notification objects. Will initialize the Notif
ication's state as showing. |
70 static Notification* create(ExecutionContext*, int64_t persistentId, const W
ebNotificationData&); | 70 static Notification* create(ExecutionContext*, int64_t persistentId, const W
ebNotificationData&); |
71 | 71 |
72 virtual ~Notification(); | 72 ~Notification() override; |
73 | 73 |
74 void close(); | 74 void close(); |
75 | 75 |
76 DEFINE_ATTRIBUTE_EVENT_LISTENER(click); | 76 DEFINE_ATTRIBUTE_EVENT_LISTENER(click); |
77 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); | 77 DEFINE_ATTRIBUTE_EVENT_LISTENER(show); |
78 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 78 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
79 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 79 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
80 | 80 |
81 // WebNotificationDelegate implementation. | 81 // WebNotificationDelegate implementation. |
82 void dispatchShowEvent() override; | 82 void dispatchShowEvent() override; |
(...skipping 14 matching lines...) Expand all Loading... |
97 TextDirection direction() const; | 97 TextDirection direction() const; |
98 KURL iconURL() const { return m_iconUrl; } | 98 KURL iconURL() const { return m_iconUrl; } |
99 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } | 99 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } |
100 | 100 |
101 static String permissionString(WebNotificationPermission); | 101 static String permissionString(WebNotificationPermission); |
102 static String permission(ExecutionContext*); | 102 static String permission(ExecutionContext*); |
103 static WebNotificationPermission checkPermission(ExecutionContext*); | 103 static WebNotificationPermission checkPermission(ExecutionContext*); |
104 static void requestPermission(ExecutionContext*, NotificationPermissionCallb
ack* = nullptr); | 104 static void requestPermission(ExecutionContext*, NotificationPermissionCallb
ack* = nullptr); |
105 | 105 |
106 // EventTarget interface. | 106 // EventTarget interface. |
107 virtual ExecutionContext* executionContext() const override final { return A
ctiveDOMObject::executionContext(); } | 107 ExecutionContext* executionContext() const final { return ActiveDOMObject::e
xecutionContext(); } |
108 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override final; | 108 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) final; |
109 virtual const AtomicString& interfaceName() const override; | 109 const AtomicString& interfaceName() const override; |
110 | 110 |
111 // ActiveDOMObject interface. | 111 // ActiveDOMObject interface. |
112 virtual void stop() override; | 112 void stop() override; |
113 virtual bool hasPendingActivity() const override; | 113 bool hasPendingActivity() const override; |
114 | 114 |
115 DECLARE_VIRTUAL_TRACE(); | 115 DECLARE_VIRTUAL_TRACE(); |
116 | 116 |
117 private: | 117 private: |
118 Notification(const String& title, ExecutionContext*); | 118 Notification(const String& title, ExecutionContext*); |
119 | 119 |
120 void scheduleShow(); | 120 void scheduleShow(); |
121 | 121 |
122 // Calling show() may start asynchronous operation. If this object has | 122 // Calling show() may start asynchronous operation. If this object has |
123 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being | 123 // a V8 wrapper, hasPendingActivity() prevents the wrapper from being |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void setState(NotificationState state) { m_state = state; } | 166 void setState(NotificationState state) { m_state = state; } |
167 | 167 |
168 NotificationState m_state; | 168 NotificationState m_state; |
169 | 169 |
170 AsyncMethodRunner<Notification> m_asyncRunner; | 170 AsyncMethodRunner<Notification> m_asyncRunner; |
171 }; | 171 }; |
172 | 172 |
173 } // namespace blink | 173 } // namespace blink |
174 | 174 |
175 #endif // Notification_h | 175 #endif // Notification_h |
OLD | NEW |