| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 { | 46 { |
| 47 RefPtr<NotificationCenter> notificationCenter(adoptRef(new NotificationCente
r(context, client))); | 47 RefPtr<NotificationCenter> notificationCenter(adoptRef(new NotificationCente
r(context, client))); |
| 48 notificationCenter->suspendIfNeeded(); | 48 notificationCenter->suspendIfNeeded(); |
| 49 return notificationCenter.release(); | 49 return notificationCenter.release(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 NotificationCenter::NotificationCenter(ScriptExecutionContext* context, Notifica
tionClient* client) | 52 NotificationCenter::NotificationCenter(ScriptExecutionContext* context, Notifica
tionClient* client) |
| 53 : ActiveDOMObject(context) | 53 : ActiveDOMObject(context) |
| 54 , m_client(client) | 54 , m_client(client) |
| 55 { | 55 { |
| 56 ScriptWrappable::init(this); |
| 56 } | 57 } |
| 57 | 58 |
| 58 #if ENABLE(LEGACY_NOTIFICATIONS) | 59 #if ENABLE(LEGACY_NOTIFICATIONS) |
| 59 int NotificationCenter::checkPermission() | 60 int NotificationCenter::checkPermission() |
| 60 { | 61 { |
| 61 if (!client() || !scriptExecutionContext()) | 62 if (!client() || !scriptExecutionContext()) |
| 62 return NotificationClient::PermissionDenied; | 63 return NotificationClient::PermissionDenied; |
| 63 | 64 |
| 64 switch (scriptExecutionContext()->securityOrigin()->canShowNotifications())
{ | 65 switch (scriptExecutionContext()->securityOrigin()->canShowNotifications())
{ |
| 65 case SecurityOrigin::AlwaysAllow: | 66 case SecurityOrigin::AlwaysAllow: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void NotificationCenter::NotificationRequestCallback::timerFired(Timer<Notificat
ionCenter::NotificationRequestCallback>*) | 133 void NotificationCenter::NotificationRequestCallback::timerFired(Timer<Notificat
ionCenter::NotificationRequestCallback>*) |
| 133 { | 134 { |
| 134 if (m_callback) | 135 if (m_callback) |
| 135 m_callback->handleEvent(); | 136 m_callback->handleEvent(); |
| 136 m_notificationCenter->requestTimedOut(this); | 137 m_notificationCenter->requestTimedOut(this); |
| 137 } | 138 } |
| 138 | 139 |
| 139 } // namespace WebCore | 140 } // namespace WebCore |
| 140 | 141 |
| 141 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) | 142 #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) |
| OLD | NEW |