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