| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/nfc/NavigatorNFC.h" | 6 #include "modules/nfc/NavigatorNFC.h" |
| 7 | 7 |
| 8 #include "core/frame/Navigator.h" | 8 #include "core/frame/Navigator.h" |
| 9 #include "modules/nfc/NFC.h" | 9 #include "modules/nfc/NFC.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 NavigatorNFC& NavigatorNFC::from(Navigator& navigator) | 22 NavigatorNFC& NavigatorNFC::from(Navigator& navigator) |
| 23 { | 23 { |
| 24 NavigatorNFC* supplement = static_cast<NavigatorNFC*>(HeapSupplement<Navigat
or>::from(navigator, supplementName())); | 24 NavigatorNFC* supplement = static_cast<NavigatorNFC*>(HeapSupplement<Navigat
or>::from(navigator, supplementName())); |
| 25 if (!supplement) { | 25 if (!supplement) { |
| 26 supplement = new NavigatorNFC(); | 26 supplement = new NavigatorNFC(); |
| 27 provideTo(navigator, supplementName(), supplement); | 27 provideTo(navigator, supplementName(), supplement); |
| 28 } | 28 } |
| 29 return *supplement; | 29 return *supplement; |
| 30 } | 30 } |
| 31 | 31 |
| 32 NFC* NavigatorNFC::nfc(ExecutionContext* context, Navigator& navigator) | 32 NFC* NavigatorNFC::nfc(Navigator& navigator) |
| 33 { | 33 { |
| 34 NavigatorNFC& self = NavigatorNFC::from(navigator); | 34 NavigatorNFC& self = NavigatorNFC::from(navigator); |
| 35 if (!self.m_nfc) { | 35 if (!self.m_nfc) { |
| 36 if (!navigator.frame()) | 36 if (!navigator.frame()) |
| 37 return nullptr; | 37 return nullptr; |
| 38 self.m_nfc = NFC::create(context, navigator.frame()); | 38 self.m_nfc = NFC::create(navigator.frame()); |
| 39 } | 39 } |
| 40 return self.m_nfc.get(); | 40 return self.m_nfc.get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 DEFINE_TRACE(NavigatorNFC) | 43 DEFINE_TRACE(NavigatorNFC) |
| 44 { | 44 { |
| 45 visitor->trace(m_nfc); | 45 visitor->trace(m_nfc); |
| 46 HeapSupplement<Navigator>::trace(visitor); | 46 HeapSupplement<Navigator>::trace(visitor); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace blink | 49 } // namespace blink |
| OLD | NEW |