Index: third_party/WebKit/Source/modules/nfc/NFC.h |
diff --git a/third_party/WebKit/Source/modules/nfc/NFC.h b/third_party/WebKit/Source/modules/nfc/NFC.h |
index 60c799562a2a4e22a0777a8cd55065ebbe7174ee..63211947124eb1f5e5520f37aaa6b78e40f7579f 100644 |
--- a/third_party/WebKit/Source/modules/nfc/NFC.h |
+++ b/third_party/WebKit/Source/modules/nfc/NFC.h |
@@ -11,7 +11,9 @@ |
#include "bindings/modules/v8/UnionTypesModules.h" |
#include "core/page/PageLifecycleObserver.h" |
#include "device/nfc/nfc.mojom-wtf.h" |
+#include "modules/nfc/MessageCallback.h" |
#include "mojo/public/cpp/bindings/binding.h" |
+#include "wtf/HashMap.h" |
namespace blink { |
@@ -19,6 +21,7 @@ class MessageCallback; |
class NFCError; |
class NFCPushOptions; |
using NFCPushMessage = StringOrArrayBufferOrNFCMessage; |
+class NFCWatchCallback; |
class NFCWatchOptions; |
class ServiceRegistry; |
@@ -58,15 +61,23 @@ public: |
DECLARE_VIRTUAL_TRACE(); |
private: |
+ friend class NFCWatchCallback; |
bool Initialize(ServiceRegistry*); |
+ |
+ // Returns promise with DOMException if feature is not supported |
+ // or when context is not secure. Otherwise, returns empty promise. |
+ ScriptPromise RejectIfNotSupported(ScriptState*); |
void OnError(); |
// device::wtf::NFCClient implementation |
void OnWatch(uint32_t id, device::wtf::NFCMessagePtr) override; |
+ void OnWatchRegistered(uint32_t id, MessageCallback*); |
private: |
explicit NFC(LocalFrame*); |
device::wtf::NFCPtr m_nfc; |
mojo::Binding<device::wtf::NFCClient> m_client; |
+ using WatchCallbacksMap = HeapHashMap<uint32_t, Member<MessageCallback>>; |
+ WatchCallbacksMap m_callbacks; |
}; |
} // namespace blink |