forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This CL adds some documentation for the NFC module in Chrome. The detailed design documentation is located at https://sites.google.com/a/chromium.org/dev/developers/design-documents/web-nfc and the READMEs do reference that document for more details. Bug: 520391 Change-Id: Ib8b7632d0bf9bba2b3de9fb1b9bf4f528fa11162 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1985961 Commit-Queue: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com> Reviewed-by: Reilly Grant <reillyg@chromium.org> Reviewed-by: Leon Han <leon.han@intel.com> Reviewed-by: François Beaufort <beaufort.francois@gmail.com> Cr-Commit-Position: refs/heads/master@{#729664}
- Loading branch information
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# NFC | ||
|
||
### High level Overview | ||
|
||
The implementation of Web NFC in Chromium consists of two main parts: | ||
The NFC module in Blink located at `third_party/blink/renderer/modules/nfc/` which | ||
contains Blink JavaScript bindings for Web NFC and the browser side platform | ||
level adaptation that is located at `services/device/nfc`. The Blink NFC module | ||
communicates with the browser adaptation through NFC Mojo interface defined in | ||
the `services/device/public/mojom/nfc.mojom` file and implemented by the | ||
`services/device/nfc` module. | ||
|
||
NDEFWriter and NDEFReader are the two primary interfaces of the Web NFC APIs. | ||
|
||
The NDEFWriter interface has the push method for writing data to NFC devices such as | ||
tags. This method will return a promise, which will be resolved when the | ||
message is successfully written to some target or be rejected when errors | ||
happened or the process is aborted by setting the AbortSignal in the | ||
NDEFPushOptions. | ||
|
||
The NDEFReader interface has the scan method to try to read data from any NFC device | ||
that comes within proximity. Once there is some data found to be matching the | ||
filtering criteria provided by web developers in NDEFScanOptions, an | ||
NDEFReadingEvent carrying the data will be dispatched to the NDEFReader. | ||
|
||
The most important classes for Android adaptation are | ||
|
||
[NfcImpl](../../../services/device/nfc/android/java/src/org/chromium/device/nfc/NfcImpl.java), | ||
[NfcTagHandler](../../../services/device/nfc/android/java/src/org/chromium/device/nfc/NfcTagHandler.java) | ||
and | ||
[NdefMessageUtils](../../../services/device/nfc/android/java/src/org/chromium/device/nfc/NdefMessageUtils.java). | ||
|
||
## Web-exposed Interfaces | ||
|
||
### [NFC specification ](https://w3c.github.io/web-nfc/) | ||
|
||
## Testing: | ||
|
||
* Web platform tests are located in | ||
`third_party/blink/web_tests/external/wpt/web-nfc/` and are a mirror of the | ||
[web-platform-tests GitHub repository](https://github.com/web-platform-tests/wpt). | ||
* NFC platform unit tests file for Android is | ||
[NFCTest.java](../../../services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java) | ||
|
||
|
||
## Security and Privacy | ||
|
||
Web NFC API can be only accessed by top-level secure browsing contexts and user | ||
permission is required to access NFC functionality. Web NFC API specification | ||
addresses security and privacy topics in chapter [7. Security and Privacy](https://w3c.github.io/web-nfc/#security). | ||
|
||
|
||
## Permissions | ||
|
||
The device service provides no support for permission checks. When the render | ||
process requests access to a NFC this request is proxied through the browser | ||
process by [NfcPermissionContext](../../../chrome/browser/nfc/nfc_permission_context.h) | ||
which is responsible for checking the permissions granted to the requesting origin. | ||
|
||
|
||
## Platform Support | ||
|
||
At the time of writing, only Android platform is supported. | ||
|
||
|
||
## Design Documents | ||
|
||
Please refer to the [design documentation](https://sites.google.com/a/chromium.org/dev/developers/design-documents/web-nfc) | ||
for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Web NFC Blink Module | ||
|
||
`renderer/modules/nfc` implements the renderer process details and bindings for | ||
the [Web NFC specification]. It communicates with the browser process through the | ||
[Web NFC Mojo interface]. The platform-specific parts of the | ||
implementation are located in `services/device/nfc`. | ||
|
||
[Web NFC specification]: https://w3c.github.io/web-nfc/ | ||
[Web NFC Mojo interface]: ../../../../../services/device/public/mojom/nfc.mojom | ||
|
||
|
||
## Testing | ||
|
||
Web NFC is primarily tested in [Web Platform Tests](https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/external/wpt/web-nfc/). | ||
|
||
|
||
## Design Documents | ||
|
||
Please refer to the [design documentation](https://sites.google.com/a/chromium.org/dev/developers/design-documents/web-nfc) | ||
for more details. |