Chromium Code Reviews| Index: Source/modules/notifications/Notification.cpp |
| diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp |
| index 101e14ce5b6b80ff2c729fd0ac6df259acc43b28..9a22ac862576c4696d8120a3003ba4d378c4e508 100644 |
| --- a/Source/modules/notifications/Notification.cpp |
| +++ b/Source/modules/notifications/Notification.cpp |
| @@ -147,7 +147,6 @@ void Notification::show() |
| } |
| if (m_notificationClient->show(this)) { |
| m_state = Showing; |
| - setPendingActivity(this); |
| } |
| } |
| } |
| @@ -165,34 +164,18 @@ void Notification::close() |
| } |
| } |
| +bool Notification::hasPendingActivity() const |
| +{ |
| + return m_state == Showing || (m_asyncRunner && m_asyncRunner->isActive()); |
| +} |
| + |
| void Notification::stop() |
| { |
| if (m_notificationClient) |
| m_notificationClient->notificationObjectDestroyed(this); |
| m_notificationClient = 0; |
| - finalize(); |
| - |
| - // Ensure m_notificationClient == 0 only when in Closed state. |
| - ASSERT(m_state == Closed); |
| -} |
| - |
| -void Notification::finalize() |
| -{ |
| - if (m_state == Closed) |
| - return; |
| - |
| - // To call unsetPendingActivity() at the end. |
| - NotificationState lastState = m_state; |
| m_state = Closed; |
|
abarth-chromium
2013/11/15 16:02:55
Do we need to tell the m_asyncRunner to stop, or d
tyoshino (SeeGerritForStatus)
2013/11/18 10:53:13
Good catch. Since
- if m_state is set to non Idle,
|
| - |
| - // setPendingActivity() is called only when show() was successful, and only |
| - // in that case, m_state is set to Showing. So, if it's not Showing, do |
| - // nothing here. |
| - if (lastState != Showing) |
| - return; |
| - |
| - unsetPendingActivity(this); |
| } |
| void Notification::dispatchShowEvent() |
| @@ -213,7 +196,7 @@ void Notification::dispatchClickEvent() |
| void Notification::dispatchCloseEvent() |
| { |
| dispatchEvent(Event::create(EventTypeNames::close)); |
| - finalize(); |
| + m_state = Closed; |
| } |
| void Notification::dispatchErrorEvent() |