OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #include "device/nfc/nfc_impl.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 9 |
| 10 namespace device { |
| 11 |
| 12 namespace { |
| 13 |
| 14 class NFCDefaultImpl : public NFC { |
| 15 public: |
| 16 void SetClient(NFCClientPtr client) override { NOTIMPLEMENTED(); } |
| 17 |
| 18 void Push(NFCMessagePtr message, |
| 19 NFCPushOptionsPtr options, |
| 20 const PushCallback& callback) override { |
| 21 callback.Run(NotSupported()); |
| 22 NOTIMPLEMENTED(); |
| 23 } |
| 24 |
| 25 void CancelPush(NFCPushTarget target, |
| 26 const CancelPushCallback& callback) override { |
| 27 callback.Run(NotSupported()); |
| 28 NOTIMPLEMENTED(); |
| 29 } |
| 30 |
| 31 void Watch(NFCWatchOptionsPtr options, |
| 32 const WatchCallback& callback) override { |
| 33 callback.Run(0, NotSupported()); |
| 34 NOTIMPLEMENTED(); |
| 35 } |
| 36 |
| 37 void CancelWatch(uint32_t id, const CancelWatchCallback& callback) override { |
| 38 callback.Run(NotSupported()); |
| 39 NOTIMPLEMENTED(); |
| 40 } |
| 41 |
| 42 void CancelAllWatches(const CancelAllWatchesCallback& callback) override { |
| 43 callback.Run(NotSupported()); |
| 44 NOTIMPLEMENTED(); |
| 45 } |
| 46 |
| 47 void SuspendNFCOperations() override { NOTIMPLEMENTED(); } |
| 48 void ResumeNFCOperations() override { NOTIMPLEMENTED(); } |
| 49 |
| 50 private: |
| 51 friend NFCImpl; |
| 52 |
| 53 NFCErrorPtr NotSupported() { |
| 54 NFCErrorPtr error = NFCError::New(); |
| 55 error->error_type = NFCErrorType::NOT_SUPPORTED; |
| 56 return error; |
| 57 } |
| 58 |
| 59 explicit NFCDefaultImpl(mojo::InterfaceRequest<NFC> request) |
| 60 : binding_(this, std::move(request)) {} |
| 61 ~NFCDefaultImpl() override {} |
| 62 |
| 63 mojo::StrongBinding<NFC> binding_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(NFCDefaultImpl); |
| 66 }; |
| 67 |
| 68 } // namespace |
| 69 |
| 70 // static |
| 71 void NFCImpl::Create(mojo::InterfaceRequest<NFC> request) { |
| 72 new NFCDefaultImpl(std::move(request)); |
| 73 } |
| 74 |
| 75 } // namespace device |
OLD | NEW |