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/StringOrArrayBufferOrNFCMessage.h" | 10 #include "bindings/modules/v8/StringOrArrayBufferOrNFCMessage.h" |
11 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
12 #include "core/page/PageVisibilityObserver.h" | 12 #include "core/page/PageVisibilityObserver.h" |
13 #include "device/nfc/nfc.mojom-blink.h" | 13 #include "device/nfc/nfc.mojom-blink.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class MessageCallback; | 18 class MessageCallback; |
19 class NFCError; | 19 class NFCError; |
20 class NFCPushOptions; | 20 class NFCPushOptions; |
21 using NFCPushMessage = StringOrArrayBufferOrNFCMessage; | 21 using NFCPushMessage = StringOrArrayBufferOrNFCMessage; |
22 class NFCWatchOptions; | 22 class NFCWatchOptions; |
23 | 23 |
24 class NFC final | 24 class NFC final |
25 : public GarbageCollectedFinalized<NFC> | 25 : public GarbageCollectedFinalized<NFC> |
26 , public ScriptWrappable | 26 , public ScriptWrappable |
27 , public PageVisibilityObserver | 27 , public PageVisibilityObserver |
28 , public ContextLifecycleObserver | 28 , public ContextLifecycleObserver |
29 , public device::nfc::blink::NFCClient { | 29 , public device::nfc::mojom::blink::NFCClient { |
30 DEFINE_WRAPPERTYPEINFO(); | 30 DEFINE_WRAPPERTYPEINFO(); |
31 USING_GARBAGE_COLLECTED_MIXIN(NFC); | 31 USING_GARBAGE_COLLECTED_MIXIN(NFC); |
32 USING_PRE_FINALIZER(NFC, dispose); | 32 USING_PRE_FINALIZER(NFC, dispose); |
33 | 33 |
34 public: | 34 public: |
35 static NFC* create(LocalFrame*); | 35 static NFC* create(LocalFrame*); |
36 | 36 |
37 virtual ~NFC(); | 37 virtual ~NFC(); |
38 | 38 |
39 void dispose(); | 39 void dispose(); |
(...skipping 16 matching lines...) Expand all Loading... |
56 // Cancels all watch operations. | 56 // Cancels all watch operations. |
57 ScriptPromise cancelWatch(ScriptState*); | 57 ScriptPromise cancelWatch(ScriptState*); |
58 | 58 |
59 // Implementation of PageVisibilityObserver. | 59 // Implementation of PageVisibilityObserver. |
60 void pageVisibilityChanged() override; | 60 void pageVisibilityChanged() override; |
61 | 61 |
62 // Interface required by garbage collection. | 62 // Interface required by garbage collection. |
63 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
64 | 64 |
65 private: | 65 private: |
66 void OnRequestCompleted(ScriptPromiseResolver*, device::nfc::blink::NFCError
Ptr); | 66 void OnRequestCompleted(ScriptPromiseResolver*, device::nfc::mojom::blink::N
FCErrorPtr); |
67 void OnConnectionError(); | 67 void OnConnectionError(); |
68 | 68 |
69 // device::nfc::blink::NFCClient implementation. | 69 // device::nfc::mojom::blink::NFCClient implementation. |
70 void OnWatch(mojo::WTFArray<uint32_t> ids, device::nfc::blink::NFCMessagePtr
) override; | 70 void OnWatch(mojo::WTFArray<uint32_t> ids, device::nfc::mojom::blink::NFCMes
sagePtr) override; |
71 | 71 |
72 private: | 72 private: |
73 explicit NFC(LocalFrame*); | 73 explicit NFC(LocalFrame*); |
74 device::nfc::blink::NFCPtr m_nfc; | 74 device::nfc::mojom::blink::NFCPtr m_nfc; |
75 mojo::Binding<device::nfc::blink::NFCClient> m_client; | 75 mojo::Binding<device::nfc::mojom::blink::NFCClient> m_client; |
76 HeapHashSet<Member<ScriptPromiseResolver>> m_requests; | 76 HeapHashSet<Member<ScriptPromiseResolver>> m_requests; |
77 }; | 77 }; |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
80 | 80 |
81 #endif // NFC_h | 81 #endif // NFC_h |
OLD | NEW |