OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebNFCClient_h |
| 6 #define WebNFCClient_h |
| 7 |
| 8 #include "public/platform/WebCallbacks.h" |
| 9 #include "public/platform/WebPassOwnPtr.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 enum class WebNFCError; |
| 14 struct WebNFCMessage; |
| 15 class WebNFCObserver; |
| 16 struct WebNFCPushOptions; |
| 17 enum class WebNFCPushTarget; |
| 18 struct WebNFCWatchOptions; |
| 19 |
| 20 // Success and failure callbacks for push, cancelPush, cancelWatch and cancelAll
Watches methods. |
| 21 using WebNFCCallbacks = WebCallbacks<void, const WebNFCError&>; |
| 22 |
| 23 // Success and failure callbacks for watch method. |
| 24 using WebNFCWatchOptionsCallbacks = WebCallbacks<long, const WebNFCError&>; |
| 25 |
| 26 class WebNFCClient { |
| 27 public: |
| 28 virtual ~WebNFCClient() { } |
| 29 |
| 30 // Sets observer to the client so it can notify the observer about |
| 31 // triggered NFC watch events. |
| 32 virtual void setObserver(WebNFCObserver*) = 0; |
| 33 |
| 34 // NFC interface methods: |
| 35 |
| 36 // See https://w3c.github.io/web-nfc/#the-push-method |
| 37 // WebNFCCallbacks ownership is transfered to the client. |
| 38 virtual void push(const WebNFCMessage&, const WebNFCPushOptions&, WebNFCCall
backs*) = 0; |
| 39 |
| 40 // See https://w3c.github.io/web-nfc/#cancelPush |
| 41 // WebNFCCallbacks ownership is transfered to the client. |
| 42 virtual void cancelPush(const WebNFCPushTarget&, WebNFCCallbacks*) = 0; |
| 43 |
| 44 // See https://w3c.github.io/web-nfc/#the-watch-method |
| 45 // WebNFCWatchOptionsCallbacks ownership is transfered to the client. |
| 46 virtual void watch(const WebNFCWatchOptions&, WebNFCWatchOptionsCallbacks*)
= 0; |
| 47 |
| 48 // See https://w3c.github.io/web-nfc/#the-cancelwatch-method |
| 49 // WebNFCCallbacks ownership is transfered to the client. |
| 50 virtual void cancelWatch(long id, WebNFCCallbacks*) = 0; |
| 51 virtual void cancelAllWatches(WebNFCCallbacks*) = 0; |
| 52 |
| 53 // Methods that are required to implement suspended state. |
| 54 // See https://w3c.github.io/web-nfc/#nfc-suspended |
| 55 virtual void suspendNFCOperations() = 0; |
| 56 virtual void resumeNFCOperations() = 0; |
| 57 }; |
| 58 |
| 59 } // namespace blink |
| 60 |
| 61 #endif // WebNFCClient_h |
OLD | NEW |