google-chrome-extensionnpapi

Can't get NPAPI plugin to work for mime-type "image/webp:webp:WebP"


I have compiled the NPAPI plugin for webP:

http://code.google.com/p/webp-npapi-linux/

It works great from my firefox. I simply do not understand how to get it to work from Google Chrome. I created the json file:

$ cat manifest.json
{
  "name": "My First Extension",
  "version": "1.0",
  "manifest_version": 2,
  "description": "The first extension that I made.",
  "plugins": [
    { "path": "webp-npapi.so", "public": true }
  ]
}

I then start Google Chrome, go to chrome://extensions, click "Load unpacked extension...". I can see it appear in the list:

My First Extension - Version: 1.0 (Unpacked)
The first extension that I made.
ID: bakhhdpebhmgoaecbmpkcbnmcmnamhhk

However I still cannot open no *.webp image !

My test HTML page is:

<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<html> 
 <head> 
  <title> 
   Hello World Demonstration Document
  </title> 
 </head> 
<embed type="image/webp:webp:WebP" id="pluginId">
<script>
  var plugin = document.getElementById("pluginId");
  var result = plugin.myPluginMethod();  // call a method in your plugin
  console.log("my plugin returned: " + result);
</script>
 <body> 
  <h1> 
   Hello, World!
  </h1> 
<img src="1.sm.webp" alt="too bad"/>
 </body> 
</html> 

file is downloaded locally (wget http://www.gstatic.com/webp/gallery/1.sm.webp). And ldd looks ok to me:

$ ldd webp-npapi.so
    linux-vdso.so.1 =>  (0x00007fffafdad000)
    libwebp.so.2 => /usr/lib/x86_64-linux-gnu/libwebp.so.2 (0x00007ff82fd60000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007ff82fa4c000)
    libm.so.6 => /lib/libm.so.6 (0x00007ff82f7c9000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007ff82f5b3000)
    libc.so.6 => /lib/libc.so.6 (0x00007ff82f251000)
    /lib64/ld-linux-x86-64.so.2 (0x00007ff8301c9000)

What am I missing ?


Solution

  • Here is the solution. For some reason firefox has a build-in mime-type mecanism (??) and did recognize webp as image. chromium on the other hand needed to be told the image was webp.

    On my Linux box all I had to do is to register the MIME-type in /etc/mime.types (or ~/.mime.types to register at user level). To verify that the mime type is registered, issue:

    $ grep webp /etc/mime.types
    image/webp                  webp