| 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 WebNFCWatchOptions_h | |
| 6 #define WebNFCWatchOptions_h | |
| 7 | |
| 8 #include "public/platform/WebString.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 enum class WebNFCRecordType; | |
| 13 | |
| 14 // Enumeration that is mapped to NFCWatchMode as specified in IDL. | |
| 15 enum class WebNFCWatchMode { | |
| 16 WebNFCOnly, | |
| 17 Any, | |
| 18 ENUM_MAX_VALUE = Any | |
| 19 }; | |
| 20 | |
| 21 // Helper wrapper that is used to represent filter for all types of NFC records. | |
| 22 class WebNFCRecordTypeFilter final { | |
| 23 public: | |
| 24 WebNFCRecordTypeFilter() : m_matchAnyRecord(true) { } | |
| 25 explicit WebNFCRecordTypeFilter(const WebNFCRecordType& recordType) : | |
| 26 m_matchAnyRecord(false), m_recordType(recordType) { } | |
| 27 | |
| 28 bool matchAnyRecord() const { return m_matchAnyRecord; } | |
| 29 WebNFCRecordType recordType() const { return m_recordType; } | |
| 30 | |
| 31 private: | |
| 32 bool m_matchAnyRecord; | |
| 33 WebNFCRecordType m_recordType; | |
| 34 }; | |
| 35 | |
| 36 // Contains members of NFCWatchOptions dictionary as specified in the IDL. | |
| 37 struct WebNFCWatchOptions { | |
| 38 WebNFCWatchOptions(const WebString& url = "", const WebNFCRecordTypeFilter&
recordFilter = WebNFCRecordTypeFilter(), | |
| 39 const WebString& mediaType = "", const WebNFCWatchMode& mode = WebNFCWat
chMode::WebNFCOnly) | |
| 40 : url(url) | |
| 41 , recordFilter(recordFilter) | |
| 42 , mediaType(mediaType) | |
| 43 , mode(mode) | |
| 44 { | |
| 45 } | |
| 46 | |
| 47 WebString url; | |
| 48 WebNFCRecordTypeFilter recordFilter; | |
| 49 WebString mediaType; | |
| 50 WebNFCWatchMode mode; | |
| 51 }; | |
| 52 | |
| 53 } // namespace blink | |
| 54 | |
| 55 #endif // WebNFCWatchOptions_h | |
| OLD | NEW |