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 #ifndef NFC_h | 5 #ifndef NFC_h |
6 #define NFC_h | 6 #define NFC_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "bindings/modules/v8/UnionTypesModules.h" | |
10 #include "core/frame/LocalFrameLifecycleObserver.h" | 11 #include "core/frame/LocalFrameLifecycleObserver.h" |
11 #include "core/page/PageLifecycleObserver.h" | 12 #include "core/page/PageLifecycleObserver.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
16 class MessageCallback; | |
17 class NFCPushOptions; | |
18 using NFCPushMessage = StringOrArrayBufferOrNFCMessage; | |
19 class NFCWatchOptions; | |
20 | |
15 class NFC final | 21 class NFC final |
16 : public GarbageCollectedFinalized<NFC> | 22 : public GarbageCollectedFinalized<NFC> |
17 , public ScriptWrappable | 23 , public ScriptWrappable |
18 , public LocalFrameLifecycleObserver | 24 , public LocalFrameLifecycleObserver |
19 , public PageLifecycleObserver { | 25 , public PageLifecycleObserver { |
20 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NFC); | 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NFC); |
22 | 28 |
23 public: | 29 public: |
24 static NFC* create(LocalFrame*); | 30 static NFC* create(LocalFrame*); |
25 #if ENABLE(OILPAN) | 31 #if !ENABLE(OILPAN) |
sof
2015/11/19 13:13:13
looks fine this way wrt Oilpan.
| |
26 ~NFC(); | 32 ~NFC() override = default; |
27 #else | |
28 ~NFC() override; | |
29 #endif | 33 #endif |
30 | 34 |
31 // Get an adapter object providing NFC functionality. | 35 // Pushes NFCPushMessage asynchronously to NFC tag / peer. |
32 ScriptPromise requestAdapter(ScriptState*); | 36 ScriptPromise push(ScriptState*, const NFCPushMessage&, const NFCPushOptions &); |
37 | |
38 // Cancels ongoing push operation. | |
39 ScriptPromise cancelPush(ScriptState*, const String&); | |
40 | |
41 // Starts watching for NFC messages that match NFCWatchOptions criteria. | |
42 ScriptPromise watch(ScriptState*, MessageCallback*, const NFCWatchOptions&); | |
43 | |
44 // Cancels watch operation with id. | |
45 ScriptPromise cancelWatch(ScriptState*, long id); | |
46 | |
47 // Cancels all watch operations. | |
48 ScriptPromise cancelWatch(ScriptState*); | |
33 | 49 |
34 // Implementation of LocalFrameLifecycleObserver. | 50 // Implementation of LocalFrameLifecycleObserver. |
35 void willDetachFrameHost() override; | 51 void willDetachFrameHost() override; |
36 | 52 |
37 // Implementation of PageLifecycleObserver | 53 // Implementation of PageLifecycleObserver. |
38 void pageVisibilityChanged() override; | 54 void pageVisibilityChanged() override; |
39 | 55 |
40 // Interface required by garbage collection. | 56 // Interface required by garbage collection. |
41 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
42 | 58 |
43 private: | 59 private: |
44 NFC(LocalFrame*); | 60 NFC(LocalFrame*); |
45 }; | 61 }; |
46 | 62 |
47 } // namespace blink | 63 } // namespace blink |
48 | 64 |
49 #endif // NFC_h | 65 #endif // NFC_h |
OLD | NEW |