Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Unified Diff: third_party/WebKit/public/platform/modules/nfc/WebNFCWatchOptions.h

Issue 1481763005: [webnfc] Add public interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698