| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 exceptionState.throwTypeError("Illegal constructor."); | 77 exceptionState.throwTypeError("Illegal constructor."); |
| 78 return nullptr; | 78 return nullptr; |
| 79 } | 79 } |
| 80 | 80 |
| 81 if (!options.actions().isEmpty()) { | 81 if (!options.actions().isEmpty()) { |
| 82 exceptionState.throwTypeError("Actions are only supported for persistent
notifications shown using ServiceWorkerRegistration.showNotification()."); | 82 exceptionState.throwTypeError("Actions are only supported for persistent
notifications shown using ServiceWorkerRegistration.showNotification()."); |
| 83 return nullptr; | 83 return nullptr; |
| 84 } | 84 } |
| 85 | 85 |
| 86 String insecureOriginMessage; | 86 String insecureOriginMessage; |
| 87 UseCounter::Feature feature = context->isSecureContext(insecureOriginMessage
) | 87 if (context->isSecureContext(insecureOriginMessage)) { |
| 88 ? UseCounter::NotificationSecureOrigin | 88 UseCounter::count(context, UseCounter::NotificationSecureOrigin); |
| 89 : UseCounter::NotificationInsecureOrigin; | 89 if (context->isDocument()) |
| 90 | 90 UseCounter::countCrossOriginIframe(*toDocument(context), UseCounter
::NotificationAPISecureOriginIframe); |
| 91 UseCounter::count(context, feature); | 91 } else { |
| 92 UseCounter::count(context, UseCounter::NotificationInsecureOrigin); |
| 93 if (context->isDocument()) |
| 94 UseCounter::countCrossOriginIframe(*toDocument(context), UseCounter
::NotificationAPIInsecureOriginIframe); |
| 95 } |
| 92 | 96 |
| 93 WebNotificationData data = createWebNotificationData(context, title, options
, exceptionState); | 97 WebNotificationData data = createWebNotificationData(context, title, options
, exceptionState); |
| 94 if (exceptionState.hadException()) | 98 if (exceptionState.hadException()) |
| 95 return nullptr; | 99 return nullptr; |
| 96 | 100 |
| 97 Notification* notification = new Notification(context, data); | 101 Notification* notification = new Notification(context, data); |
| 98 notification->scheduleShow(); | 102 notification->scheduleShow(); |
| 99 notification->suspendIfNeeded(); | 103 notification->suspendIfNeeded(); |
| 100 | 104 |
| 101 return notification; | 105 return notification; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 367 } |
| 364 | 368 |
| 365 DEFINE_TRACE(Notification) | 369 DEFINE_TRACE(Notification) |
| 366 { | 370 { |
| 367 visitor->trace(m_asyncRunner); | 371 visitor->trace(m_asyncRunner); |
| 368 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); | 372 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); |
| 369 ActiveDOMObject::trace(visitor); | 373 ActiveDOMObject::trace(visitor); |
| 370 } | 374 } |
| 371 | 375 |
| 372 } // namespace blink | 376 } // namespace blink |
| OLD | NEW |