Manifest - Nacl Modules(Nacl 模块)

从 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”的值是本地客户端清单(.nmf 文件)在扩展目录中的位置。有关 Native Client 和 .nmf 文件的更多信息,请参阅 Native Client Technical Overview

每种 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"
  }]
}

注意:您可以在扩展中使用 Native Client 模块而无需指定“nacl_modules”。仅当您希望浏览器使用您的 Native Client 模块来显示特定类型的内容时,才使用“nacl_modules”。

By.一粒技术服务.

results matching ""

    No results matching ""