Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: Source/modules/push_messaging/NavigatorPushManager.cpp

Issue 783983003: Push API: move PushManager from Navigator to ServiceWorkerRegistration [switchover 6/6] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW
« no previous file with comments | « Source/modules/push_messaging/NavigatorPushManager.h ('k') | Source/modules/push_messaging/NavigatorPushManager.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698