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

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

Issue 1439063002: [webnfc] NFC is not required to be ActiveDOMObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added myself to AUTHORS file Created 5 years, 1 month 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
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/nfc/NavigatorNFC.h ('k') | third_party/WebKit/Source/modules/nfc/NavigatorNFC.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698