OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/push_messaging/NavigatorPushManager.h" |
| 7 |
| 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/Navigator.h" |
| 10 #include "modules/push_messaging/PushManager.h" |
| 11 |
| 12 namespace WebCore { |
| 13 |
| 14 NavigatorPushManager::NavigatorPushManager() |
| 15 { |
| 16 } |
| 17 |
| 18 NavigatorPushManager::~NavigatorPushManager() |
| 19 { |
| 20 } |
| 21 |
| 22 const char* NavigatorPushManager::supplementName() |
| 23 { |
| 24 return "NavigatorPushManager"; |
| 25 } |
| 26 |
| 27 NavigatorPushManager& NavigatorPushManager::from(Navigator& navigator) |
| 28 { |
| 29 NavigatorPushManager* supplement = static_cast<NavigatorPushManager*>(WillBe
HeapSupplement<Navigator>::from(navigator, supplementName())); |
| 30 if (!supplement) { |
| 31 supplement = new NavigatorPushManager(); |
| 32 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 33 } |
| 34 return *supplement; |
| 35 } |
| 36 |
| 37 PushManager* NavigatorPushManager::push(Navigator& navigator) |
| 38 { |
| 39 return NavigatorPushManager::from(navigator).pushManager(); |
| 40 } |
| 41 |
| 42 PushManager* NavigatorPushManager::pushManager() |
| 43 { |
| 44 if (!m_pushManager) |
| 45 m_pushManager = PushManager::create(); |
| 46 return m_pushManager.get(); |
| 47 } |
| 48 |
| 49 void NavigatorPushManager::trace(Visitor* visitor) |
| 50 { |
| 51 visitor->trace(m_pushManager); |
| 52 } |
| 53 |
| 54 } // namespace WebCore |
OLD | NEW |