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

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: 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 = new Nfc(context, navigator.frame());
39 self.m_nfc->suspendIfNeeded();
haraken 2015/08/17 16:25:33 It would be better to create Nfc::create() and cal
riju_ 2015/08/18 11:36:15 Done.
40 }
41 return self.m_nfc.get();
42 }
43
44 DEFINE_TRACE(NavigatorNfc)
45 {
46 visitor->trace(m_nfc);
47 HeapSupplement<Navigator>::trace(visitor);
48 }
49
50 } // 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