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 26 matching lines...) Expand all Loading... |
37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
38 #include "core/dom/ExecutionContext.h" | 38 #include "core/dom/ExecutionContext.h" |
39 #include "core/dom/ExecutionContextTask.h" | 39 #include "core/dom/ExecutionContextTask.h" |
40 #include "core/dom/ScopedWindowFocusAllowedIndicator.h" | 40 #include "core/dom/ScopedWindowFocusAllowedIndicator.h" |
41 #include "core/events/Event.h" | 41 #include "core/events/Event.h" |
42 #include "core/frame/UseCounter.h" | 42 #include "core/frame/UseCounter.h" |
43 #include "modules/notifications/NotificationAction.h" | 43 #include "modules/notifications/NotificationAction.h" |
44 #include "modules/notifications/NotificationData.h" | 44 #include "modules/notifications/NotificationData.h" |
45 #include "modules/notifications/NotificationManager.h" | 45 #include "modules/notifications/NotificationManager.h" |
46 #include "modules/notifications/NotificationOptions.h" | 46 #include "modules/notifications/NotificationOptions.h" |
47 #include "modules/notifications/NotificationPermissionClient.h" | |
48 #include "modules/notifications/NotificationResourcesLoader.h" | 47 #include "modules/notifications/NotificationResourcesLoader.h" |
49 #include "platform/RuntimeEnabledFeatures.h" | 48 #include "platform/RuntimeEnabledFeatures.h" |
50 #include "platform/UserGestureIndicator.h" | 49 #include "platform/UserGestureIndicator.h" |
51 #include "public/platform/Platform.h" | 50 #include "public/platform/Platform.h" |
52 #include "public/platform/WebSecurityOrigin.h" | 51 #include "public/platform/WebSecurityOrigin.h" |
53 #include "public/platform/WebString.h" | |
54 #include "public/platform/modules/notifications/WebNotificationAction.h" | 52 #include "public/platform/modules/notifications/WebNotificationAction.h" |
55 #include "public/platform/modules/notifications/WebNotificationConstants.h" | 53 #include "public/platform/modules/notifications/WebNotificationConstants.h" |
56 #include "public/platform/modules/notifications/WebNotificationManager.h" | 54 #include "public/platform/modules/notifications/WebNotificationManager.h" |
57 #include "public/platform/modules/permissions/permission_status.mojom-blink.h" | |
58 #include "wtf/Assertions.h" | 55 #include "wtf/Assertions.h" |
59 #include "wtf/Functional.h" | 56 #include "wtf/Functional.h" |
60 | 57 |
61 namespace blink { | 58 namespace blink { |
62 namespace { | 59 namespace { |
63 | 60 |
64 const int64_t kInvalidPersistentId = -1; | 61 const int64_t kInvalidPersistentId = -1; |
65 | 62 |
66 WebNotificationManager* notificationManager() | 63 WebNotificationManager* notificationManager() |
67 { | 64 { |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return "denied"; | 344 return "denied"; |
348 } | 345 } |
349 | 346 |
350 String Notification::permission(ExecutionContext* context) | 347 String Notification::permission(ExecutionContext* context) |
351 { | 348 { |
352 return permissionString(NotificationManager::from(context)->permissionStatus
()); | 349 return permissionString(NotificationManager::from(context)->permissionStatus
()); |
353 } | 350 } |
354 | 351 |
355 ScriptPromise Notification::requestPermission(ScriptState* scriptState, Notifica
tionPermissionCallback* deprecatedCallback) | 352 ScriptPromise Notification::requestPermission(ScriptState* scriptState, Notifica
tionPermissionCallback* deprecatedCallback) |
356 { | 353 { |
357 ExecutionContext* context = scriptState->getExecutionContext(); | 354 return NotificationManager::from(scriptState->getExecutionContext())->reques
tPermission(scriptState, deprecatedCallback); |
358 if (NotificationPermissionClient* permissionClient = NotificationPermissionC
lient::from(context)) | |
359 return permissionClient->requestPermission(scriptState, deprecatedCallba
ck); | |
360 | |
361 // The context has been detached. Return a promise that will never settle. | |
362 DCHECK(context->activeDOMObjectsAreStopped()); | |
363 | |
364 return ScriptPromise(); | |
365 } | 355 } |
366 | 356 |
367 size_t Notification::maxActions() | 357 size_t Notification::maxActions() |
368 { | 358 { |
369 return kWebNotificationMaxActions; | 359 return kWebNotificationMaxActions; |
370 } | 360 } |
371 | 361 |
372 DispatchEventResult Notification::dispatchEventInternal(Event* event) | 362 DispatchEventResult Notification::dispatchEventInternal(Event* event) |
373 { | 363 { |
374 DCHECK(getExecutionContext()->isContextThread()); | 364 DCHECK(getExecutionContext()->isContextThread()); |
(...skipping 24 matching lines...) Expand all Loading... |
399 | 389 |
400 DEFINE_TRACE(Notification) | 390 DEFINE_TRACE(Notification) |
401 { | 391 { |
402 visitor->trace(m_prepareShowMethodRunner); | 392 visitor->trace(m_prepareShowMethodRunner); |
403 visitor->trace(m_loader); | 393 visitor->trace(m_loader); |
404 EventTargetWithInlineData::trace(visitor); | 394 EventTargetWithInlineData::trace(visitor); |
405 ActiveDOMObject::trace(visitor); | 395 ActiveDOMObject::trace(visitor); |
406 } | 396 } |
407 | 397 |
408 } // namespace blink | 398 } // namespace blink |
OLD | NEW |