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

Side by Side Diff: Source/modules/nfc/NavigatorNFC.cpp

Issue 1291663004: [webnfc]: Step 1: Add NavigatorNfc, Nfc and Layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: d'stor ~NFC() override Created 5 years, 4 months 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
« no previous file with comments | « Source/modules/nfc/NavigatorNFC.h ('k') | Source/modules/nfc/NavigatorNFC.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/nfc/NavigatorNFC.h"
7
8 #include "core/frame/Navigator.h"
9 #include "modules/nfc/NFC.h"
10
11 namespace blink {
12
13 NavigatorNFC::NavigatorNFC()
14 {
15 }
16
17 const char* NavigatorNFC::supplementName()
18 {
19 return "NavigatorNFC";
20 }
21
22 NavigatorNFC& NavigatorNFC::from(Navigator& navigator)
23 {
24 NavigatorNFC* supplement = static_cast<NavigatorNFC*>(HeapSupplement<Navigat or>::from(navigator, supplementName()));
25 if (!supplement) {
26 supplement = new NavigatorNFC();
27 provideTo(navigator, supplementName(), supplement);
28 }
29 return *supplement;
30 }
31
32 NFC* NavigatorNFC::nfc(ExecutionContext* context, Navigator& navigator)
33 {
34 NavigatorNFC& self = NavigatorNFC::from(navigator);
35 if (!self.m_nfc) {
36 if (!navigator.frame())
37 return nullptr;
38 self.m_nfc = NFC::create(context, navigator.frame());
39 }
40 return self.m_nfc.get();
41 }
42
43 DEFINE_TRACE(NavigatorNFC)
44 {
45 visitor->trace(m_nfc);
46 HeapSupplement<Navigator>::trace(visitor);
47 }
48
49 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/nfc/NavigatorNFC.h ('k') | Source/modules/nfc/NavigatorNFC.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698