Skip to content

Commit c86f47d

Browse files
beaufortfrancoisChromium LUCI CQ
authored andcommitted
web-nfc: Merge NDEFWriter in NDEFReader
NDEFWriter and NDEFReader share a lot of similar features and a writing device, will also read. Therefore it was decided to simplify NDEF functionality, and to have only one class called NDEFReader, which can read and write. refers to w3c/web-nfc#601 Because kWebNfcNdefReaderScan and kWebNfcNdefWriterWrite are now used in idl extended attributes, their usages may be higher now as they were fired after user granted permission. Bug: 1131141 Change-Id: I8cc2ce053e5bb43c0fa5b299bdaf5cb5317bf859 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424208 Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Reilly Grant <[email protected]> Reviewed-by: François Beaufort <[email protected]> Commit-Queue: François Beaufort <[email protected]> Cr-Commit-Position: refs/heads/master@{#832236}
1 parent f77b5e8 commit c86f47d

28 files changed

+474
-661
lines changed

chrome/browser/chrome_back_forward_cache_browsertest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ IN_PROC_BROWSER_TEST_F(ChromeBackForwardCacheBrowserTest,
348348

349349
// Use the WebNfc feature on the empty page.
350350
EXPECT_EQ("success", content::EvalJs(current_frame_host(), R"(
351-
const writer = new NDEFWriter();
351+
const ndef = new NDEFReader();
352352
new Promise(async resolve => {
353353
try {
354-
await writer.write("Hello");
354+
await ndef.write("Hello");
355355
resolve('success');
356356
} catch (error) {
357357
resolve(error.message);

services/device/nfc/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ communicates with the browser adaptation through NFC Mojo interface defined in
1010
the `services/device/public/mojom/nfc.mojom` file and implemented by the
1111
`services/device/nfc` module.
1212

13-
NDEFWriter and NDEFReader are the two primary interfaces of the Web NFC APIs.
13+
NDEFReader is the primary interface of the Web NFC APIs.
14+
The NDEFReader interface has both, write and scan methods.
1415

15-
The NDEFWriter interface has the write method for writing data to NFC tags.
16+
The write method is for writing data to the NFC tag.
1617
This method will return a promise, which will be resolved when the
1718
message is successfully written to a NFC tag or be rejected when errors
1819
happened or the process is aborted by setting the AbortSignal in the
1920
NDEFWriteOptions.
2021

21-
The NDEFReader interface has the scan method to try to read data from any NFC tag
22+
The scan method tries to read data from any NFC tag
2223
that comes within proximity. Once there is some data found an
2324
NDEFReadingEvent carrying the data will be dispatched to the NDEFReader.
2425

third_party/blink/renderer/bindings/generated_in_modules.gni

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,8 +1741,6 @@ generated_interface_sources_in_modules = [
17411741
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_reading_event.h",
17421742
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_record.cc",
17431743
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_record.h",
1744-
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_writer.cc",
1745-
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_writer.h",
17461744
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_network_information.cc",
17471745
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_network_information.h",
17481746
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_notification.cc",

third_party/blink/renderer/bindings/idl_in_modules.gni

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ static_idl_files_in_modules = get_path_info(
415415
"//third_party/blink/renderer/modules/nfc/ndef_record_init.idl",
416416
"//third_party/blink/renderer/modules/nfc/ndef_scan_options.idl",
417417
"//third_party/blink/renderer/modules/nfc/ndef_write_options.idl",
418-
"//third_party/blink/renderer/modules/nfc/ndef_writer.idl",
419418
"//third_party/blink/renderer/modules/notifications/get_notification_options.idl",
420419
"//third_party/blink/renderer/modules/notifications/notification.idl",
421420
"//third_party/blink/renderer/modules/notifications/notification_action.idl",

third_party/blink/renderer/modules/nfc/BUILD.gn

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ blink_modules_sources("nfc") {
1414
"ndef_reading_event.h",
1515
"ndef_record.cc",
1616
"ndef_record.h",
17-
"ndef_writer.cc",
18-
"ndef_writer.h",
1917
"nfc_proxy.cc",
2018
"nfc_proxy.h",
2119
"nfc_type_converters.cc",

third_party/blink/renderer/modules/nfc/idls.gni

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ modules_idl_files = [
77
"ndef_record.idl",
88
"ndef_reader.idl",
99
"ndef_reading_event.idl",
10-
"ndef_writer.idl",
1110
]
1211

1312
modules_dictionary_idl_files = [

0 commit comments

Comments
 (0)