| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 string id(title.utf8()); | 83 string id(title.utf8()); |
| 84 if (m_activeNotifications.find(id) == m_activeNotifications.end()) | 84 if (m_activeNotifications.find(id) == m_activeNotifications.end()) |
| 85 return false; | 85 return false; |
| 86 | 86 |
| 87 const WebNotification& notification = m_activeNotifications.find(id)->second
; | 87 const WebNotification& notification = m_activeNotifications.find(id)->second
; |
| 88 WebNotification eventTarget(notification); | 88 WebNotification eventTarget(notification); |
| 89 eventTarget.dispatchClickEvent(); | 89 eventTarget.dispatchClickEvent(); |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void NotificationPresenter::cancelAllActiveNotifications() |
| 94 { |
| 95 while (!m_activeNotifications.empty()) { |
| 96 const WebNotification& notification = m_activeNotifications.begin()->sec
ond; |
| 97 cancel(notification); |
| 98 } |
| 99 } |
| 100 |
| 93 // The output from all these methods matches what DumpRenderTree produces. | 101 // The output from all these methods matches what DumpRenderTree produces. |
| 94 bool NotificationPresenter::show(const WebNotification& notification) | 102 bool NotificationPresenter::show(const WebNotification& notification) |
| 95 { | 103 { |
| 96 WebString identifier = identifierForNotification(notification); | 104 WebString identifier = identifierForNotification(notification); |
| 97 if (!notification.replaceId().isEmpty()) { | 105 if (!notification.replaceId().isEmpty()) { |
| 98 string replaceId(notification.replaceId().utf8()); | 106 string replaceId(notification.replaceId().utf8()); |
| 99 if (m_replacements.find(replaceId) != m_replacements.end()) | 107 if (m_replacements.find(replaceId) != m_replacements.end()) |
| 100 m_delegate->printMessage(string("REPLACING NOTIFICATION ") + m_repla
cements.find(replaceId)->second + "\n"); | 108 m_delegate->printMessage(string("REPLACING NOTIFICATION ") + m_repla
cements.find(replaceId)->second + "\n"); |
| 101 | 109 |
| 102 m_replacements[replaceId] = identifier.utf8(); | 110 m_replacements[replaceId] = identifier.utf8(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 const WebSecurityOrigin& origin, | 162 const WebSecurityOrigin& origin, |
| 155 WebNotificationPermissionCallback* callback) | 163 WebNotificationPermissionCallback* callback) |
| 156 { | 164 { |
| 157 m_delegate->printMessage("DESKTOP NOTIFICATION PERMISSION REQUESTED: " + str
ing(origin.toString().utf8()) + "\n"); | 165 m_delegate->printMessage("DESKTOP NOTIFICATION PERMISSION REQUESTED: " + str
ing(origin.toString().utf8()) + "\n"); |
| 158 callback->permissionRequestComplete(); | 166 callback->permissionRequestComplete(); |
| 159 } | 167 } |
| 160 | 168 |
| 161 } | 169 } |
| 162 | 170 |
| 163 #endif // ENABLE_NOTIFICATIONS | 171 #endif // ENABLE_NOTIFICATIONS |
| OLD | NEW |