| 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/frame/Navigator.h" | |
| 9 #include "modules/push_messaging/PushManager.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 NavigatorPushManager::NavigatorPushManager() | |
| 14 { | |
| 15 } | |
| 16 | |
| 17 NavigatorPushManager::~NavigatorPushManager() | |
| 18 { | |
| 19 } | |
| 20 | |
| 21 const char* NavigatorPushManager::supplementName() | |
| 22 { | |
| 23 return "NavigatorPushManager"; | |
| 24 } | |
| 25 | |
| 26 NavigatorPushManager& NavigatorPushManager::from(Navigator& navigator) | |
| 27 { | |
| 28 NavigatorPushManager* supplement = static_cast<NavigatorPushManager*>(WillBe
HeapSupplement<Navigator>::from(navigator, supplementName())); | |
| 29 if (!supplement) { | |
| 30 supplement = new NavigatorPushManager(); | |
| 31 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | |
| 32 } | |
| 33 return *supplement; | |
| 34 } | |
| 35 | |
| 36 PushManager* NavigatorPushManager::push(Navigator& navigator) | |
| 37 { | |
| 38 return NavigatorPushManager::from(navigator).pushManager(); | |
| 39 } | |
| 40 | |
| 41 PushManager* NavigatorPushManager::pushManager() | |
| 42 { | |
| 43 if (!m_pushManager) | |
| 44 m_pushManager = PushManager::create(); | |
| 45 return m_pushManager.get(); | |
| 46 } | |
| 47 | |
| 48 void NavigatorPushManager::trace(Visitor* visitor) | |
| 49 { | |
| 50 visitor->trace(m_pushManager); | |
| 51 WillBeHeapSupplement<Navigator>::trace(visitor); | |
| 52 } | |
| 53 | |
| 54 } // namespace blink | |
| OLD | NEW |