| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "modules/notifications/WorkerGlobalScopeNotifications.h" | 29 #include "modules/notifications/WorkerGlobalScopeNotifications.h" |
| 30 | 30 |
| 31 #if ENABLE(LEGACY_NOTIFICATIONS) | 31 #if ENABLE(LEGACY_NOTIFICATIONS) |
| 32 | 32 |
| 33 #include "core/workers/WorkerGlobalScope.h" | 33 #include "core/workers/WorkerGlobalScope.h" |
| 34 #include "core/workers/WorkerThread.h" | 34 #include "core/workers/WorkerThread.h" |
| 35 #include "modules/notifications/NotificationCenter.h" | 35 #include "modules/notifications/NotificationCenter.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 WorkerGlobalScopeNotifications::WorkerGlobalScopeNotifications(WorkerGlobalScope
* context) | 39 WorkerGlobalScopeNotifications::WorkerGlobalScopeNotifications(WorkerGlobalScope
& context) |
| 40 : m_context(context) | 40 : m_context(context) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 WorkerGlobalScopeNotifications::~WorkerGlobalScopeNotifications() | 44 WorkerGlobalScopeNotifications::~WorkerGlobalScopeNotifications() |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 const char* WorkerGlobalScopeNotifications::supplementName() | 48 const char* WorkerGlobalScopeNotifications::supplementName() |
| 49 { | 49 { |
| 50 return "WorkerGlobalScopeNotifications"; | 50 return "WorkerGlobalScopeNotifications"; |
| 51 } | 51 } |
| 52 | 52 |
| 53 WorkerGlobalScopeNotifications* WorkerGlobalScopeNotifications::from(WorkerGloba
lScope* context) | 53 WorkerGlobalScopeNotifications& WorkerGlobalScopeNotifications::from(WorkerGloba
lScope& context) |
| 54 { | 54 { |
| 55 WorkerGlobalScopeNotifications* supplement = static_cast<WorkerGlobalScopeNo
tifications*>(WorkerSupplement::from(context, supplementName())); | 55 WorkerGlobalScopeNotifications* supplement = static_cast<WorkerGlobalScopeNo
tifications*>(WorkerSupplement::from(context, supplementName())); |
| 56 if (!supplement) { | 56 if (!supplement) { |
| 57 supplement = new WorkerGlobalScopeNotifications(context); | 57 supplement = new WorkerGlobalScopeNotifications(context); |
| 58 WorkerSupplement::provideTo(context, supplementName(), adoptPtr(suppleme
nt)); | 58 WorkerSupplement::provideTo(context, supplementName(), adoptPtr(suppleme
nt)); |
| 59 } | 59 } |
| 60 return supplement; | 60 return *supplement; |
| 61 } | 61 } |
| 62 | 62 |
| 63 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications(WorkerGl
obalScope* context) | 63 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications(WorkerGl
obalScope& context) |
| 64 { | 64 { |
| 65 return WorkerGlobalScopeNotifications::from(context)->webkitNotifications(); | 65 return WorkerGlobalScopeNotifications::from(context).webkitNotifications(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications() | 68 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications() |
| 69 { | 69 { |
| 70 if (!m_notificationCenter) | 70 if (!m_notificationCenter) |
| 71 m_notificationCenter = NotificationCenter::create(m_context, m_context->
thread()->getNotificationClient()); | 71 m_notificationCenter = NotificationCenter::create(&m_context, m_context.
thread()->getNotificationClient()); |
| 72 return m_notificationCenter.get(); | 72 return m_notificationCenter.get(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace WebCore | 75 } // namespace WebCore |
| 76 | 76 |
| 77 #endif // ENABLE(LEGACY_NOTIFICATIONS) | 77 #endif // ENABLE(LEGACY_NOTIFICATIONS) |
| OLD | NEW |