| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
| 35 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 35 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| 36 #include "bindings/modules/v8/V8NotificationAction.h" | 36 #include "bindings/modules/v8/V8NotificationAction.h" |
| 37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 38 #include "core/dom/DocumentUserGestureToken.h" | 38 #include "core/dom/DocumentUserGestureToken.h" |
| 39 #include "core/dom/ExecutionContext.h" | 39 #include "core/dom/ExecutionContext.h" |
| 40 #include "core/dom/ExecutionContextTask.h" | 40 #include "core/dom/ExecutionContextTask.h" |
| 41 #include "core/dom/ScopedWindowFocusAllowedIndicator.h" | 41 #include "core/dom/ScopedWindowFocusAllowedIndicator.h" |
| 42 #include "core/dom/TaskRunnerHelper.h" |
| 42 #include "core/events/Event.h" | 43 #include "core/events/Event.h" |
| 43 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
| 44 #include "modules/notifications/NotificationAction.h" | 45 #include "modules/notifications/NotificationAction.h" |
| 45 #include "modules/notifications/NotificationData.h" | 46 #include "modules/notifications/NotificationData.h" |
| 46 #include "modules/notifications/NotificationManager.h" | 47 #include "modules/notifications/NotificationManager.h" |
| 47 #include "modules/notifications/NotificationOptions.h" | 48 #include "modules/notifications/NotificationOptions.h" |
| 48 #include "modules/notifications/NotificationResourcesLoader.h" | 49 #include "modules/notifications/NotificationResourcesLoader.h" |
| 49 #include "platform/RuntimeEnabledFeatures.h" | 50 #include "platform/RuntimeEnabledFeatures.h" |
| 50 #include "platform/UserGestureIndicator.h" | 51 #include "platform/UserGestureIndicator.h" |
| 51 #include "public/platform/Platform.h" | 52 #include "public/platform/Platform.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 180 } |
| 180 | 181 |
| 181 void Notification::close() { | 182 void Notification::close() { |
| 182 if (m_state != State::Showing) | 183 if (m_state != State::Showing) |
| 183 return; | 184 return; |
| 184 | 185 |
| 185 // Schedule the "close" event to be fired for non-persistent notifications. | 186 // Schedule the "close" event to be fired for non-persistent notifications. |
| 186 // Persistent notifications won't get such events for programmatic closes. | 187 // Persistent notifications won't get such events for programmatic closes. |
| 187 if (m_type == Type::NonPersistent) { | 188 if (m_type == Type::NonPersistent) { |
| 188 getExecutionContext()->postTask( | 189 getExecutionContext()->postTask( |
| 189 BLINK_FROM_HERE, createSameThreadTask(&Notification::dispatchCloseEvent, | 190 TaskType::UserInteraction, BLINK_FROM_HERE, |
| 190 wrapPersistent(this))); | 191 createSameThreadTask(&Notification::dispatchCloseEvent, |
| 192 wrapPersistent(this))); |
| 191 m_state = State::Closing; | 193 m_state = State::Closing; |
| 192 | 194 |
| 193 notificationManager()->close(this); | 195 notificationManager()->close(this); |
| 194 return; | 196 return; |
| 195 } | 197 } |
| 196 | 198 |
| 197 m_state = State::Closed; | 199 m_state = State::Closed; |
| 198 | 200 |
| 199 SecurityOrigin* origin = getExecutionContext()->getSecurityOrigin(); | 201 SecurityOrigin* origin = getExecutionContext()->getSecurityOrigin(); |
| 200 DCHECK(origin); | 202 DCHECK(origin); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 } | 401 } |
| 400 | 402 |
| 401 DEFINE_TRACE(Notification) { | 403 DEFINE_TRACE(Notification) { |
| 402 visitor->trace(m_prepareShowMethodRunner); | 404 visitor->trace(m_prepareShowMethodRunner); |
| 403 visitor->trace(m_loader); | 405 visitor->trace(m_loader); |
| 404 EventTargetWithInlineData::trace(visitor); | 406 EventTargetWithInlineData::trace(visitor); |
| 405 SuspendableObject::trace(visitor); | 407 SuspendableObject::trace(visitor); |
| 406 } | 408 } |
| 407 | 409 |
| 408 } // namespace blink | 410 } // namespace blink |
| OLD | NEW |