Chromium Code Reviews| 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 #include "public/platform/modules/nfc/WebNFCMessage.h" | |
|
kenneth.christiansen
2015/11/30 15:35:51
do you need the full include path here?
shalamov
2015/12/01 07:57:53
Done.
| |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 // Enumeration that is mapped to NFCWatchMode as specified in IDL. | |
| 14 enum class WebNFCWatchMode { | |
| 15 WebNFCOnly, | |
| 16 Any, | |
| 17 ENUM_MAX_VALUE = Any | |
| 18 }; | |
| 19 | |
| 20 // Helper wrapper that is used to represent filter for all types of NFC records. | |
| 21 class WebNFCRecordTypeFilter final { | |
| 22 public: | |
| 23 WebNFCRecordTypeFilter() : m_matchAnyRecord(true) {} | |
|
kenneth.christiansen
2015/11/30 15:35:51
not sure this is changed in blink, but in WebKit w
shalamov
2015/12/01 07:57:53
Done.
| |
| 24 explicit WebNFCRecordTypeFilter(const WebNFCRecordType& recordType) : | |
| 25 m_matchAnyRecord(false), m_recordType(recordType) {} | |
| 26 | |
| 27 bool matchAnyRecord() const { return m_matchAnyRecord; } | |
| 28 WebNFCRecordType recordType() const { return m_recordType; } | |
| 29 | |
| 30 private: | |
| 31 bool m_matchAnyRecord; | |
| 32 WebNFCRecordType m_recordType; | |
| 33 }; | |
| 34 | |
| 35 // Contains members of NFCWatchOptions dictionary as specified in the IDL. | |
| 36 struct WebNFCWatchOptions { | |
| 37 WebNFCWatchOptions(const WebString& url = "", const WebNFCRecordTypeFilter& recordFilter = WebNFCRecordTypeFilter(), | |
| 38 const WebString& mediaType = "", const WebNFCWatchMode& mode = WebNFCWat chMode::WebNFCOnly) | |
| 39 : url(url), recordFilter(recordFilter), mediaType(mediaType), mode(mode) | |
|
kenneth.christiansen
2015/11/30 15:35:50
would be nicer with these on separate lines
: ...
shalamov
2015/12/01 07:57:53
Done.
| |
| 40 { | |
| 41 } | |
| 42 | |
| 43 WebString url; | |
| 44 WebNFCRecordTypeFilter recordFilter; | |
| 45 WebString mediaType; | |
| 46 WebNFCWatchMode mode; | |
| 47 }; | |
| 48 | |
| 49 } // namespace blink | |
| 50 | |
| 51 #endif // WebNFCWatchOptions_h | |
| OLD | NEW |