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

Unified Diff: third_party/WebKit/Source/modules/nfc/NFC.h

Issue 1759373003: [webnfc] Implement nfc.watch in blink nfc module. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implement_nfc_push_in_android
Patch Set: Rebased to master and improved tests Created 4 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 side-by-side diff with in-line comments
Download patch
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 3a4165289dd4c8ade8a68007c0ea48ebf75b0c21..d9f98f23fa733f942defd631ab1693239bdf0d33 100644
--- a/third_party/WebKit/Source/modules/nfc/NFC.h
+++ b/third_party/WebKit/Source/modules/nfc/NFC.h
@@ -11,7 +11,9 @@
#include "core/dom/ContextLifecycleObserver.h"
#include "core/page/PageVisibilityObserver.h"
#include "device/nfc/nfc.mojom-blink.h"
+#include "modules/nfc/MessageCallback.h"
#include "mojo/public/cpp/bindings/binding.h"
+#include "wtf/HashMap.h"
namespace blink {
@@ -63,8 +65,13 @@ public:
DECLARE_VIRTUAL_TRACE();
private:
+ // Returns promise with DOMException if feature is not supported
+ // or when context is not secure. Otherwise, returns empty promise.
+ ScriptPromise RejectIfNotSupported(ScriptState*);
dcheng 2016/09/08 04:42:38 Nit: blink naming convention is still camelCaseWit
shalamov 2016/09/22 13:53:22 Done.
+
void OnRequestCompleted(ScriptPromiseResolver*, device::nfc::blink::NFCErrorPtr);
void OnConnectionError();
+ void OnWatchRegistered(MessageCallback*, ScriptPromiseResolver*, uint32_t id, device::nfc::blink::NFCErrorPtr);
// device::nfc::blink::NFCClient implementation.
void OnWatch(mojo::WTFArray<uint32_t> ids, device::nfc::blink::NFCMessagePtr) override;
@@ -74,6 +81,8 @@ private:
device::nfc::blink::NFCPtr m_nfc;
mojo::Binding<device::nfc::blink::NFCClient> m_client;
HeapHashSet<Member<ScriptPromiseResolver>> m_requests;
+ using WatchCallbacksMap = HeapHashMap<uint32_t, Member<MessageCallback>>;
+ WatchCallbacksMap m_callbacks;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698