| Screenshot Extension |
| -------------------- |
| |
| This extension is to visually test the SDK examples. To use, add this to the |
| html: |
| |
| TODO(binji): normal users shouldn't have to do this -- it should be |
| automatically loaded by the testing framework. |
| |
| <head> |
| ... |
| <script |
| src="chrome-extension://kbbhhngcmjcmlgcnbihfgliliemmijmj/screenshot.js"> |
| </script> |
| <head> |
| |
| Then in JavaScript: |
| |
| var myPluginEl = document.embeds[0]; |
| function onSuccess(dataURL) { |
| // dataURL is a data URL encoded PNG. You can add this to a image like this: |
| var image = new Image(); |
| image.onload = function() { ... } |
| image.src = dataURL; |
| } |
| |
| function onError(errorMessage) { |
| ... |
| } |
| |
| screenshot.captureElement(myPluginEl, onSuccess, onError); |
| |
| See screenshot.js for more info on the API. |