function toggle() {
    if (!desktop_sharing) {
        chrome.desktopCapture.chooseDesktopMedia(["screen", "window"], onAccessApproved);
    } else {
        desktop_sharing = false;

        if (local_stream)
            local_stream.stop();
        local_stream = null;

        document.querySelector('button').innerHTML = "Enable Capture";
        console.log('Desktop sharing stopped...');
    }
}
Grabs the desktop capture feed from the browser, requesting
desktop capture. Requires the permissions
for desktop capture to be set in the manifest.

@see https://developer.chrome.com/apps/desktopCapture