| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 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/navigatorconnect/NavigatorServices.h" |
| 7 |
| 8 #include "core/frame/Navigator.h" |
| 9 #include "modules/navigatorconnect/ServicePortCollection.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 NavigatorServices::~NavigatorServices() |
| 14 { |
| 15 } |
| 16 |
| 17 NavigatorServices& NavigatorServices::from(Navigator& navigator) |
| 18 { |
| 19 NavigatorServices* supplement = static_cast<NavigatorServices*>(HeapSuppleme
nt<Navigator>::from(navigator, supplementName())); |
| 20 if (!supplement) { |
| 21 supplement = new NavigatorServices(); |
| 22 provideTo(navigator, supplementName(), supplement); |
| 23 } |
| 24 return *supplement; |
| 25 } |
| 26 |
| 27 ServicePortCollection* NavigatorServices::services(ExecutionContext* context, Na
vigator& navigator) |
| 28 { |
| 29 return NavigatorServices::from(navigator).services(context); |
| 30 } |
| 31 |
| 32 ServicePortCollection* NavigatorServices::services(ExecutionContext* context) |
| 33 { |
| 34 if (!m_services) |
| 35 m_services = ServicePortCollection::create(context); |
| 36 return m_services.get(); |
| 37 } |
| 38 |
| 39 DEFINE_TRACE(NavigatorServices) |
| 40 { |
| 41 visitor->trace(m_services); |
| 42 HeapSupplement<Navigator>::trace(visitor); |
| 43 } |
| 44 |
| 45 NavigatorServices::NavigatorServices() |
| 46 { |
| 47 } |
| 48 |
| 49 const char* NavigatorServices::supplementName() |
| 50 { |
| 51 return "NavigatorServices"; |
| 52 } |
| 53 |
| 54 } // namespace blink |
| OLD | NEW |