Chromium Code Reviews| Index: third_party/WebKit/public/platform/modules/nfc/WebNFCWatchOptions.h |
| diff --git a/third_party/WebKit/public/platform/modules/nfc/WebNFCWatchOptions.h b/third_party/WebKit/public/platform/modules/nfc/WebNFCWatchOptions.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c44e3cb1bc0137182ede5a3933e22e8af908306d |
| --- /dev/null |
| +++ b/third_party/WebKit/public/platform/modules/nfc/WebNFCWatchOptions.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WebNFCWatchOptions_h |
| +#define WebNFCWatchOptions_h |
| + |
| +#include "public/platform/WebString.h" |
| +#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.
|
| + |
| +namespace blink { |
| + |
| +// Enumeration that is mapped to NFCWatchMode as specified in IDL. |
| +enum class WebNFCWatchMode { |
| + WebNFCOnly, |
| + Any, |
| + ENUM_MAX_VALUE = Any |
| +}; |
| + |
| +// Helper wrapper that is used to represent filter for all types of NFC records. |
| +class WebNFCRecordTypeFilter final { |
| +public: |
| + 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.
|
| + explicit WebNFCRecordTypeFilter(const WebNFCRecordType& recordType) : |
| + m_matchAnyRecord(false), m_recordType(recordType) {} |
| + |
| + bool matchAnyRecord() const { return m_matchAnyRecord; } |
| + WebNFCRecordType recordType() const { return m_recordType; } |
| + |
| +private: |
| + bool m_matchAnyRecord; |
| + WebNFCRecordType m_recordType; |
| +}; |
| + |
| +// Contains members of NFCWatchOptions dictionary as specified in the IDL. |
| +struct WebNFCWatchOptions { |
| + WebNFCWatchOptions(const WebString& url = "", const WebNFCRecordTypeFilter& recordFilter = WebNFCRecordTypeFilter(), |
| + const WebString& mediaType = "", const WebNFCWatchMode& mode = WebNFCWatchMode::WebNFCOnly) |
| + : 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.
|
| + { |
| + } |
| + |
| + WebString url; |
| + WebNFCRecordTypeFilter recordFilter; |
| + WebString mediaType; |
| + WebNFCWatchMode mode; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // WebNFCWatchOptions_h |