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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return nullptr; | 73 return nullptr; |
74 } | 74 } |
75 | 75 |
76 // The Web Notification constructor may not be used in Service Worker contex
ts. | 76 // The Web Notification constructor may not be used in Service Worker contex
ts. |
77 if (context->isServiceWorkerGlobalScope()) { | 77 if (context->isServiceWorkerGlobalScope()) { |
78 exceptionState.throwTypeError("Illegal constructor."); | 78 exceptionState.throwTypeError("Illegal constructor."); |
79 return nullptr; | 79 return nullptr; |
80 } | 80 } |
81 | 81 |
82 String insecureOriginMessage; | 82 String insecureOriginMessage; |
83 UseCounter::Feature feature = context->isPrivilegedContext(insecureOriginMes
sage) | 83 UseCounter::Feature feature = context->isSecureContext(insecureOriginMessage
) |
84 ? UseCounter::NotificationSecureOrigin | 84 ? UseCounter::NotificationSecureOrigin |
85 : UseCounter::NotificationInsecureOrigin; | 85 : UseCounter::NotificationInsecureOrigin; |
86 | 86 |
87 UseCounter::count(context, feature); | 87 UseCounter::count(context, feature); |
88 | 88 |
89 WebNotificationData data = createWebNotificationData(context, title, options
, exceptionState); | 89 WebNotificationData data = createWebNotificationData(context, title, options
, exceptionState); |
90 if (exceptionState.hadException()) | 90 if (exceptionState.hadException()) |
91 return nullptr; | 91 return nullptr; |
92 | 92 |
93 Notification* notification = new Notification(context, data); | 93 Notification* notification = new Notification(context, data); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 return m_state == NotificationStateShowing || m_asyncRunner.isActive(); | 358 return m_state == NotificationStateShowing || m_asyncRunner.isActive(); |
359 } | 359 } |
360 | 360 |
361 DEFINE_TRACE(Notification) | 361 DEFINE_TRACE(Notification) |
362 { | 362 { |
363 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); | 363 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis
itor); |
364 ActiveDOMObject::trace(visitor); | 364 ActiveDOMObject::trace(visitor); |
365 } | 365 } |
366 | 366 |
367 } // namespace blink | 367 } // namespace blink |
OLD | NEW |