<commit_before>﻿// FORKED FROM https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Chrome-Extensions/desktopCapture

// this background script is used to invoke desktopCapture API to capture screen-MediaStream.

var session = ['screen', 'window', 'tab'];

chrome.runtime.onConnect.addListener(function (port) {
	// this one is called for each message from "content-script.js"
	port.onMessage.addListener(function (message) {
		if(message === 'get-sourceId') {
			chrome.desktopCapture.chooseDesktopMedia(session, port.sender.tab, onAccessApproved);
		}
	});


	// "sourceId" will be empty if permission is denied.
	function onAccessApproved(sourceId) {
		// if "cancel" button is clicked
		if(!sourceId || !sourceId.length) {
			return port.postMessage('PermissionDeniedError');
		}

		port.postMessage({
			sourceId: sourceId
		});
	}
});<commit_msg>Remove 'tab' from session array<commit_after>﻿// FORKED FROM https://github.com/muaz-khan/WebRTC-Experiment/tree/master/Chrome-Extensions/desktopCapture

// this background script is used to invoke desktopCapture API to capture screen-MediaStream.

var session = ['screen', 'window'];

chrome.runtime.onConnect.addListener(function (port) {
	// this one is called for each message from "content-script.js"
	port.onMessage.addListener(function (message) {
		if(message === 'get-sourceId') {
			chrome.desktopCapture.chooseDesktopMedia(session, port.sender.tab, onAccessApproved);
		}
	});


	// "sourceId" will be empty if permission is denied.
	function onAccessApproved(sourceId) {
		// if "cancel" button is clicked
		if(!sourceId || !sourceId.length) {
			return port.postMessage('PermissionDeniedError');
		}

		port.postMessage({
			sourceId: sourceId
		});
	}
});
{'fraction_non_alphanumeric': 0.13144180660104227, 'fraction_numerical': 0.0, 'mean_word_length': 4.574193548387097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6314655', 'n_tokens_mistral': 564, 'n_tokens_neox': 521, 'n_words': 125}