| Index: third_party/WebKit/Source/modules/notifications/Notification.cpp
|
| diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp
|
| index 2e748e7b4f7e307719789d565d32580e3a49cd8e..0c728bd1513fabdb275752d62d58b3690fe14577 100644
|
| --- a/third_party/WebKit/Source/modules/notifications/Notification.cpp
|
| +++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp
|
| @@ -173,39 +173,36 @@ void Notification::close()
|
| // Schedule the "close" event to be fired for non-persistent notifications.
|
| // Persistent notifications won't get such events for programmatic closes.
|
| if (m_type == Type::NonPersistent) {
|
| - getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThreadTask(&Notification::dispatchCloseEvent, wrapPersistent(this)));
|
| + getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThreadTask(&Notification::didCloseNotification, wrapPersistent(this)));
|
| m_state = State::Closing;
|
| -
|
| - notificationManager()->close(this);
|
| - return;
|
| + } else {
|
| + m_state = State::Closed;
|
| }
|
|
|
| - m_state = State::Closed;
|
| + DCHECK(!m_notificationId.isEmpty());
|
|
|
| SecurityOrigin* origin = getExecutionContext()->getSecurityOrigin();
|
| DCHECK(origin);
|
|
|
| - notificationManager()->closePersistent(WebSecurityOrigin(origin), m_data.tag, m_notificationId);
|
| + notificationManager()->close(WebSecurityOrigin(origin), m_data.tag, m_notificationId);
|
| }
|
|
|
| -void Notification::dispatchShowEvent()
|
| +void Notification::didShowNotification(const WebString& notificationId)
|
| {
|
| + DCHECK(m_notificationId.isEmpty());
|
| + m_notificationId = notificationId;
|
| +
|
| dispatchEvent(Event::create(EventTypeNames::show));
|
| }
|
|
|
| -void Notification::dispatchClickEvent()
|
| +void Notification::didClickNotification()
|
| {
|
| UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
|
| ScopedWindowFocusAllowedIndicator windowFocusAllowed(getExecutionContext());
|
| dispatchEvent(Event::create(EventTypeNames::click));
|
| }
|
|
|
| -void Notification::dispatchErrorEvent()
|
| -{
|
| - dispatchEvent(Event::create(EventTypeNames::error));
|
| -}
|
| -
|
| -void Notification::dispatchCloseEvent()
|
| +void Notification::didCloseNotification()
|
| {
|
| // The notification will be showing when the user initiated the close, or it will be
|
| // closing if the developer initiated the close.
|
| @@ -216,6 +213,11 @@ void Notification::dispatchCloseEvent()
|
| dispatchEvent(Event::create(EventTypeNames::close));
|
| }
|
|
|
| +void Notification::dispatchErrorEvent()
|
| +{
|
| + dispatchEvent(Event::create(EventTypeNames::error));
|
| +}
|
| +
|
| String Notification::title() const
|
| {
|
| return m_data.title;
|
|
|