從 MIME 類型到處理每種類型的 Native Client 模組的一或多個對應。舉例來說,以下程式碼片段中的粗體程式碼會將 Native Client 模組註冊為 OpenOffice 試算表 MIME 類型的內容處理常式。
{
"name": "Native Client OpenOffice Spreadsheet Viewer",
"version": "0.1",
"description": "Open OpenOffice spreadsheets, right in your browser.",
"nacl_modules": [{
"path": "OpenOfficeViewer.nmf",
"mime_type": "application/vnd.oasis.opendocument.spreadsheet"
}]
}
「path」的值是指擴充功能目錄中 Native Client 資訊清單 (.nmf
檔案) 的位置。如要進一步瞭解 Native Client 和 .nmf
檔案,請參閱 Native Client 技術總覽。
每個 MIME 類型只能與一個 .nmf
檔案建立關聯,但一個 .nmf
檔案可以處理多種 MIME 類型。以下範例顯示的擴充功能包含兩個 .nmf
檔案,用於處理三種 MIME 類型。
{
"name": "Spreadsheet Viewer",
"version": "0.1",
"description": "Open OpenOffice and Excel spreadsheets, right in your browser.",
"nacl_modules": [{
"path": "OpenOfficeViewer.nmf",
"mime_type": "application/vnd.oasis.opendocument.spreadsheet"
},
{
"path": "OpenOfficeViewer.nmf",
"mime_type": "application/vnd.oasis.opendocument.spreadsheet-template"
},
{
"path": "ExcelViewer.nmf",
"mime_type": "application/excel"
}]
}