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

Unified Diff: device/nfc/android/java/src/org/chromium/device/nfc/NfcMessageValidator.java

Issue 2894373002: [DeviceService] Move //device/nfc to be part of the internal impl of Device Service (Closed)
Patch Set: Modify code comment Created 3 years, 7 months 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: device/nfc/android/java/src/org/chromium/device/nfc/NfcMessageValidator.java
diff --git a/device/nfc/android/java/src/org/chromium/device/nfc/NfcMessageValidator.java b/device/nfc/android/java/src/org/chromium/device/nfc/NfcMessageValidator.java
deleted file mode 100644
index 0c7cc54b5001e01d50eee5c3dd5e400bb3762c0f..0000000000000000000000000000000000000000
--- a/device/nfc/android/java/src/org/chromium/device/nfc/NfcMessageValidator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 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.
-
-package org.chromium.device.nfc;
-
-import org.chromium.device.nfc.mojom.NfcMessage;
-import org.chromium.device.nfc.mojom.NfcRecord;
-import org.chromium.device.nfc.mojom.NfcRecordType;
-
-/**
- * Utility class that provides validation of NfcMessage.
- */
-public final class NfcMessageValidator {
- /**
- * Validates NfcMessage.
- *
- * @param message to be validated.
- * @return true if message is valid, false otherwise.
- */
- public static boolean isValid(NfcMessage message) {
- if (message == null || message.data == null || message.data.length == 0) {
- return false;
- }
-
- for (int i = 0; i < message.data.length; ++i) {
- if (!isValid(message.data[i])) return false;
- }
- return true;
- }
-
- private static boolean isValid(NfcRecord record) {
- if (record == null || record.data == null || record.data.length == 0) {
- return false;
- }
-
- if (record.mediaType == null || record.mediaType.isEmpty()
- || record.recordType == NfcRecordType.EMPTY) {
- return false;
- }
-
- return true;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698