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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (exceptionState.hadException()) | 98 if (exceptionState.hadException()) |
99 return nullptr; | 99 return nullptr; |
100 | 100 |
101 Notification* notification = new Notification(context, data); | 101 Notification* notification = new Notification(context, data); |
102 notification->scheduleShow(); | 102 notification->scheduleShow(); |
103 notification->suspendIfNeeded(); | 103 notification->suspendIfNeeded(); |
104 | 104 |
105 return notification; | 105 return notification; |
106 } | 106 } |
107 | 107 |
108 Notification* Notification::create(ExecutionContext* context, int64_t persistent
Id, const WebNotificationData& data) | 108 Notification* Notification::create(ExecutionContext* context, int64_t persistent
Id, const WebNotificationData& data, bool showing) |
109 { | 109 { |
110 Notification* notification = new Notification(context, data); | 110 Notification* notification = new Notification(context, data); |
111 notification->setPersistentId(persistentId); | 111 notification->setPersistentId(persistentId); |
112 notification->setState(NotificationStateShowing); | 112 notification->setState(showing ? NotificationStateShowing : NotificationStat
eClosed); |
113 notification->suspendIfNeeded(); | 113 notification->suspendIfNeeded(); |
114 | 114 |
115 return notification; | 115 return notification; |
116 } | 116 } |
117 | 117 |
118 Notification::Notification(ExecutionContext* context, const WebNotificationData&
data) | 118 Notification::Notification(ExecutionContext* context, const WebNotificationData&
data) |
119 : ActiveDOMObject(context) | 119 : ActiveDOMObject(context) |
120 , m_data(data) | 120 , m_data(data) |
121 , m_persistentId(kInvalidPersistentId) | 121 , m_persistentId(kInvalidPersistentId) |
122 , m_state(NotificationStateIdle) | 122 , m_state(NotificationStateIdle) |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 DEFINE_TRACE(Notification) | 374 DEFINE_TRACE(Notification) |
375 { | 375 { |
376 visitor->trace(m_asyncRunner); | 376 visitor->trace(m_asyncRunner); |
377 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); | 377 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); |
378 ActiveDOMObject::trace(visitor); | 378 ActiveDOMObject::trace(visitor); |
379 } | 379 } |
380 | 380 |
381 } // namespace blink | 381 } // namespace blink |
OLD | NEW |