| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "modules/notifications/NotificationData.h" | 43 #include "modules/notifications/NotificationData.h" |
| 44 #include "modules/notifications/NotificationOptions.h" | 44 #include "modules/notifications/NotificationOptions.h" |
| 45 #include "modules/notifications/NotificationPermissionClient.h" | 45 #include "modules/notifications/NotificationPermissionClient.h" |
| 46 #include "modules/notifications/NotificationResourcesLoader.h" | 46 #include "modules/notifications/NotificationResourcesLoader.h" |
| 47 #include "platform/RuntimeEnabledFeatures.h" | 47 #include "platform/RuntimeEnabledFeatures.h" |
| 48 #include "platform/UserGestureIndicator.h" | 48 #include "platform/UserGestureIndicator.h" |
| 49 #include "public/platform/Platform.h" | 49 #include "public/platform/Platform.h" |
| 50 #include "public/platform/WebSecurityOrigin.h" | 50 #include "public/platform/WebSecurityOrigin.h" |
| 51 #include "public/platform/WebString.h" | 51 #include "public/platform/WebString.h" |
| 52 #include "public/platform/modules/notifications/WebNotificationAction.h" | 52 #include "public/platform/modules/notifications/WebNotificationAction.h" |
| 53 #include "public/platform/modules/notifications/WebNotificationConstants.h" |
| 53 #include "public/platform/modules/notifications/WebNotificationManager.h" | 54 #include "public/platform/modules/notifications/WebNotificationManager.h" |
| 54 #include "wtf/Functional.h" | 55 #include "wtf/Functional.h" |
| 55 | 56 |
| 56 namespace blink { | 57 namespace blink { |
| 57 namespace { | 58 namespace { |
| 58 | 59 |
| 59 const int64_t kInvalidPersistentId = -1; | 60 const int64_t kInvalidPersistentId = -1; |
| 60 | 61 |
| 61 WebNotificationManager* notificationManager() | 62 WebNotificationManager* notificationManager() |
| 62 { | 63 { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 if (NotificationPermissionClient* permissionClient = NotificationPermissionC
lient::from(context)) | 367 if (NotificationPermissionClient* permissionClient = NotificationPermissionC
lient::from(context)) |
| 367 return permissionClient->requestPermission(scriptState, deprecatedCallba
ck); | 368 return permissionClient->requestPermission(scriptState, deprecatedCallba
ck); |
| 368 | 369 |
| 369 // The context has been detached. Return a promise that will never settle. | 370 // The context has been detached. Return a promise that will never settle. |
| 370 ASSERT(context->activeDOMObjectsAreStopped()); | 371 ASSERT(context->activeDOMObjectsAreStopped()); |
| 371 return ScriptPromise(); | 372 return ScriptPromise(); |
| 372 } | 373 } |
| 373 | 374 |
| 374 size_t Notification::maxActions() | 375 size_t Notification::maxActions() |
| 375 { | 376 { |
| 376 // Returns a fixed number for unit tests, which run without the availability
of the Platform object. | 377 return kWebNotificationMaxActions; |
| 377 if (!notificationManager()) | |
| 378 return 2; | |
| 379 | |
| 380 return notificationManager()->maxActions(); | |
| 381 } | 378 } |
| 382 | 379 |
| 383 DispatchEventResult Notification::dispatchEventInternal(Event* event) | 380 DispatchEventResult Notification::dispatchEventInternal(Event* event) |
| 384 { | 381 { |
| 385 ASSERT(getExecutionContext()->isContextThread()); | 382 ASSERT(getExecutionContext()->isContextThread()); |
| 386 return EventTarget::dispatchEventInternal(event); | 383 return EventTarget::dispatchEventInternal(event); |
| 387 } | 384 } |
| 388 | 385 |
| 389 const AtomicString& Notification::interfaceName() const | 386 const AtomicString& Notification::interfaceName() const |
| 390 { | 387 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 410 | 407 |
| 411 DEFINE_TRACE(Notification) | 408 DEFINE_TRACE(Notification) |
| 412 { | 409 { |
| 413 visitor->trace(m_prepareShowMethodRunner); | 410 visitor->trace(m_prepareShowMethodRunner); |
| 414 visitor->trace(m_loader); | 411 visitor->trace(m_loader); |
| 415 EventTargetWithInlineData::trace(visitor); | 412 EventTargetWithInlineData::trace(visitor); |
| 416 ActiveDOMObject::trace(visitor); | 413 ActiveDOMObject::trace(visitor); |
| 417 } | 414 } |
| 418 | 415 |
| 419 } // namespace blink | 416 } // namespace blink |
| OLD | NEW |