Screensharing utility sample for getscreenmedia
It basically uses window event messages to communicate between the website javascript and the content script (content.js). The content script in turn uses channel messaging to talk to the backend script which calls chooseDesktopMedia and returns the sourceId of the chosen window. This sourceId has to be passed back to getUserMedia.