unity-chromium-extension-3.0.0+14.04.20140318/0000755000015201777760000000000012312132125021104 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/ChangeLog0000644000015201777760000000000012312131641022646 0ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/0000755000015201777760000000000012312132125024741 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/base-content-script.js0000644000015201777760000000561412312131641031173 0ustar pbusernogroup00000000000000/* Chromium Unity integration extension * * Copyright 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . **/ (function () { var performContentScriptInitialization = function (loggerf) { UnityContentScriptApi = { getExtensionSettings: function (callback) { chrome.runtime.sendMessage ({method: "get_extension_settings"} , function (response) { if (response && response.error) { // TODO log return; } callback (response); }); }, }; // // Initialize if needed // var initializeIntegrationScriptIfNeededForUrl = function (loggerf) { var logger = loggerf || function (m) {}; // does the unity script injection + user script if necessary logger ('Base content script, started on url: ' + document.URL); var getUserScriptContent = function (url) { var content = null; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { content = xhr.responseText; } }; // mmh blocking xhr.open("GET", url, false); try { xhr.send(); } catch(e) { logger ('Could not load user script content from: ' + url); } return content; }; /** * Injects a given javascript file in the current content script * * @param path path *in the current extension* of the required file */ var require = function (path) { try { eval.call (window, getUserScriptContent (chrome.runtime.getURL (path))); } catch (e) { logger ('Failed to add required dependancy: ' + path + ', ' + e); } }; UnityContentScriptApi.getExtensionSettings ( function (settings) { // Bail out if in incognito mode. if (settings && settings.incognito) { return; } require ("browser.js"); }); }; // initializeIntegrationScriptIfNeededForUrl initializeIntegrationScriptIfNeededForUrl (loggerf); }; // performContentScriptInitialization // only do it for the top window, not the iframes performContentScriptInitialization ( function (msg) { if (top === self) { console.log ("Content script: " + msg); } } ); } ) (); unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/background-page.js0000644000015201777760000004267212312131641030345 0ustar pbusernogroup00000000000000/* Chromium Unity integration extension * * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . **/ var background_page = (function () { // TODO extract based on logging settings var log = { info: function (msg) { if (msg) { console.log ('Info: ' + msg); } } , error: function (msg) { if (msg) { console.log ('Error: ' + msg); } } }; // connection & init w/ plugin NPAPI layer var plugin = document.getElementById ('unityChromiumExtensionId'); if ( ! plugin) { log.error ("Unable to retrieve the Unity Chromium plugin"); return null; } var service = plugin.service_new (); if (! service) { log.error ("Unable to retrieve a connection to Unity Webapps service"); return null; } ///////////////////////////////////////////////////////// // // Handle login & connection to online-accounts project's // extension // //////////////////////////////////////////////////////// var loginListeners = []; var onLoginListenerRequest = function (request, sender, sendResponse) { if (request.action == "registerLoginListener") { log.info ("Login listener request from " + sender.id); loginListeners.push (sender.id); } }; chrome.runtime.onMessageExternal.addListener (onLoginListenerRequest); var onLoginEvent = function (request, sender, sendResponse) { if (request.action == "loginEvent") { log.info ("Login on " + request.domain + ": " + request.login); var len = loginListeners.length; for (var i = 0; i < len; i++) { var extensionId = loginListeners[i]; log.info("Notifying login listener: " + extensionId); chrome.runtime.sendMessage (extensionId, { type: "login", login: request.login, domain: request.domain }); } } }; chrome.runtime.onMessage.addListener (onLoginEvent); ///////////////////////////////////////////////////////// // // Scafolding to keep track of data associated w/ infobar requests // (Chromium's structure imposes some kind of state being maintained // in order to communicate data) // //////////////////////////////////////////////////////// // // list of callback that are to be called asynchronously // per tab. Used in the user integration/installation resquests context. // // One thing to keep in mind is that one constraint, that bring some amount of // 'soundness' is that there is a hard limit (provided by the browser) of one infobar per tab. var user_infobar_request_callbacks = {}; var addInfobarRequestCallbackFor = function (infobarRequestId, callback, message, details) { user_infobar_request_callbacks[infobarRequestId] = {callback: callback , message: message , details: details }; }; var getDataIfAnyFor = function (infobarRequestId) { if (user_infobar_request_callbacks[infobarRequestId] === undefined) { return ""; } return { message: user_infobar_request_callbacks[infobarRequestId].message, details: user_infobar_request_callbacks[infobarRequestId].details }; }; var invokeAndRemoveCallbackIfAnyFor = function (infobarRequestId, arguments) { if (user_infobar_request_callbacks[infobarRequestId] === undefined) { return; } var callback = user_infobar_request_callbacks[infobarRequestId].callback; user_infobar_request_callbacks[infobarRequestId] = undefined; if (typeof(callback) === 'function') { callback(arguments); } }; ///////////////////////////////////////////////////////// // // Extract installed userscripts & webapps info // //////////////////////////////////////////////////////// var initializeIntegrationScriptRepositoryAccess = function (plugin) { var repo = plugin.application_repository_new_default (); plugin.application_repository_prepare (repo); return repo; }; var repo_ = initializeIntegrationScriptRepositoryAccess(plugin); var repo_install_request_stamps = {}; /** * Performs a match on the list of loaded integration scripts * given a url. * */ var matchesIntegrationScripts = function (plugin, url, repo, windowInfos, callback) { function askForApplicationInstallation(plugin, appPackageName, appDomain, url, installationCallback) { if (plugin.permissions_get_domain_dontask(appDomain)) { log.info ("WebApp domain was found in the 'dont ask' list, won't install: " + appPackageName); installationCallback (); return; } if (repo_install_request_stamps[appPackageName] !== undefined) { log.info ('WebApp not being considered for install (request is only issues once per session): ' + appPackageName); installationCallback (); return; } repo_install_request_stamps[appPackageName] = true; function installApp() { log.info ('Installing application: ' + appPackageName); plugin.permissions_allow_domain(appDomain); plugin.application_repository_install_application(repo, appPackageName, installationCallback, null); } function addToIgnoreList() { plugin.permissions_dontask_domain(appDomain); } var isInstallationConfirmed = function (response) { return response && response.integrate; }; if (!plugin.permissions_get_domain_preauthorized(appDomain)) { var appName = plugin.application_repository_get_resolved_application_name(repo, appPackageName); addInfobarRequestCallbackFor (windowInfos.tabId, function (result) { log.info ('Asking for installation : ' + windowInfos.tabId); if (result === undefined) { installationCallback(); } if (isInstallationConfirmed(result)) installApp(); else addToIgnoreList(); }, chrome.i18n.getMessage("integration_copy", [appName, appDomain]), null); chrome.infobars.show ({tabId: windowInfos.tabId, path: "infobar.html"}); } else { plugin.permissions_allow_domain(appDomain); installApp(); } } // function askForApplicationInstallation var APPLICATION_STATUS_AVAILABLE = 0; var APPLICATION_STATUS_INSTALLED = 1; var APPLICATION_STATUS_UNRESOLVED = 2; var formatMatchedWebAppInfo = function (packageName, appName, appDomain, src) { return { packageName: packageName, appName: appName, appDomain: appDomain, content: src, requires: null, includes: null }; }; /** * Gathers the lists of installed and (if any) available apps for a given list of app names * (available for a given url). * * @returns object with "installed" and "available" list properties */ var gatherApplicationsStatuses = function (packageNames) { var installed = []; var available = []; for (var i = 0; i < packageNames.length; ++i) { var packageName = packageNames[i]; var status = plugin.application_repository_get_resolved_application_status (repo, packageName); var appName = plugin.application_repository_get_resolved_application_name (repo, packageName); var appDomain = plugin.application_repository_get_resolved_application_domain (repo, packageName); log.info ('A WebApp application has been found: ' + appName + ', status: ' + status); switch (status) { case APPLICATION_STATUS_INSTALLED: // we have found an installed application, use it directly var src = plugin.application_repository_get_userscript_contents (repo, packageName); installed.push (formatMatchedWebAppInfo(packageName, appName, appDomain, src)); break; case APPLICATION_STATUS_AVAILABLE: // we have found an application that can apply and be installed available.push (formatMatchedWebAppInfo(packageName, appName, appDomain)); break; } } return { installed: installed, available: available }; }; var packageNames = JSON.parse(plugin.application_repository_resolve_url_as_json(repo_, url)); if (null != packageNames) { var appStatuses = gatherApplicationsStatuses(packageNames); if (appStatuses && appStatuses.installed && appStatuses.installed.length > 0) { var app = appStatuses.installed[0]; if (repo_install_request_stamps[app.packageName] == undefined && ! plugin.permissions_get_domain_dontask(app.appDomain) && ! plugin.permissions_get_domain_allowed(app.appDomain)) { // requesting for install addInfobarRequestCallbackFor (windowInfos.tabId, function (result) { if (result && result.integrate) { plugin.application_repository_add_desktop_to_launcher(app.appName, app.appDomain); plugin.permissions_allow_domain(app.appDomain); } else { plugin.permissions_dontask_domain(app.appDomain); } }, chrome.i18n.getMessage("integration_copy", [app.appName, app.appDomain]), null); chrome.infobars.show ({tabId: windowInfos.tabId, path: "infobar.html"}); } return; } // we should have at most one script for a given app if (appStatuses && appStatuses.available && appStatuses.available.length > 0) { var app = appStatuses.available[0]; askForApplicationInstallation (plugin, app.packageName, app.appDomain, url, function (_repository, name, status, data) { log.info ('Application installed: ' + name + ', (status ' + status + ')'); if (name !== undefined && status == APPLICATION_STATUS_INSTALLED) { callback (true, app.packageName, app.appName, app.appDomain); } } ); } else callback (false); } // if (null != names) { }; // var matchesIntegrationScripts = function (plugin, url, repo, windowInfos, callback) { //////////////////////////////////////// // // main request handler // /////////////////////////////////////// /** * Handles & responds to content script requests. * */ var init_requested_stamps = {}; var contentScriptsRequestHandler = function (request, sender, callback) { var handlers = { get_extension_settings: function (request, sender, callback) { var settings = { logging: false, incognito: sender.tab.incognito }; try { if (window.localStorage) { settings.logging = localStorage['logging']; } } catch (e) { log.error ("Error while trying to retrieve logging information: " + str(e)); } callback (settings); } , on_user_infobar_request_result: function (request, sender, callback) { invokeAndRemoveCallbackIfAnyFor (request.tabId, request); } , init_requested: function (request, sender, callback) { var name = request.options.name; var domain = request.options.domain; var iconUrl = request.options.iconUrl + ''; var homepage = request.options.homepage || request.options.url; if (! domain || ! name || typeof(domain) !== 'string' || typeof(name) !== 'string') return; var islocal = request.options.protocol && request.options.protocol === 'file:'; var host = request.options.hostname || request.options.host; if ( ! islocal && (! host || typeof(host) !== 'string')) return; if (-1 === homepage.indexOf(domain) || -1 === host.indexOf(domain)) { log.error('Invalid call to init(), homepage, domain and host are not consistent'); return; } log.info('init_requested() called for ' + name + ' domain: ' + domain); if (plugin.permissions_get_domain_dontask(domain) || plugin.permissions_get_domain_allowed(domain)) { log.info('Domain already listed in allow or dont ask lists'); return; } var stampname = name + domain; if (init_requested_stamps[stampname] == undefined) { addInfobarRequestCallbackFor (sender.tab.id, function (result) { if (result && result.integrate) { plugin.application_repository_generate_desktop_for_url_launch(name, domain, homepage, iconUrl); plugin.application_repository_add_desktop_to_launcher(name, domain); plugin.permissions_allow_domain(domain); } else { plugin.permissions_dontask_domain(domain); } }, chrome.i18n.getMessage("integration_copy", [name, domain]), null); init_requested_stamps[stampname] = true; chrome.infobars.show ({tabId: sender.tab.id, path: "infobar.html"}); } } }; // handlers // validate request if ( ! request || ! request.method) { callback ({error: "Invalid request structure"}); return true; } if ( ! sender) { callback ({error: "Invalid sender"}); return true; } if ( typeof (request.method) != 'string' || request.method.length == 0) { callback ({error: "Invalid request method"}); return true; } log.info ('Got request: ' + request.method); var handler = handlers [request.method]; if (handler !== undefined && typeof(handler) == 'function') { log.info ('Calling handler for: ' + request.method); handler (request, sender, callback); return true; } return false; } // var contentScriptsRequestHandler = // Main event handler and communication link // w/ content scripts chrome.runtime.onMessage.addListener (contentScriptsRequestHandler); /////////////////////////////////////////////////////////////////////// // // Window management related functions. In chromeless mode, we have specific // rules for tab management to make webapps feel more "native" than plain // web applications. // /////////////////////////////////////////////////////////////////////// var onTabChanged = function (tabId, windowId, url) { var onInstalled = function (installed, packageName, appName, appDomain) { }; matchesIntegrationScripts (plugin, url, repo_, { windowId: windowId, tabId: tabId }, onInstalled ); }; chrome.tabs.onCreated.addListener( function(tab) { if (tab && tab.url) { onTabChanged(tab.id, tab.windowId, tab.url); } // if (tab && tab.url) { } ); chrome.tabs.onUpdated.addListener ( function(tabId, changeInfo, tab) { if (changeInfo && changeInfo.url) { onTabChanged(tabId, tab.windowId, changeInfo.url); } } ); return { /* * Returns a potential message associated with a tab id (infobar) */ getMessageForTabId: function (tabId) { return getDataIfAnyFor (tabId).message; } }; }) (); unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/infobar.html0000644000015201777760000000057512312131641027260 0ustar pbusernogroup00000000000000 unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/unity-webapps.json.in0000644000015201777760000000010412312131641031045 0ustar pbusernogroup00000000000000{ "external_crx": "@EXTDIR@", "external_version": "@VERSION@" } unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/manifest.json.in0000644000015201777760000000235512312131641030056 0ustar pbusernogroup00000000000000{ "name": "Unity WebApps Chromium extension", "manifest_version": 2, "minimum_chrome_version": "20.0", "content_security_policy": "script-src 'self' chrome-extension://infobar.js 'unsafe-eval'; object-src 'self'", "version": "@VERSION@", "description": "Unity Webapps Chromium integration", "web_accessible_resources": [ "browser.js", "unity-api-page-proxy-builder-gen.js", "unity-api-page-proxy.js", "infobar.js", "options.js" ], "icons": { "16": "skin/cof-16.png", "48": "skin/cof-48.png" }, "default_locale": "en", "background": { "page": "background-page.html" }, "permissions": ["tabs", "http://*/*", "infobars"], "options_page": "options.html", "plugins": [ /** The "path" property specifies the path to your plugin, relative to the manifest file. * The "public" property specifies whether your plugin can be accessed by regular web pages; * the default is false, meaning only your extension can load the plugin. */ { "path": "libunity_npapi_plugin.so", "public": false } ], "content_scripts": [ { "all_frames": true, "matches": [ "" ], "js": ["base-content-script.js"], "run_at": "document_end" } ] } unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/infobar.css0000644000015201777760000000053212312131641027075 0ustar pbusernogroup00000000000000body { background: -webkit-linear-gradient(#E9E9E9, #DADADA); font-family: Tahoma, Geneva, sans-serif; font-size: 13px; height: 36px; /* Infobars are limited to 36-72px */ margin: 0; overflow: hidden; padding-left: 6px; padding-right: 6px; padding-top: 5px; } img { padding-right: 6px; } button { padding-right: 10px; } unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/browser.js0000644000015201777760000001266312312131641026774 0ustar pbusernogroup00000000000000/** * Handles all the related work to injecting the 'external' extension into the * content script (well, more precisely the current environment), and the proxy * responsbile for handling the API requests in a webapplication. * */ (function (currentWindow) { var aWindow = currentWindow; var plugin = null; var service = null; var api = { init: function (options) { options.url = window.location.href; options.hostname = window.location.hostname; options.host = window.location.host; options.protocol = window.location.protocol; chrome.runtime.sendMessage ( {method: "init_requested", options: options} , function (response) {}); } }; /** * Inserts a given script in the webpage. * Needs chrome.extension functionality. * * @param path of file to be injected (part of the extension) */ var insertScriptIntoWebpage = function (path) { var script = document.createElement ('script'); script.type = 'text/javascript'; script.src = chrome.runtime.getURL (path); document.getElementsByTagName("head")[0].appendChild (script); }; var injectApiProxy = function () { // 1. inject a piece of javascript proxying all the requests // to the unity webapps api insertScriptIntoWebpage('unity-api-page-proxy-builder-gen.js'); insertScriptIntoWebpage('unity-api-page-proxy.js'); function makeWebpageCallback (id) { // TODO/FIXME: add support for callback params (needed for DnD) return function () { var d = document.createElement ("textarea"); var e = document.createEvent ("Events"); d.style.cssText = "display:none;"; d.value = id; d.addEventListener ("unity-webapps-chromium-api-com-link-callback-called-ack" , function() { d.parentNode.removeChild (d); } , true); document.body.appendChild (d); e.initEvent ("unity-webapps-chromium-api-com-link-callback-called", false, true); d.dispatchEvent (e); }; }; // TODO: should be shared / generated w/ web page code var isIterableObject = function(obj) { if (obj === undefined || obj === null) { return false; } var t = typeof(obj); var types = {'string': 0, 'function': 0, 'number': 0, 'undefined': 0, 'boolean': 0}; return types[t] === undefined; }; /** * Wraps callback ids in proper callback that dispatch to the * webpage thru a proper event * */ function wrapCallbackIds (obj) { if ( ! isIterableObject(obj)) { return obj; } if (obj && obj.hasOwnProperty('callbackid') && obj.callbackid != null) { return makeWebpageCallback (obj.callbackid); } var ret = (obj instanceof Array) ? [] : {}; for (var key in obj) { if (obj.hasOwnProperty(key)) { if (isIterableObject (obj[key])) { if (obj[key].callbackid != null) { ret[key] = makeWebpageCallback (obj[key].callbackid); } else { ret[key] = wrapCallbackIds (obj[key]); } } else { ret[key] = obj[key]; } } } return ret; }; // 2. open the communication mean between the two // TODO has the implicit knowledge of who's behind ... var dispatchActualFunctionCall = function (funcname, args) { var funcnames = funcname.split('.'); var reducetarget = api; // a bit hacky try { // Assumes that we are calling a 'callable' from a succession of objects funcnames.reduce ( function (prev, cur) { return typeof prev[cur] == "function" ? prev[cur].bind(prev) : prev[cur]; }, reducetarget).apply (null, args); } catch (err) { console.log ('Error while dispatching call to ' + funcnames.join('.') + ': ' + err); } }; document.addEventListener("unity-webapps-chromium-api-com-link" , function(event) { var from = event.target; if (from) { var type = from.getAttribute("data-eventType"); var args = JSON.parse(from.value); args = args.map (function (arg) { return wrapCallbackIds (arg); }); // Actuall call, e.g. 'Notification.showNotification("a","b") // being reduces to successive calls to associated objects: // Notification, showNotification // // TODO add proper error handling dispatchActualFunctionCall(type, args); } // send ack event to allow cleanup var ret = document.createEvent('Events'); ret.initEvent('unity-webapps-chromium-api-com-link-ack', true, false); from.dispatchEvent(ret); } , true); }; // handle the proxy side of the api which is being injected on the // webpage injectApiProxy(); } )(window); unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/crxmake.sh0000755000015201777760000000241112312131641026732 0ustar pbusernogroup00000000000000#!/bin/bash -e # # Purpose: Pack a Chromium extension directory into crx format if test $# -ne 2; then echo "Usage: crxmake.sh " exit 1 fi dir=$1 key=$2 name=$(basename "$dir") crx="$name.crx" pub="$name.pub" sig="$name.sig" zip="$name.zip" trap 'rm -f "$pub" "$sig" "$zip"' EXIT # zip up the crx dir cwd=$(pwd -P) (cd "$dir" && zip -qr -9 -X "$cwd/$zip" .) # signature openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig" # public key openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null byte_swap () { # Take "abcdefgh" and return it as "ghefcdab" echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}" } crmagic_hex="4372 3234" # Cr24 version_hex="0200 0000" # 2 pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}'))) sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}'))) ( echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p cat "$pub" "$sig" "$zip" ) > "$crx" echo "Wrote $crx" # Output files to package in subdir "res" res="$cwd/res" mkdir -p $res echo "Result: $res" cp -f $crx $res/ eid=`cat $key | openssl rsa -pubout -outform DER | openssl dgst -sha256 | awk '{print $2}' | cut -c 1-32 | tr '0-9a-f' 'a-p'` echo "ID: $eid" cp -f unity-webapps.json $res/$eid.json unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/unity-api-page-proxy-builder-gen.js0000644000015201777760000003570012312131641033511 0ustar pbusernogroup00000000000000var UnityWebappsApiPageProxyBuilder = function(backend) { var dummy = true; var unity = { context: dummy, contextReady: dummy }; var uwa = { ContextActionCallbackType: null }; var CallbackManager = { makeCallback: function (dumd, func) { return func; } }; function checkString(str, allowUndef) { if (allowUndef && str == undefined) { return; } if (!str || typeof(str) !== 'string') { throw new TypeError("incorrect argument"); } } var findName = function (func, prefix, obj) { if (!prefix) { return findName(func, 'Unity.', api); } var keys = Object.keys(obj); for (var i = 0; i < keys.length; i++) { if (typeof(keys[i]) !== 'string') { continue; } var descr = Object.getOwnPropertyDescriptor(obj, keys[i]); if (descr.value === func) { return prefix + keys[i]; } if (descr.value instanceof Object) { var res = findName(func, prefix + keys[i] + '.', obj[keys[i]]); if (res) return res; } if (obj.__lookupGetter__(keys[i]) === func) { return prefix + keys[i]; } if (obj.__lookupSetter__(keys[i]) === func) { return prefix + keys[i]; } } return null; }; var stringify = function (obj) { if (obj === undefined) return obj; if (obj === null) return obj; if (typeof(obj) == 'string') return obj; if (typeof(obj) == 'number') return obj; if (typeof(obj) == 'function') return String(obj); var dump = {}; for (var i in obj) { if (obj.hasOwnProperty(i)) dump[i] = stringify(obj[i]); } return dump; }; var stringifyArgs = function (obj) { var args = []; for (var i = 0; i < obj.length; i++) { args.push(stringify(obj[i])); } var res = JSON.stringify(args); return res.substr(1, res.length - 2); }; var createArgumentsSanitaizer = function (func, argsDesc, callback) { return function () { var realArgs = arguments; var name = findName(arguments.callee); var k = 0; function argumentSanitaizer(desc, arg) { if (!desc) { throw new InternalError("argument description is null"); } if (desc.dummy) { k--; return null; } if (desc.array) { if (!(desc.array instanceof Object) || !(desc.array.element instanceof Object)) { throw new InternalError("invalid argument description"); } try { for (var j = 0; j < arg.length; j++) { argumentSanitaizer(desc.array.element, arg[j]); } } catch (x) { throw new TypeError("incorrect argument"); } return arg; } if (desc.obj) { if (!(desc.obj instanceof Object)) { throw new InternalError("invalid argument description"); } var res = {}, i; for (i in desc.obj) { if (desc.obj.hasOwnProperty(i)) { res[i] = argumentSanitaizer(desc.obj[i], arg[i]); } } return res; } if (desc.str) { if (desc.allowNull && !arg) { return null; } checkString(arg, false); return arg; } if (desc.number) { if (typeof(arg) !== 'number' && typeof(arg) !== 'boolean') throw new TypeError("incorrect argument"); return arg; } if (!desc.type) { throw new InternalError("argument description miss required parameter"); } if ((arg instanceof desc.type) || (desc.type === Function && ((typeof arg) === 'function')) || (arg === null && desc.allowNull)) { if (desc.type === Function) { if (!arg) { return null; } var id; if (desc.argAsCallbackId !== undefined) { id = realArgs[desc.argAsCallbackId]; } return CallbackManager.makeCallback(uwa.ContextActionCallbackType, function (context, user_data) { arg(); }, name, id); } return arg; } else { throw new TypeError("incorrect argument"); } throw new InternalError("unreacheable"); } var args = [unity.context], i; for (i = 0; i < argsDesc.length; i++) { if (k >= realArgs.length && k > 0 && !argsDesc[i].dummy) { throw new Error("not enough arguments"); } var value = argumentSanitaizer(argsDesc[i], realArgs[k]); k++; if (argsDesc[i].obj) { args = args.concat(value); } else { args.push(value); } } if (k < realArgs.length) { throw new Error("too much arguments"); } if (callback) callback.apply(uwa, args); if (func) return Function.apply.apply(func, [uwa, args]); return null; }; }; var api = { init: function(props) { checkString(props.name, false); checkString(props.iconUrl, true); checkString(props.domain, true); checkString(props.login, true); checkString(props.mimeTypes, true); checkString(props.homepage, true); if (props.homepage && !/^(http|https|file):\/\//.test(props.homepage)) { throw new TypeError("incorrect argument"); } backend("init", [props]); } , acceptData: createArgumentsSanitaizer(null, [{ array: { element: { str: true } } }, { type: Function, js: true }], function (context, mimeTypes, callback) { backend('acceptData', [mimeTypes, callback]); }) , addAction: createArgumentsSanitaizer(null, [{ str: true }, { type: Function, argAsCallbackId: 0 }], function (context, name, callback) { backend('addAction', [name, callback]); }) , clearAction: createArgumentsSanitaizer(null, [{ str: true }] , function (context, name) { backend('clearAction', [name]); }) , clearActions: createArgumentsSanitaizer(null, [], function (context) { backend('clearActions', []); }) , MediaPlayer: { init: createArgumentsSanitaizer(null, [{ str: true }], function (context, name) { backend('MediaPlayer.init', [name]); }) , onPlayPause: createArgumentsSanitaizer(null, [{ type: Function, allowNull: true }, { dummy: true }], function (context, callback) { backend('MediaPlayer.onPlayPause', [callback]); } ) , onPrevious: createArgumentsSanitaizer(null, [{ type: Function, allowNull: true }, { dummy: true }], function (context, callback) { backend('MediaPlayer.onPrevious', [callback]); }) , onNext: createArgumentsSanitaizer(null, [{ type: Function, allowNull: true }, { dummy: true }], function (context, callback) { backend('MediaPlayer.onNext', [callback]); } ) , setTrack: createArgumentsSanitaizer(null, [{ obj: { artist: { str: true, place: 0, allowNull: true }, album: { str: true, place: 1, allowNull: true }, title: { str: true, place: 2 }, artLocation: { str: true, place: 3, allowNull: true } } }], function (context, trackinfos) { backend('MediaPlayer.setTrack', [trackinfos]); }) , setCanGoNext: createArgumentsSanitaizer(null, [{ number: true }], function (context, v) { backend('MediaPlayer.setCanGoNext', [v]); } ) , setCanGoPrevious: createArgumentsSanitaizer(null, [{ number: true }], function (context, v) { backend('MediaPlayer.setCanGoPrevious', [v]); } ) , setCanPlay: createArgumentsSanitaizer(null, [{ number: true }], function (context, v) { backend('MediaPlayer.setCanPlay', [v]); } ) , setCanPause: createArgumentsSanitaizer(null, [{ number: true }], function (context, v) { backend('MediaPlayer.setCanPause', [v]); } ) , setPlaybackState: createArgumentsSanitaizer(null, [{ number: true }], function (context, v) { backend('MediaPlayer.setPlaybackState', [v]); } ) , getPlaybackState: createArgumentsSanitaizer(null , [{ type: Function }] , function (context, callback) { backend('MediaPlayer.getPlaybackState', [callback]); } ) , PlaybackState: {PLAYING: 0, PAUSED:1} }, Notification: { showNotification: createArgumentsSanitaizer(null, [{ str: true }, { str: true }, { str: true, allowNull: true }], function (context, title, name, dummy) { backend('Notification.showNotification', [title, name, dummy]); } ) }, Launcher: { setCount: createArgumentsSanitaizer(null, [{ number: true }], function (context, count) { backend('Launcher.setCount', [count]); } ) , clearCount: createArgumentsSanitaizer(null, [], function (context) { backend('Launcher.clearCount', []); }), setProgress: createArgumentsSanitaizer(null, [{ number: true }], function (context, progress) { backend('Launcher.setProgress', [progress]); } ) , clearProgress: createArgumentsSanitaizer(null, [], function (context) { backend('Launcher.clearProgress', []); } ) , setUrgent: createArgumentsSanitaizer(null, [], function (context) { backend('Launcher.setUrgent', []); } ) , addAction: function(arg1, arg2) { backend('Launcher.addAction', [arg1, arg2]); } , removeAction: createArgumentsSanitaizer(null, [{ str: true }], function (context, name) { backend('Launcher.removeAction', [name]); } ) , removeActions: createArgumentsSanitaizer(null, [], function (context) { backend('Launcher.removeActions', []); } ) }, MessagingIndicator: { addAction: createArgumentsSanitaizer(null, [{ str: true }, { type: Function, argAsCallbackId: 0 }, { dummy: true }], function (context, name, callback, dummy) { backend('MessagingIndicator.addAction', [name, callback, dummy]); } ) , showIndicator: function(name, properties) { backend('MessagingIndicator.showIndicator', [name, properties]); } , clearIndicator: createArgumentsSanitaizer(null, [{ str: true }], function(context, name) { backend('MessagingIndicator.clearIndicator', [name]); }), clearIndicators: createArgumentsSanitaizer(null, [], function (context) { backend('MessagingIndicator.clearIndicators', []); }) } }; return api; }; unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/options.html0000644000015201777760000000152212312131641027324 0ustar pbusernogroup00000000000000 Unity Webapps Options
Unity Webapps Integration Extension
Enable extension logging:
unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/background-page.html0000644000015201777760000000043012312131641030657 0ustar pbusernogroup00000000000000 Unity Webapps Extension Background Page unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/options.js0000644000015201777760000000115512312131641026776 0ustar pbusernogroup00000000000000function save_options() { var logging = document.getElementById("logging"); localStorage["logging"] = logging.checked; } function restore_options() { if ( ! window.localStorage) { alert ("Please enable local storage in order to access options"); document.getElementById('logging').disabled = true; return; } var logging = localStorage["logging"]; var loggingElt = document.getElementById("logging"); if (loggingElt) { loggingElt.checked = (logging == "true"); } } window.onload = function () { restore_options(); document.getElementById('logging').onclick = save_options; }; unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/Makefile.am0000644000015201777760000000210212312131641026772 0ustar pbusernogroup00000000000000CLEANFILES = res/* EXTRA_DIST = extensiondir = $(libdir)/libunity-chromium extension_DATA=res/unity-webapps.crx clean-extension-package: rm -f $(CLEANFILES) SCRIPT_FILES = \ $(shell ls *.css) \ $(shell ls *.html) \ $(shell ls *.js) \ $(shell ls skin/*) \ $(shell ls _locales/*/*) res/unity-webapps.crx: $(SCRIPT_FILES) unity-webapps.json manifest.json cp -f $(top_builddir)/npapi-plugin/src/.libs/libunity_npapi_plugin.so . if [ ! -f ../unity-webapps.pem ]; \ then \ openssl genrsa 1024 > ../unity-webapps.pem; \ fi $(srcdir)/crxmake.sh $(abs_builddir) ../unity-webapps.pem mv res/chromium-extension.crx res/unity-webapps.crx manifestdir = $(datadir)/chromium/extensions/ manifest_DATA = $(shell ls $(top_builddir)/chromium-extension/res/*.json) %.json: %.json.in sed -e "s|\@EXTDIR\@|$(extensiondir)/unity-webapps.crx|" $< | sed -e "s|\@VERSION\@|$(VERSION)|"> $@ CLEANFILES += \ unity-webapps.json \ manifest.json \ libunity_npapi_plugin.so \ chromium-extension.crx EXTRA_DIST += \ unity-webapps.json.in \ manifest.json.in \ crxmake.sh \ $(SCRIPT_FILES) unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/infobar.js0000644000015201777760000000166312312131641026727 0ustar pbusernogroup00000000000000var doIntegrate = function (integrate) { chrome.tabs.getCurrent (function (tab) { chrome.runtime.sendMessage ({tabId: tab.id, method: "on_user_infobar_request_result", integrate: integrate} , function (response) {}); window.close(); }); }; window.onload = function () { chrome.runtime.getBackgroundPage(function (bg) { document.getElementById('notintegrate').onclick = function () { doIntegrate(false); }; document.getElementById('integrate').onclick = function () { doIntegrate(true); }; chrome.tabs.getCurrent (function (tab) { if (!bg|| !bg.background_page) { window.close(); return; } var msg = bg.background_page.getMessageForTabId(tab.id); if (msg == null) { window.close(); return; } document.getElementById ('content').style.display = "block"; document.getElementById ('message').innerHTML = msg || ""; }); }); }; unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/build.sh0000755000015201777760000000100212312131641026372 0ustar pbusernogroup00000000000000#!/bin/bash -e CRX_FILENAME=`pwd`/../chromium-extension.crx PEM_FILENAME=`pwd`/../chromium-extension.pem if [ -e "$CRX_FILENAME" ] then rm -f "$CRX_FILENAME" fi #if [ -e "$PEM_FILENAME" ] #then # rm -f "$PEM_FILENAME" #fi if test -n "`which google-chrome`"; then google-chrome --no-message-box --pack-extension=`pwd` --pack-extension-key=../chromium-extension.pem else chromium-browser --no-message-box --pack-extension=`pwd` fi # not necessary # mv `pwd`/../unity-chromium-extension.crx . unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/skin/0000755000015201777760000000000012312132125025705 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/skin/cof-48.png0000644000015201777760000000545112312131641027422 0ustar pbusernogroup00000000000000PNG  IHDR00WsRGBbKGD pHYs  tIME ntEXtCommentCreated with GIMPW IDATh޽yp?ow%ٖزqrpSP(L v @nsJi(w)W8`ZBIpt t` HXrHeIHZ_Rb;3{iW*Uu/Vd$ HT]/A)PЖ-cdUBDfj #RUAU""_KkW 2:T\R*CUTQYZ h ,YbYeVTPT%-6WZ+ c pwYU 6Y@XUDe|'OTu jiZU^J2F qb=UQ!~lh<a*"/rL7=Iu!-'n\B$PT2~$oZR_8}T]e_8*_8'w[BQqymsV` 6P;`G8=qb=h2= 󊈁 bUWZCmb,A5#Qj0- ?⟞oXU"LcJtՋ#;itw)#B>p&‹iK>8E0#>gySvƕL8MY3qz9+e WnZUw⛾?vWVEt:,?`qhј',Sg moʷF #wy("tw"?˥|EOPRl{a^x ,.. NEfWZ?B|a(yY/ ~u'MlAbَαdhe-$ "~`jr9PvE'"DZFOxx:@tuDO!jN/.X]lxs|2izg@ fU9u"G": }NjchtK2ғ.F9 Efj'U|gֲǫI|FߟLi+}Qec.o-#Nd#<3 I_㝶g@ ˍO)K6隱MDpw3׹g)Haq>$*8v˔!aiXa3alB+&ĉ@GN("ӹ:+@ilq x|5j'0,_^$]F0J2!SDo[L fE5bZSeʓ7@y)%6d1Tݕm]tw B_~_„3"T |{}xmؑm9@1۝($fsfbW>GQՆTuKK"U跔 M;h'Dw/)k)qU*UW?@1g95 >Iwx.۽Q|с^Zٴ4M?T+QTαIRzSoo fϥ稹yCcò pWVKYt߬ܽ,޵og|o~:z[>&޶x'gR;SټG'B9Eg`s'5RZD [ÜPŷF X9G=FxbmS 3b _YY"TRU>-|p.]Eh zTѷwR|oeҏE$ CBȣ|!IvlbbWQ.2b& :ғ.ELFͽ"9*@8mWVdJO#NªRDV7qOo;yhbo۶ gq6u"PC*W#Ř`8nȶTlaNJͲHWQչ;6T>y00|HQ `GR}DJ0|9dj3`y5UUEU 69^O jTIv%K:/\|vР*y*qWL-ub0*:UE<>UYC5;ݎ?DR˃a{|usU:68J̪V{MEf LC]}?쌏;%@ Td8c %F۶mFL;rIj3"{ hjߠ_3e 5[S݀Q롁N R%FDq 6w~S]XUR#L@gT ZP]"Eu7r&蠟YIENDB`unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/skin/cof-16.png0000644000015201777760000000151312312131641027410 0ustar pbusernogroup00000000000000PNG  IHDRasBIT|dIDAT8e_hu?}߳xΖwb6; 4tc (Pf&)d ʠd BԙM9j4u2v}n8s>U2vUl;mN@s剴?ق\%~7V`*|ɟ`%oX1!Qb2x1V;쪖ũıAe ݿݭ0M7ly{ebj- ]$O*+ɰj=l`ZÊWq~  )MFʼnQ|mtbyۧ@Pu3g;図5.}lٞmp3/Ƹ&ƈuQ 5D|jC:wC'kN!D("/HSb%nH ,qBA -t!4ss-Kg'rCS/bw*Mf5nj1, #͐^۩ 'V_LWVs)d N{-T4FdӠ55JSdOب1ώ.vX̻ {'0': 1, '1': 2, '2': 3} d.value = JSON.stringify ( data.map ( function (datum) { return transformCallbacksToIds (datum); } ) ); d.addEventListener ("unity-webapps-chromium-api-com-link-ack" , function() { if (callback) callback (d.value); d.parentNode.removeChild (d); } , true); d.setAttribute ("data-eventType", type); document.body.appendChild (d); e.initEvent ("unity-webapps-chromium-api-com-link", false, true); d.dispatchEvent (e); }; document.addEventListener ("unity-webapps-chromium-api-com-link-callback-called" , function(event) { var from = event.target; if (from) { if (from.value) { var callback = callbackmanager.get(from.value); if (callback) { callback (); } } var ret = document.createEvent('Events'); ret.initEvent('unity-webapps-chromium-api-com-link-callback-called-ack', true, false); from.dispatchEvent(ret); } } , true); var api = UnityWebappsApiPageProxyBuilder(sendToApi); function unity() { } unity.prototype = { __proto__: window.external, getUnityObject: function (version) { console.log ('Proxy: getUnityObject called with version ' + version); if (version === 1) return api; throw new Error("incorrect version"); } }; window.external = new unity(); sendApiCreatedAcknowledge(); } , 0); unity-chromium-extension-3.0.0+14.04.20140318/chromium-extension/unity_api_page_proxy_generator.py0000644000015201777760000000637212312131641033631 0ustar pbusernogroup00000000000000#!/usr/bin/python """ Generates a *.js file (defaults to unity-api-page-proxy-builder.js) by parsing & extracting expected information out of an input .js filename (defaults to unity-api.js). Extracts only the meaningful bits (mostly the argument sanitizer bits) and generates a proper web page side unity api w/ a proper validation layer (as exposed by unity-api.js) Takes an input filename as an argument. """ import sys class DEFAULTS: input_api_filename = "unity-api.js" output_api_filename = "unity-api-page-proxy-builder-gen-py.js" input_api_filename = DEFAULTS.input_api_filename output_api_filename = DEFAULTS.output_api_filename def extractFunctionDefinition (name, content): import re funcre = re.compile (r'([^\w_]|\s*)(' + name + r')\s*\((?P.*?)\)\s*{', re.MULTILINE) m = re.search (funcre, content) if m: s = ['{'] start = m.end(0) end = start + 1 for idx in xrange (start, len(content)-1): if content[idx] == '{': s.append('{') elif content[idx] == '}': s.pop() if s.count('{') == 0: end = idx break return m.group('params'), content[start:end] return None, None def untabify (body): mintabs = min([len([c for c in line if c == ' ' or c == '\t']) for line in body.split('\n') if len(line.strip()) != 0]) return '\n'.join ([line[mintabs:] for line in body.split('\n')]) def generateFunction (name, params, body): return """ var %s = function (%s) { %s }; """ % (name, params, untabify(body)) def extractObjectDefinition(content, oname): import re apire = re.compile(oname + '\s*[=|:]\s*', re.MULTILINE) m = re.search(apire, content) s = [] start = m.end(0) end = start for idx in xrange (start, len(content)-1): if content[idx] == '{': s.append('{') elif content[idx] == '}': s.pop() if s.count('{') == 0: end = idx break return content[start:end] def extractApiDefinition(content): return extractObjectDefinition(content, 'api') def generateUnityApiTargetFile (inputfilename, outputfilename): content = open(inputfilename).read() function_names = ['findName', 'stringify', 'stringifyArgs', 'createArgumentsSanitaizer'] extracted_data = [(function_name, extractFunctionDefinition(function_name, content)) for function_name in function_names] extracted_functions = [{'name': extracted_datum[0], 'params': extracted_datum[1][0], 'body': extracted_datum[1][1]} for extracted_datum in extracted_data] buildercontent = 'var UnityWebappsApiPageProxyBuilder = function(backend) {\n' buildercontent += """ var dummy = true; var unity = { context: dummy, contextReady: dummy }; var uwa = { ContextActionCallbackType: null }; var CallbackManager = { makeCallback: function (dumd, func) { return func; } }; """ buildercontent += '\n'.join([generateFunction(func['name'], func['params'], func['body']) for func in extracted_functions]) buildercontent += 'var api = {\n};\n' buildercontent += '};\n\n' open(outputfilename, "w+").write(buildercontent) generateUnityApiTargetFile (input_api_filename, output_api_filename) unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/0000755000015201777760000000000012312132125023507 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/tests/0000755000015201777760000000000012312132125024651 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/Makefile.am0000644000015201777760000000024512312131641025546 0ustar pbusernogroup00000000000000SUBDIRS = src unity_npapi_plugindocdir = ${prefix}/doc/unity_npapi_plugin # Remove doc directory on uninstall uninstall-local: -rm -r $(unity_npapi_plugindocdir) unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/INSTALL0000777000015201777760000000000012312132125031744 2/usr/share/automake-1.11/INSTALLustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/0000755000015201777760000000000012312132125024276 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/wrapped-ptr-type.h0000644000015201777760000000233612312131641027701 0ustar pbusernogroup00000000000000/* * wrapped-ptr-type.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (WRAPPED_PTR_TYPE_H) #define WRAPPED_PTR_TYPE_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" // TODO should probably be more general typedef struct wrapped_void_ptr_t_ { NPObject object; void * pWrapped; NPP instance; } wrapped_void_ptr_t; /** * * @param pWrappingValue can be NULL */ NPObject * create_wrapped_ptr_object_for (NPP instance, void * pWrappingValue); #endif // WRAPPED_PTR_TYPE_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-binding.h0000644000015201777760000003114312312131641030672 0ustar pbusernogroup00000000000000/* * unity-webapps-binding.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_WEBAPPS_BINDING_H) #define UNITY_WEBAPPS_BINDING_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npruntime.h" #include "npapi-headers/headers/nptypes.h" NPVariant unity_webapps_binding_service_new (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_service_destroy_interest_for_context (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_new_sync (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_new_lazy (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_prepare (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_destroy (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_add_icon (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_set_view_is_active (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_set_view_location (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_get_name (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_get_domain (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_notification_show_notification (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_on_raise_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_on_close_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_set_preview_requested_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_remove_application_action (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_add_application_actions (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_remove_application_actions (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_permissions_is_integration_allowed (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_permissions_allow_domain (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_permissions_get_domain_preauthorized (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_init (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_on_play_pause_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_on_previous_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_on_next_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_set_track (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_set_can_pause (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_set_can_play (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_set_can_go_next (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_set_can_go_previous (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_set_playback_state (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_get_can_pause (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_get_can_play (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_get_can_go_next (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_get_can_go_previous (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_music_player_get_playback_state (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_notification_show_notification (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_permissions_get_domain_allowed (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_permissions_allow_domain (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_permissions_get_domain_dontask (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_permissions_dontask_domain (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_set_count (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_clear_count (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_set_progress (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_clear_progress (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_set_urgent (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_add_action (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_remove_action (NPP instance , NPObject * npobject, const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_remove_actions (NPP instance , NPObject * npobject, const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_show_indicator (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_clear_indicator (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_clear_indicators (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_set_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_set_property (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_set_property_icon (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_add_action (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_get_presence (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_indicator_on_presence_changed_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_set_preview_requested_callback (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_set_homepage (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_service_set_xid_for_browser_window_id (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_get_interest_id (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_context_set_application_accept_data (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_add_static_action (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_launcher_remove_static_actions (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); #endif // UNITY_WEBAPPS_BINDING_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-common.h0000644000015201777760000000360712312131641030222 0ustar pbusernogroup00000000000000/* * unity-npapi-common.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_NPAPI_COMMON_H) #define UNITY_NPAPI_COMMON_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/nptypes.h" // methods typedef NPVariant (*UnityWebAppsNpapiMethodPtr) (NPP instance , NPObject * object , const NPVariant args[] , uint32_t argcnt); typedef NPVariant (*UnityWebAppsNpapiNamedMethodPtr) (NPP instance , NPObject * object , NPIdentifier name , const NPVariant args[] , uint32_t argcnt); // array like access typedef NPVariant (*UnityWebAppsNpapiIndexedGetPtr) (NPP instance , NPObject * object , int32_t idx); // properties typedef NPVariant (*UnityWebAppsNpapiPropertyGetPtr) (NPObject * object); typedef bool (*UnityWebAppsNpapiPropertySetPtr) (NPObject * object, const NPVariant * variant); typedef struct UnityWebAppsNpapiPropertyDescr_t { UnityWebAppsNpapiPropertyGetPtr get; UnityWebAppsNpapiPropertySetPtr set; } UnityWebAppsNpapiPropertyDescr; // deallocator typedef void (*UnityWebappsDeallocatorPtr) (NPP instance , NPObject * object); #endif // UNITY_NPAPI_COMMON_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/npapi-headers/0000755000015201777760000000000012312132125027016 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/npapi-headers/headers/0000755000015201777760000000000012312132125030431 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/npapi-headers/headers/npapi.h0000644000015201777760000007005312312131641031720 0ustar pbusernogroup00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef npapi_h_ #define npapi_h_ #if defined(__OS2__) #pragma pack(1) #endif #include "nptypes.h" #if defined(__OS2__) || defined(OS2) #ifndef XP_OS2 #define XP_OS2 1 #endif #endif #if defined(_WIN32) && !defined(__SYMBIAN32__) #include #ifndef XP_WIN #define XP_WIN 1 #endif #endif #if defined(__SYMBIAN32__) #ifndef XP_SYMBIAN #define XP_SYMBIAN 1 #undef XP_WIN #endif #endif #if defined(__APPLE_CC__) && !defined(XP_UNIX) #ifndef XP_MACOSX #define XP_MACOSX 1 #endif #endif #if defined(XP_MACOSX) && defined(__LP64__) #define NP_NO_QUICKDRAW #define NP_NO_CARBON #endif #if defined(XP_MACOSX) #include #include #ifndef NP_NO_CARBON #include #endif #endif #if defined(XP_UNIX) #include #if defined(MOZ_X11) #include #include #endif #endif #if defined(XP_SYMBIAN) #include #include #endif /*----------------------------------------------------------------------*/ /* Plugin Version Constants */ /*----------------------------------------------------------------------*/ #define NP_VERSION_MAJOR 0 #define NP_VERSION_MINOR 27 /* The OS/2 version of Netscape uses RC_DATA to define the mime types, file extensions, etc that are required. Use a vertical bar to separate types, end types with \0. FileVersion and ProductVersion are 32bit ints, all other entries are strings that MUST be terminated with a \0. AN EXAMPLE: RCDATA NP_INFO_ProductVersion { 1,0,0,1,} RCDATA NP_INFO_MIMEType { "video/x-video|", "video/x-flick\0" } RCDATA NP_INFO_FileExtents { "avi|", "flc\0" } RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", "MMOS2 Flc/Fli player(*.flc)\0" } RCDATA NP_INFO_FileVersion { 1,0,0,1 } RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" RCDATA NP_INFO_InternalName { "NPAVI32\0" ) RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } */ /* RC_DATA types for version info - required */ #define NP_INFO_ProductVersion 1 #define NP_INFO_MIMEType 2 #define NP_INFO_FileOpenName 3 #define NP_INFO_FileExtents 4 /* RC_DATA types for version info - used if found */ #define NP_INFO_FileDescription 5 #define NP_INFO_ProductName 6 /* RC_DATA types for version info - optional */ #define NP_INFO_CompanyName 7 #define NP_INFO_FileVersion 8 #define NP_INFO_InternalName 9 #define NP_INFO_LegalCopyright 10 #define NP_INFO_OriginalFilename 11 #ifndef RC_INVOKED /*----------------------------------------------------------------------*/ /* Definition of Basic Types */ /*----------------------------------------------------------------------*/ typedef unsigned char NPBool; typedef int16_t NPError; typedef int16_t NPReason; typedef char* NPMIMEType; /*----------------------------------------------------------------------*/ /* Structures and definitions */ /*----------------------------------------------------------------------*/ #if !defined(__LP64__) #if defined(XP_MACOSX) #pragma options align=mac68k #endif #endif /* __LP64__ */ /* * NPP is a plug-in's opaque instance handle */ typedef struct _NPP { void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ } NPP_t; typedef NPP_t* NPP; typedef struct _NPStream { void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ const char* url; uint32_t end; uint32_t lastmodified; void* notifyData; const char* headers; /* Response headers from host. * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. * Used for HTTP only; NULL for non-HTTP. * Available from NPP_NewStream onwards. * Plugin should copy this data before storing it. * Includes HTTP status line and all headers, * preferably verbatim as received from server, * headers formatted as in HTTP ("Header: Value"), * and newlines (\n, NOT \r\n) separating lines. * Terminated by \n\0 (NOT \n\n\0). */ } NPStream; typedef struct _NPByteRange { int32_t offset; /* negative offset means from the end */ uint32_t length; struct _NPByteRange* next; } NPByteRange; typedef struct _NPSavedData { int32_t len; void* buf; } NPSavedData; typedef struct _NPRect { uint16_t top; uint16_t left; uint16_t bottom; uint16_t right; } NPRect; typedef struct _NPSize { int32_t width; int32_t height; } NPSize; typedef enum { NPFocusNext = 0, NPFocusPrevious = 1 } NPFocusDirection; /* Return values for NPP_HandleEvent */ #define kNPEventNotHandled 0 #define kNPEventHandled 1 /* Exact meaning must be spec'd in event model. */ #define kNPEventStartIME 2 #if defined(XP_UNIX) /* * Unix specific structures and definitions */ /* * Callback Structures. * * These are used to pass additional platform specific information. */ enum { NP_SETWINDOW = 1, NP_PRINT }; typedef struct { int32_t type; } NPAnyCallbackStruct; typedef struct { int32_t type; #if defined(MOZ_X11) Display* display; Visual* visual; Colormap colormap; unsigned int depth; #endif } NPSetWindowCallbackStruct; typedef struct { int32_t type; FILE* fp; } NPPrintCallbackStruct; #endif /* XP_UNIX */ #if defined(XP_MACOSX) typedef enum { #ifndef NP_NO_QUICKDRAW NPDrawingModelQuickDraw = 0, #endif NPDrawingModelCoreGraphics = 1, NPDrawingModelOpenGL = 2, NPDrawingModelCoreAnimation = 3, NPDrawingModelInvalidatingCoreAnimation = 4 } NPDrawingModel; typedef enum { #ifndef NP_NO_CARBON NPEventModelCarbon = 0, #endif NPEventModelCocoa = 1 } NPEventModel; #endif /* * The following masks are applied on certain platforms to NPNV and * NPPV selectors that pass around pointers to COM interfaces. Newer * compilers on some platforms may generate vtables that are not * compatible with older compilers. To prevent older plugins from * not understanding a new browser's ABI, these masks change the * values of those selectors on those platforms. To remain backwards * compatible with different versions of the browser, plugins can * use these masks to dynamically determine and use the correct C++ * ABI that the browser is expecting. This does not apply to Windows * as Microsoft's COM ABI will likely not change. */ #define NP_ABI_GCC3_MASK 0x10000000 /* * gcc 3.x generated vtables on UNIX and OSX are incompatible with * previous compilers. */ #if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK #else #define _NP_ABI_MIXIN_FOR_GCC3 0 #endif #if defined(XP_MACOSX) #define NP_ABI_MACHO_MASK 0x01000000 #define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK #else #define _NP_ABI_MIXIN_FOR_MACHO 0 #endif #define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) /* * List of variable names for which NPP_GetValue shall be implemented */ typedef enum { NPPVpluginNameString = 1, NPPVpluginDescriptionString, NPPVpluginWindowBool, NPPVpluginTransparentBool, NPPVjavaClass, NPPVpluginWindowSize, NPPVpluginTimerInterval, NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), NPPVpluginScriptableIID = 11, NPPVjavascriptPushCallerBool = 12, NPPVpluginKeepLibraryInMemory = 13, NPPVpluginNeedsXEmbed = 14, /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14. */ NPPVpluginScriptableNPObject = 15, /* Get the plugin value (as \0-terminated UTF-8 string data) for * form submission if the plugin is part of a form. Use * NPN_MemAlloc() to allocate memory for the string data. Introduced * in NPAPI minor version 15. */ NPPVformValue = 16, NPPVpluginUrlRequestsDisplayedBool = 17, /* Checks if the plugin is interested in receiving the http body of * all http requests (including failed ones, http status != 200). */ NPPVpluginWantsAllNetworkStreams = 18, /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */ NPPVpluginNativeAccessibleAtkPlugId = 19, /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ NPPVpluginCancelSrcStream = 20, NPPVsupportsAdvancedKeyHandling = 21, NPPVpluginUsesDOMForCursorBool = 22 #if defined(XP_MACOSX) /* Used for negotiating drawing models */ , NPPVpluginDrawingModel = 1000 /* Used for negotiating event models */ , NPPVpluginEventModel = 1001 /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ , NPPVpluginCoreAnimationLayer = 1003 #endif #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) , NPPVpluginWindowlessLocalBool = 2002 #endif } NPPVariable; /* * List of variable names for which NPN_GetValue should be implemented. */ typedef enum { NPNVxDisplay = 1, NPNVxtAppContext, NPNVnetscapeWindow, NPNVjavascriptEnabledBool, NPNVasdEnabledBool, NPNVisOfflineBool, NPNVserviceManager = (10 | NP_ABI_MASK), NPNVDOMElement = (11 | NP_ABI_MASK), NPNVDOMWindow = (12 | NP_ABI_MASK), NPNVToolkit = (13 | NP_ABI_MASK), NPNVSupportsXEmbedBool = 14, /* Get the NPObject wrapper for the browser window. */ NPNVWindowNPObject = 15, /* Get the NPObject wrapper for the plugins DOM element. */ NPNVPluginElementNPObject = 16, NPNVSupportsWindowless = 17, NPNVprivateModeBool = 18, NPNVsupportsAdvancedKeyHandling = 21, NPNVdocumentOrigin = 22 #if defined(XP_MACOSX) /* Used for negotiating drawing models */ , NPNVpluginDrawingModel = 1000 #ifndef NP_NO_QUICKDRAW , NPNVsupportsQuickDrawBool = 2000 #endif , NPNVsupportsCoreGraphicsBool = 2001 , NPNVsupportsOpenGLBool = 2002 , NPNVsupportsCoreAnimationBool = 2003 , NPNVsupportsInvalidatingCoreAnimationBool = 2004 #ifndef NP_NO_CARBON , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */ #endif , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated Cocoa text input specification. */ , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports CA model compositing */ #endif #if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) , NPNVSupportsWindowlessLocal = 2002 #endif } NPNVariable; typedef enum { NPNURLVCookie = 501, NPNURLVProxy } NPNURLVariable; /* * The type of Toolkit the widgets use */ typedef enum { NPNVGtk12 = 1, NPNVGtk2 } NPNToolkitType; /* * The type of a NPWindow - it specifies the type of the data structure * returned in the window field. */ typedef enum { NPWindowTypeWindow = 1, NPWindowTypeDrawable } NPWindowType; typedef struct _NPWindow { void* window; /* Platform specific window handle */ /* OS/2: x - Position of bottom left corner */ /* OS/2: y - relative to visible netscape window */ int32_t x; /* Position of top left corner relative */ int32_t y; /* to a netscape page. */ uint32_t width; /* Maximum window size */ uint32_t height; NPRect clipRect; /* Clipping rectangle in port coordinates */ #if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) void * ws_info; /* Platform-dependent additional data */ #endif /* XP_UNIX */ NPWindowType type; /* Is this a window or a drawable? */ } NPWindow; typedef struct _NPImageExpose { char* data; /* image pointer */ int32_t stride; /* Stride of data image pointer */ int32_t depth; /* Depth of image pointer */ int32_t x; /* Expose x */ int32_t y; /* Expose y */ uint32_t width; /* Expose width */ uint32_t height; /* Expose height */ NPSize dataSize; /* Data buffer size */ float translateX; /* translate X matrix value */ float translateY; /* translate Y matrix value */ float scaleX; /* scale X matrix value */ float scaleY; /* scale Y matrix value */ } NPImageExpose; typedef struct _NPFullPrint { NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ NPBool printOne; /* TRUE if plugin should print one copy to default printer */ void* platformPrint; /* Platform-specific printing info */ } NPFullPrint; typedef struct _NPEmbedPrint { NPWindow window; void* platformPrint; /* Platform-specific printing info */ } NPEmbedPrint; typedef struct _NPPrint { uint16_t mode; /* NP_FULL or NP_EMBED */ union { NPFullPrint fullPrint; /* if mode is NP_FULL */ NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ } print; } NPPrint; #if defined(XP_MACOSX) #ifndef NP_NO_CARBON typedef EventRecord NPEvent; #endif #elif defined(XP_SYMBIAN) typedef QEvent NPEvent; #elif defined(XP_WIN) typedef struct _NPEvent { uint16_t event; uintptr_t wParam; uintptr_t lParam; } NPEvent; #elif defined(XP_OS2) typedef struct _NPEvent { uint32_t event; uint32_t wParam; uint32_t lParam; } NPEvent; #elif defined(XP_UNIX) && defined(MOZ_X11) typedef XEvent NPEvent; #else typedef void* NPEvent; #endif #if defined(XP_MACOSX) typedef void* NPRegion; #ifndef NP_NO_QUICKDRAW typedef RgnHandle NPQDRegion; #endif typedef CGPathRef NPCGRegion; #elif defined(XP_WIN) typedef HRGN NPRegion; #elif defined(XP_UNIX) && defined(MOZ_X11) typedef Region NPRegion; #elif defined(XP_SYMBIAN) typedef QRegion* NPRegion; #else typedef void *NPRegion; #endif typedef struct _NPNSString NPNSString; typedef struct _NPNSWindow NPNSWindow; typedef struct _NPNSMenu NPNSMenu; #if defined(XP_MACOSX) typedef NPNSMenu NPMenu; #else typedef void *NPMenu; #endif typedef enum { NPCoordinateSpacePlugin = 1, NPCoordinateSpaceWindow, NPCoordinateSpaceFlippedWindow, NPCoordinateSpaceScreen, NPCoordinateSpaceFlippedScreen } NPCoordinateSpace; #if defined(XP_MACOSX) #ifndef NP_NO_QUICKDRAW typedef struct NP_Port { CGrafPtr port; int32_t portx; /* position inside the topmost window */ int32_t porty; } NP_Port; #endif /* NP_NO_QUICKDRAW */ /* * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics * as its drawing model. */ typedef struct NP_CGContext { CGContextRef context; void *window; /* A WindowRef under the Carbon event model. */ } NP_CGContext; /* * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its * drawing model. */ typedef struct NP_GLContext { CGLContextObj context; #ifdef NP_NO_CARBON NPNSWindow *window; #else void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */ #endif } NP_GLContext; typedef enum { NPCocoaEventDrawRect = 1, NPCocoaEventMouseDown, NPCocoaEventMouseUp, NPCocoaEventMouseMoved, NPCocoaEventMouseEntered, NPCocoaEventMouseExited, NPCocoaEventMouseDragged, NPCocoaEventKeyDown, NPCocoaEventKeyUp, NPCocoaEventFlagsChanged, NPCocoaEventFocusChanged, NPCocoaEventWindowFocusChanged, NPCocoaEventScrollWheel, NPCocoaEventTextInput } NPCocoaEventType; typedef struct _NPCocoaEvent { NPCocoaEventType type; uint32_t version; union { struct { uint32_t modifierFlags; double pluginX; double pluginY; int32_t buttonNumber; int32_t clickCount; double deltaX; double deltaY; double deltaZ; } mouse; struct { uint32_t modifierFlags; NPNSString *characters; NPNSString *charactersIgnoringModifiers; NPBool isARepeat; uint16_t keyCode; } key; struct { CGContextRef context; double x; double y; double width; double height; } draw; struct { NPBool hasFocus; } focus; struct { NPNSString *text; } text; } data; } NPCocoaEvent; #ifndef NP_NO_CARBON /* Non-standard event types that can be passed to HandleEvent */ enum NPEventType { NPEventType_GetFocusEvent = (osEvt + 16), NPEventType_LoseFocusEvent, NPEventType_AdjustCursorEvent, NPEventType_MenuCommandEvent, NPEventType_ClippingChangedEvent, NPEventType_ScrollingBeginsEvent = 1000, NPEventType_ScrollingEndsEvent }; #endif /* NP_NO_CARBON */ #endif /* XP_MACOSX */ /* * Values for mode passed to NPP_New: */ #define NP_EMBED 1 #define NP_FULL 2 /* * Values for stream type passed to NPP_NewStream: */ #define NP_NORMAL 1 #define NP_SEEK 2 #define NP_ASFILE 3 #define NP_ASFILEONLY 4 #define NP_MAXREADY (((unsigned)(~0)<<1)>>1) /* * Flags for NPP_ClearSiteData. */ #define NP_CLEAR_ALL 0 #define NP_CLEAR_CACHE (1 << 0) #if !defined(__LP64__) #if defined(XP_MACOSX) #pragma options align=reset #endif #endif /* __LP64__ */ /*----------------------------------------------------------------------*/ /* Error and Reason Code definitions */ /*----------------------------------------------------------------------*/ /* * Values of type NPError: */ #define NPERR_BASE 0 #define NPERR_NO_ERROR (NPERR_BASE + 0) #define NPERR_GENERIC_ERROR (NPERR_BASE + 1) #define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) #define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) #define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) #define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) #define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) #define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) #define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) #define NPERR_INVALID_PARAM (NPERR_BASE + 9) #define NPERR_INVALID_URL (NPERR_BASE + 10) #define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) #define NPERR_NO_DATA (NPERR_BASE + 12) #define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) #define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) #define NPERR_MALFORMED_SITE (NPERR_BASE + 15) /* * Values of type NPReason: */ #define NPRES_BASE 0 #define NPRES_DONE (NPRES_BASE + 0) #define NPRES_NETWORK_ERR (NPRES_BASE + 1) #define NPRES_USER_BREAK (NPRES_BASE + 2) /* * Don't use these obsolete error codes any more. */ #define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR #define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR #define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK /* * Version feature information */ #define NPVERS_HAS_STREAMOUTPUT 8 #define NPVERS_HAS_NOTIFICATION 9 #define NPVERS_HAS_LIVECONNECT 9 #define NPVERS_68K_HAS_LIVECONNECT 11 #define NPVERS_HAS_WINDOWLESS 11 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13 #define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 #define NPVERS_HAS_FORM_VALUES 15 #define NPVERS_HAS_POPUPS_ENABLED_STATE 16 #define NPVERS_HAS_RESPONSE_HEADERS 17 #define NPVERS_HAS_NPOBJECT_ENUM 18 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 #define NPVERS_HAS_ALL_NETWORK_STREAMS 20 #define NPVERS_HAS_URL_AND_AUTH_INFO 21 #define NPVERS_HAS_PRIVATE_MODE 22 #define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 #define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 #define NPVERS_HAS_URL_REDIRECT_HANDLING 26 #define NPVERS_HAS_CLEAR_SITE_DATA 27 /*----------------------------------------------------------------------*/ /* Function Prototypes */ /*----------------------------------------------------------------------*/ #if defined(__OS2__) #define NP_LOADDS _System #else #define NP_LOADDS #endif #ifdef __cplusplus extern "C" { #endif /* NPP_* functions are provided by the plugin and called by the navigator. */ #if defined(XP_UNIX) const char* NPP_GetMIMEDescription(void); #endif NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction); void NP_LOADDS NPP_LostFocus(NPP instance); void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); char** NP_LOADDS NPP_GetSitesWithData(void); /* NPN_* functions are provided by the navigator and called by the plugin. */ void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, const char* target, void* notifyData); NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, const char* target); NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData); NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file); NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream); int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer); NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); void NP_LOADDS NPN_Status(NPP instance, const char* message); const char* NP_LOADDS NPN_UserAgent(NPP instance); void* NP_LOADDS NPN_MemAlloc(uint32_t size); void NP_LOADDS NPN_MemFree(void* ptr); uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, void *value); NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, void *value); void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); void NP_LOADDS NPN_ForceRedraw(NPP instance); void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData); NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len); NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len); NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled); NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); #ifdef __cplusplus } /* end extern "C" */ #endif #endif /* RC_INVOKED */ #if defined(__OS2__) #pragma pack() #endif #endif /* npapi_h_ */ unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/npapi-headers/headers/nptypes.h0000644000015201777760000000740512312131641032314 0ustar pbusernogroup00000000000000/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * mozilla.org. * Portions created by the Initial Developer are Copyright (C) 2004 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Johnny Stenback (Original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nptypes_h_ #define nptypes_h_ /* * Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and * true/false macros are available. */ #if defined(WIN32) || defined(OS2) /* * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool * is predefined tho, both in C and C++. */ typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; #elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX) /* * AIX and SunOS ship a inttypes.h header that defines [u]int32_t, * but not bool for C. */ #include #ifndef __cplusplus typedef int bool; #define true 1 #define false 0 #endif #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) /* * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and * u_int32_t. */ #include /* * BSD/OS ships no header that defines uint32_t, nor bool (for C) */ #if defined(bsdi) typedef u_int32_t uint32_t; typedef u_int64_t uint64_t; #if !defined(__cplusplus) typedef int bool; #define true 1 #define false 0 #endif #else /* * FreeBSD and OpenBSD define uint32_t and bool. */ #include #include #endif #elif defined(BEOS) #include #else /* * For those that ship a standard C99 stdint.h header file, include * it. Can't do the same for stdbool.h tho, since some systems ship * with a stdbool.h file that doesn't compile! */ #include #ifndef __cplusplus #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95) #include #else /* * GCC 2.91 can't deal with a typedef for bool, but a #define * works. */ #define bool int #define true 1 #define false 0 #endif #endif #endif #endif /* nptypes_h_ */ unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/npapi-headers/headers/npruntime.h0000644000015201777760000003777612312131641032651 0ustar pbusernogroup00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla * Foundation ("Mozilla") nor the names of their contributors may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR * THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef _NP_RUNTIME_H_ #define _NP_RUNTIME_H_ #ifdef __cplusplus extern "C" { #endif #include "nptypes.h" /* This API is used to facilitate binding code written in C to script objects. The API in this header does not assume the presence of a user agent. That is, it can be used to bind C code to scripting environments outside of the context of a user agent. However, the normal use of the this API is in the context of a scripting environment running in a browser or other user agent. In particular it is used to support the extended Netscape script-ability API for plugins (NP-SAP). NP-SAP is an extension of the Netscape plugin API. As such we have adopted the use of the "NP" prefix for this API. The following NP{N|P}Variables were added to the Netscape plugin API (in npapi.h): NPNVWindowNPObject NPNVPluginElementNPObject NPPVpluginScriptableNPObject These variables are exposed through NPN_GetValue() and NPP_GetValue() (respectively) and are used to establish the initial binding between the user agent and native code. The DOM objects in the user agent can be examined and manipulated using the NPN_ functions that operate on NPObjects described in this header. To the extent possible the assumptions about the scripting language used by the scripting environment have been minimized. */ #define NP_BEGIN_MACRO do { #define NP_END_MACRO } while (0) /* Objects (non-primitive data) passed between 'C' and script is always wrapped in an NPObject. The 'interface' of an NPObject is described by an NPClass. */ typedef struct NPObject NPObject; typedef struct NPClass NPClass; typedef char NPUTF8; typedef struct _NPString { const NPUTF8 *UTF8Characters; uint32_t UTF8Length; } NPString; typedef enum { NPVariantType_Void, NPVariantType_Null, NPVariantType_Bool, NPVariantType_Int32, NPVariantType_Double, NPVariantType_String, NPVariantType_Object } NPVariantType; typedef struct _NPVariant { NPVariantType type; union { bool boolValue; int32_t intValue; double doubleValue; NPString stringValue; NPObject *objectValue; } value; } NPVariant; /* NPN_ReleaseVariantValue is called on all 'out' parameters references. Specifically it is to be called on variants that own their value, as is the case with all non-const NPVariant* arguments after a successful call to any methods (except this one) in this API. After calling NPN_ReleaseVariantValue, the type of the variant will be NPVariantType_Void. */ void NPN_ReleaseVariantValue(NPVariant *variant); #define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void) #define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null) #define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool) #define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32) #define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double) #define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String) #define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object) #define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue) #define NPVARIANT_TO_INT32(_v) ((_v).value.intValue) #define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue) #define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue) #define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue) #define VOID_TO_NPVARIANT(_v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Void; \ (_v).value.objectValue = NULL; \ NP_END_MACRO #define NULL_TO_NPVARIANT(_v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Null; \ (_v).value.objectValue = NULL; \ NP_END_MACRO #define BOOLEAN_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Bool; \ (_v).value.boolValue = !!(_val); \ NP_END_MACRO #define INT32_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Int32; \ (_v).value.intValue = _val; \ NP_END_MACRO #define DOUBLE_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Double; \ (_v).value.doubleValue = _val; \ NP_END_MACRO #define STRINGZ_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_String; \ NPString str = { _val, (uint32_t)(strlen(_val)) }; \ (_v).value.stringValue = str; \ NP_END_MACRO #define STRINGN_TO_NPVARIANT(_val, _len, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_String; \ NPString str = { _val, (uint32_t)(_len) }; \ (_v).value.stringValue = str; \ NP_END_MACRO #define OBJECT_TO_NPVARIANT(_val, _v) \ NP_BEGIN_MACRO \ (_v).type = NPVariantType_Object; \ (_v).value.objectValue = _val; \ NP_END_MACRO /* Type mappings (JavaScript types have been used for illustration purposes): JavaScript to C (NPVariant with type:) undefined NPVariantType_Void null NPVariantType_Null Boolean NPVariantType_Bool Number NPVariantType_Double or NPVariantType_Int32 String NPVariantType_String Object NPVariantType_Object C (NPVariant with type:) to JavaScript NPVariantType_Void undefined NPVariantType_Null null NPVariantType_Bool Boolean NPVariantType_Int32 Number NPVariantType_Double Number NPVariantType_String String NPVariantType_Object Object */ typedef void *NPIdentifier; /* NPObjects have methods and properties. Methods and properties are identified with NPIdentifiers. These identifiers may be reflected in script. NPIdentifiers can be either strings or integers, IOW, methods and properties can be identified by either strings or integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be compared using ==. In case of any errors, the requested NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled by the browser. Plugins do not need to worry about memory management with regards to NPIdentifiers. */ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name); void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers); NPIdentifier NPN_GetIntIdentifier(int32_t intid); bool NPN_IdentifierIsString(NPIdentifier identifier); /* The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed. */ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier); /* Get the integer represented by identifier. If identifier is not an integer identifier, the behaviour is undefined. */ int32_t NPN_IntFromIdentifier(NPIdentifier identifier); /* NPObject behavior is implemented using the following set of callback functions. The NPVariant *result argument of these functions (where applicable) should be released using NPN_ReleaseVariantValue(). */ typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass); typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj); typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj); typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name); typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name); typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, NPVariant *result); typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, const NPVariant *value); typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, NPIdentifier name); typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value, uint32_t *count); typedef bool (*NPConstructFunctionPtr)(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); /* NPObjects returned by create, retain, invoke, and getProperty pass a reference count to the caller. That is, the callee adds a reference count which passes to the caller. It is the caller's responsibility to release the returned object. NPInvokeFunctionPtr function may return 0 to indicate a void result. NPInvalidateFunctionPtr is called by the scripting environment when the native code is shutdown. Any attempt to message a NPObject instance after the invalidate callback has been called will result in undefined behavior, even if the native code is still retaining those NPObject instances. (The runtime will typically return immediately, with 0 or NULL, from an attempt to dispatch to a NPObject, but this behavior should not be depended upon.) The NPEnumerationFunctionPtr function may pass an array of NPIdentifiers back to the caller. The callee allocs the memory of the array using NPN_MemAlloc(), and it's the caller's responsibility to release it using NPN_MemFree(). */ struct NPClass { uint32_t structVersion; NPAllocateFunctionPtr allocate; NPDeallocateFunctionPtr deallocate; NPInvalidateFunctionPtr invalidate; NPHasMethodFunctionPtr hasMethod; NPInvokeFunctionPtr invoke; NPInvokeDefaultFunctionPtr invokeDefault; NPHasPropertyFunctionPtr hasProperty; NPGetPropertyFunctionPtr getProperty; NPSetPropertyFunctionPtr setProperty; NPRemovePropertyFunctionPtr removeProperty; NPEnumerationFunctionPtr enumerate; NPConstructFunctionPtr construct; }; #define NP_CLASS_STRUCT_VERSION 3 #define NP_CLASS_STRUCT_VERSION_ENUM 2 #define NP_CLASS_STRUCT_VERSION_CTOR 3 #define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \ ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM) #define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \ ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR) struct NPObject { NPClass *_class; uint32_t referenceCount; /* * Additional space may be allocated here by types of NPObjects */ }; /* If the class has an allocate function, NPN_CreateObject invokes that function, otherwise a NPObject is allocated and returned. This method will initialize the referenceCount member of the NPObject to 1. */ NPObject *NPN_CreateObject(NPP npp, NPClass *aClass); /* Increment the NPObject's reference count. */ NPObject *NPN_RetainObject(NPObject *npobj); /* Decremented the NPObject's reference count. If the reference count goes to zero, the class's destroy function is invoke if specified, otherwise the object is freed directly. */ void NPN_ReleaseObject(NPObject *npobj); /* Functions to access script objects represented by NPObject. Calls to script objects are synchronous. If a function returns a value, it will be supplied via the result NPVariant argument. Successful calls will return true, false will be returned in case of an error. Calls made from plugin code to script must be made from the thread on which the plugin was initialized. */ bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result); bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script, NPVariant *result); bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, NPVariant *result); bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value); bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName); bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); /* NPN_SetException may be called to trigger a script exception upon return from entry points into NPObjects. Typical usage: NPN_SetException (npobj, message); */ void NPN_SetException(NPObject *npobj, const NPUTF8 *message); #ifdef __cplusplus } #endif #endif unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/npapi-headers/headers/npfunctions.h0000644000015201777760000003752312312131641033164 0ustar pbusernogroup00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef npfunctions_h_ #define npfunctions_h_ #ifdef __OS2__ #pragma pack(1) #define NP_LOADDS _System #else #define NP_LOADDS #endif #include "npapi.h" #include "npruntime.h" typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save); typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window); typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname); typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint); typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event); typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData); /* Any NPObjects returned to the browser via NPP_GetValue should be retained by the plugin on the way out. The browser is responsible for releasing. */ typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value); typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value); typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction); typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance); typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData); typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge); typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void); typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value); typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value); typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData); typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData); typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window); typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file); typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList); typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer); typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message); /* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't depend on it sticking around and don't free it. */ typedef const char* (*NPN_UserAgentProcPtr)(NPP instance); typedef void* (*NPN_MemAllocProcPtr)(uint32_t size); typedef void (*NPN_MemFreeProcPtr)(void* ptr); typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size); typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages); typedef void* (*NPN_GetJavaEnvProcPtr)(void); typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance); typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect); typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region); typedef void (*NPN_ForceRedrawProcPtr)(NPP instance); typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name); typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers); typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid); typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier); typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier); typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier); typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass); typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj); typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj); typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result); typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result); typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value); typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant); typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message); typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled); typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp); typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count); typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData); typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len); typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len); typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID); typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu); typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled); typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction); typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow); typedef struct _NPPluginFuncs { uint16_t size; uint16_t version; NPP_NewProcPtr newp; NPP_DestroyProcPtr destroy; NPP_SetWindowProcPtr setwindow; NPP_NewStreamProcPtr newstream; NPP_DestroyStreamProcPtr destroystream; NPP_StreamAsFileProcPtr asfile; NPP_WriteReadyProcPtr writeready; NPP_WriteProcPtr write; NPP_PrintProcPtr print; NPP_HandleEventProcPtr event; NPP_URLNotifyProcPtr urlnotify; void* javaClass; NPP_GetValueProcPtr getvalue; NPP_SetValueProcPtr setvalue; NPP_GotFocusPtr gotfocus; NPP_LostFocusPtr lostfocus; NPP_URLRedirectNotifyPtr urlredirectnotify; NPP_ClearSiteDataPtr clearsitedata; NPP_GetSitesWithDataPtr getsiteswithdata; } NPPluginFuncs; typedef struct _NPNetscapeFuncs { uint16_t size; uint16_t version; NPN_GetURLProcPtr geturl; NPN_PostURLProcPtr posturl; NPN_RequestReadProcPtr requestread; NPN_NewStreamProcPtr newstream; NPN_WriteProcPtr write; NPN_DestroyStreamProcPtr destroystream; NPN_StatusProcPtr status; NPN_UserAgentProcPtr uagent; NPN_MemAllocProcPtr memalloc; NPN_MemFreeProcPtr memfree; NPN_MemFlushProcPtr memflush; NPN_ReloadPluginsProcPtr reloadplugins; NPN_GetJavaEnvProcPtr getJavaEnv; NPN_GetJavaPeerProcPtr getJavaPeer; NPN_GetURLNotifyProcPtr geturlnotify; NPN_PostURLNotifyProcPtr posturlnotify; NPN_GetValueProcPtr getvalue; NPN_SetValueProcPtr setvalue; NPN_InvalidateRectProcPtr invalidaterect; NPN_InvalidateRegionProcPtr invalidateregion; NPN_ForceRedrawProcPtr forceredraw; NPN_GetStringIdentifierProcPtr getstringidentifier; NPN_GetStringIdentifiersProcPtr getstringidentifiers; NPN_GetIntIdentifierProcPtr getintidentifier; NPN_IdentifierIsStringProcPtr identifierisstring; NPN_UTF8FromIdentifierProcPtr utf8fromidentifier; NPN_IntFromIdentifierProcPtr intfromidentifier; NPN_CreateObjectProcPtr createobject; NPN_RetainObjectProcPtr retainobject; NPN_ReleaseObjectProcPtr releaseobject; NPN_InvokeProcPtr invoke; NPN_InvokeDefaultProcPtr invokeDefault; NPN_EvaluateProcPtr evaluate; NPN_GetPropertyProcPtr getproperty; NPN_SetPropertyProcPtr setproperty; NPN_RemovePropertyProcPtr removeproperty; NPN_HasPropertyProcPtr hasproperty; NPN_HasMethodProcPtr hasmethod; NPN_ReleaseVariantValueProcPtr releasevariantvalue; NPN_SetExceptionProcPtr setexception; NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate; NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate; NPN_EnumerateProcPtr enumerate; NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall; NPN_ConstructProcPtr construct; NPN_GetValueForURLPtr getvalueforurl; NPN_SetValueForURLPtr setvalueforurl; NPN_GetAuthenticationInfoPtr getauthenticationinfo; NPN_ScheduleTimerPtr scheduletimer; NPN_UnscheduleTimerPtr unscheduletimer; NPN_PopUpContextMenuPtr popupcontextmenu; NPN_ConvertPointPtr convertpoint; NPN_HandleEventPtr handleevent; NPN_UnfocusInstancePtr unfocusinstance; NPN_URLRedirectResponsePtr urlredirectresponse; } NPNetscapeFuncs; #ifdef XP_MACOSX /* * Mac OS X version(s) of NP_GetMIMEDescription(const char *) * These can be called to retreive MIME information from the plugin dynamically * * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way * to get mime info from the plugin only on OSX and may not be supported * in furture version -- use NP_GetMIMEDescription instead */ enum { kBPSupportedMIMETypesStructVers_1 = 1 }; typedef struct _BPSupportedMIMETypes { SInt32 structVersion; /* struct version */ Handle typeStrings; /* STR# formated handle, allocated by plug-in */ Handle infoStrings; /* STR# formated handle, allocated by plug-in */ } BPSupportedMIMETypes; OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags); #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription" typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void); typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32); #endif #if defined(_WIN32) #define OSCALL WINAPI #else #if defined(__OS2__) #define OSCALL _System #else #define OSCALL #endif #endif #if defined(XP_UNIX) /* GCC 3.3 and later support the visibility attribute. */ #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default"))) #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) #define NP_VISIBILITY_DEFAULT __global #else #define NP_VISIBILITY_DEFAULT #endif #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type #endif #if defined(_WIN32) || defined (__OS2__) #ifdef __cplusplus extern "C" { #endif /* plugin meta member functions */ #if defined(__OS2__) typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */ char *pMimeTypes; char *pFileExtents; char *pFileOpenTemplate; char *pProductName; char *pProductDescription; unsigned long dwProductVersionMS; unsigned long dwProductVersionLS; } NPPluginData; typedef NPError (*NP_GetPluginDataFunc)(NPPluginData*); NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData); #endif typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*); NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs); typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*); NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs); typedef NPError (*NP_ShutdownFunc)(void); NPError OSCALL NP_Shutdown(void); typedef const char* (*NP_GetMIMEDescriptionFunc)(void); const char* NP_GetMIMEDescription(void); #ifdef __cplusplus } #endif #endif #if defined(__OS2__) #pragma pack() #endif #ifdef XP_UNIX #ifdef __cplusplus extern "C" { #endif typedef char* (*NP_GetPluginVersionFunc)(void); NP_EXPORT(char*) NP_GetPluginVersion(void); typedef const char* (*NP_GetMIMEDescriptionFunc)(void); NP_EXPORT(const char*) NP_GetMIMEDescription(void); #ifdef XP_MACOSX typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*); NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs); typedef NPError (*NP_GetEntryPointsFunc)(NPPluginFuncs*); NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs); #else typedef NPError (*NP_InitializeFunc)(NPNetscapeFuncs*, NPPluginFuncs*); NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs); #endif typedef NPError (*NP_ShutdownFunc)(void); NP_EXPORT(NPError) NP_Shutdown(void); typedef NPError (*NP_GetValueFunc)(void *, NPPVariable, void *); NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue); #ifdef __cplusplus } #endif #endif #endif /* npfunctions_h_ */ unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin-pp-funcs.c0000644000015201777760000001301612312131641031747 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin-pp-funcs.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include "unity-npapi-plugin.h" #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "unity-webapps-scriptable-object.h" // TODO figure out what to do w/ this // This is a Gecko type typedef enum { PR_FALSE = 0, PR_TRUE = 1 } PRBool; static unity_npapi_plugin_t * plugin_allocate (); static void plugin_delete (unity_npapi_plugin_t *); /** * new plugin instance being created */ NPError NPP_New (NPMIMEType pluginType, NPP npp, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved) { if (NULL == npp) { return NPERR_INVALID_INSTANCE_ERROR; } NPError rv = NPERR_NO_ERROR; { // TODO avoid individual steps unity_npapi_plugin_t * pPlugin = plugin_allocate (); pPlugin->npp = npp; npp->pdata = pPlugin; } return rv; } // Deletes a specific instance of a plug-in. NPError NPP_Destroy (NPP instance, NPSavedData **save) { NPError rv = NPERR_INVALID_INSTANCE_ERROR; if (NULL == instance || NULL == instance->pdata) { return rv; } plugin_delete (instance->pdata); return NPERR_NO_ERROR; } NPError NPP_SetWindow(NPP instance, NPWindow *window) { // not really interested NPError rv = NPERR_NO_ERROR; return rv; } NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype) { // not really interested NPError rv = NPERR_NO_ERROR; return rv; } NPError NPP_DestroyStream (NPP instance, NPStream* stream, NPReason reason) { // not really interested NPError rv = NPERR_NO_ERROR; return rv; } void NPP_StreamAsFile (NPP instance, NPStream* stream, const char* fname) { // not really interested } int32_t NPP_WriteReady (NPP instance, NPStream* stream) { // not really interested return 0; } int32_t NPP_Write (NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buf) { // not really interested return 0; } void NPP_Print (NPP instance, NPPrint* PrintInfo) { // not really interested } int16_t NPP_HandleEvent(NPP instance, void* event) { // not really interested return 0; } void NPP_URLNotify (NPP instance, const char* url, NPReason reason, void* notifyData) { // not really interested } NPError NPP_GetValue (NPP instance, NPPVariable variable, void *value) { NPError rv = NPERR_INVALID_INSTANCE_ERROR; if (NULL == instance || NULL == value) { return rv; } rv = NPERR_NO_ERROR; // TODO: some of it kind of redundant w/ what's in the NP_GetValue func ... check which one matters switch(variable) { case NPPVpluginNameString: { *((char **)value) = "Name"; } break; case NPPVpluginDescriptionString: // Plugin description { *((char **)value) = "Description"; } break; case NPPVpluginScriptableNPObject:// Scriptable plugin interface (for accessing from javascript) { NPObject * object = unity_webapps_npapi_create_unity_webapps_object (instance); // TODO what about NULL? if (NULL != object) { // NPN_RetainObject (object); } *(NPObject **)value = object; } break; case NPPVpluginWindowBool: { // default // TODO does it matter? *((PRBool *) value) = true; } break; case NPPVpluginNeedsXEmbed: { // Chromium sort of require this, we must handle this case. NPBool support = false; NPN_GetValue (instance, NPNVSupportsXEmbedBool, &support); *((NPBool *) value) = support; rv = NPERR_NO_ERROR; } break; default: rv = NPERR_NO_ERROR; } return rv; } NPError NPP_SetValue (NPP instance, NPNVariable variable, void *value) { NPError rv = NPERR_INVALID_INSTANCE_ERROR; if (NULL == instance || NULL == value) { return rv; } rv = NPERR_NO_ERROR; return rv; } static unity_npapi_plugin_t * plugin_allocate () { unity_npapi_plugin_t * pPlugin = g_malloc0 (sizeof (unity_npapi_plugin_t)); if (pPlugin) { pPlugin->retained_objects = g_hash_table_new (g_direct_hash, g_direct_equal); } return pPlugin; } static void plugin_delete (unity_npapi_plugin_t * pPlugin) { if (pPlugin) { if (pPlugin->retained_objects) { unity_npapi_free_all_retained_objects (pPlugin); g_hash_table_destroy (pPlugin->retained_objects); } g_free (pPlugin); } } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-debug.h0000644000015201777760000000235312312131641030015 0ustar pbusernogroup00000000000000/* * unity-webapps-binding.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_NPAPI_DEBUG_H) #define UNITY_NPAPI_DEBUG_H #ifdef NPAPI_DEBUG_ENABLED # define NPAPI_LOG(type,...) \ { \ gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \ g_free (_fmt); \ } #else # define NPAPI_LOG(type,...) #endif // NPAPI_DEBUG_ENABLED #endif // UNITY_NPAPI_DEBUG_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-binding-utils.h0000644000015201777760000000416012312131641031475 0ustar pbusernogroup00000000000000/* * unity-webapps-binding.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_WEBAPPS_BINDING_UTILS_H) #define UNITY_WEBAPPS_BINDING_UTILS_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/nptypes.h" #define REACHED_UNITY_WEBAPPS_FUNC_CALL() \ if (unity_webapps_binding_test_is_test_mode_on()) \ { \ unity_webapps_binding_test_reached_func_call (); \ return result; \ } \ do {} while (false) #define ADD_NPOBJECT_RETAIN_FOR_CONTEXT(npp,context,object) \ if (! unity_webapps_binding_test_is_test_mode_on()) \ { \ unity_npapi_plugin_t * pPlugin = (unity_npapi_plugin_t *) npp->pdata; \ if (NULL != pPlugin) \ { \ unity_npapi_add_retained_objects_for_context (pPlugin,context,object); \ } \ } /** * Checks if a given NPVariant's value is fo null of voif "type" * */ bool is_null_or_void (NPVariant variant); /** * Extracts the string from a given NPVariant. The returned chunk * of memory needs to be freed. * * @return null terminated string or NULL (in case of error) */ gchar * create_safe_string_for (const NPVariant * const pVariant); /** * Checks is a given NPVariant is of a type "compatible" or * coertible to a boolean type. The criteria are pretty broad. * */ gboolean is_boolean_convertible_value (NPVariant variant); gboolean extract_boolean_value_from (NPVariant variant); #endif // UNITY_WEBAPPS_BINDING_UTILS_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/wrapped-ptr-type.c0000644000015201777760000001324612312131641027676 0ustar pbusernogroup00000000000000/* * wrapped-ptr-type.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include "wrapped-ptr-type.h" static bool NPClass_HasMethod (NPObject *npobj, NPIdentifier name); static NPObject * NPClass_Allocate (NPP npp, NPClass *aClass); static bool NPClass_Invoke (NPObject *npobj , NPIdentifier name , const NPVariant *args , uint32_t argCount , NPVariant *result); static bool NPClass_InvokeDefault (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); static bool NPClass_HasProperty (NPObject * npobj, NPIdentifier name); static bool NPClass_GetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result); static bool NPClass_SetProperty (NPObject *npobj, NPIdentifier name, const NPVariant *value); static bool NPClass_RemoveProperty (NPObject *npobj, NPIdentifier name); static bool NPClass_Enumerate (NPObject *npobj, NPIdentifier **identifier, uint32_t *count); static bool NPClass_Construct (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); static void NPClass_Deallocate (NPObject *npobj); static void NPClass_Invalidate (NPObject *npobj); static NPClass wrapped_ptr_class = { .structVersion = NP_CLASS_STRUCT_VERSION, .allocate = NPClass_Allocate, .deallocate = NPClass_Deallocate, .invalidate = NPClass_Invalidate, .hasMethod = NPClass_HasMethod, .invoke = NPClass_Invoke, .invokeDefault = NPClass_InvokeDefault, .hasProperty = NPClass_HasProperty, .getProperty = NPClass_GetProperty, .setProperty = NPClass_SetProperty, .removeProperty = NPClass_RemoveProperty, .enumerate = NPClass_Enumerate, .construct = NPClass_Construct }; /////////////////////////////////////////////////////// // // public // /////////////////////////////////////////////////////// NPObject * create_wrapped_ptr_object_for (NPP instance, void * pWrappingValue) { g_return_val_if_fail(NULL != pWrappingValue, NULL); NPObject * pObject = NPN_CreateObject (instance, &wrapped_ptr_class); g_return_val_if_fail(NULL != pObject, NULL); ((wrapped_void_ptr_t *) pObject)->pWrapped = pWrappingValue; ((wrapped_void_ptr_t *) pObject)->instance = instance; return pObject; } /////////////////////////////////////////////////////// // // private // /////////////////////////////////////////////////////// static NPVariant to_string_method (wrapped_void_ptr_t * pWrapped , const char * const name , int argcnt , const NPVariant args[]) { // watch out w/ UTF8 NPVariant result; g_return_val_if_fail(NULL != pWrapped, result); char stringified[64] = {0}; g_snprintf(stringified, sizeof(stringified), "%p", pWrapped->pWrapped); const size_t size = strlen(stringified) + 1; char * returnValue = NPN_MemAlloc(size); memset(returnValue, 0, size); strncpy(returnValue, stringified, strlen(stringified)); STRINGZ_TO_NPVARIANT(returnValue, result); return result; } static NPObject * NPClass_Allocate (NPP npp, NPClass *aClass) { if (NULL == npp || NULL == npp->pdata) { // TODO error handling return NULL; } wrapped_void_ptr_t * pObject = malloc (sizeof (wrapped_void_ptr_t)); return (NPObject*) pObject; } static void NPClass_Deallocate (NPObject *npobj) { free (npobj); } static void NPClass_Invalidate (NPObject *npobj) { // TODO } static bool NPClass_HasMethod (NPObject *npobj, NPIdentifier name) { char * methodname = NPN_UTF8FromIdentifier (name); bool hasmethod = (0 == strncmp (methodname, "toString", strlen("toString"))); NPN_MemFree (methodname); return hasmethod; } static bool NPClass_Invoke (NPObject *npobj , NPIdentifier name , const NPVariant *args , uint32_t argCount , NPVariant *result) { if ( ! NPClass_HasMethod (npobj, name)) { return false; } char * methodname = NPN_UTF8FromIdentifier (name); if (0 == strncmp (methodname, "toString", strlen("toString"))) { *result = to_string_method ((wrapped_void_ptr_t *) npobj, name, argCount, args); return true; } return false; } static bool NPClass_InvokeDefault (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { // not invokable return false; } static bool NPClass_HasProperty (NPObject * npobj, NPIdentifier name) { // no properties return false; } static bool NPClass_GetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result) { // no properties return false; } static bool NPClass_SetProperty (NPObject *npobj, NPIdentifier name, const NPVariant *value) { // no properties return false; } static bool NPClass_RemoveProperty (NPObject *npobj, NPIdentifier name) { // no properties return false; } static bool NPClass_Enumerate (NPObject *npobj, NPIdentifier **identifier, uint32_t *count) { // no properties/methods return false; } static bool NPClass_Construct (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { // no need for specific construct return false; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-base-js-object.c0000644000015201777760000003171012312131641032043 0ustar pbusernogroup00000000000000/* * unity-webapps-base-js-object.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include // TODO remove #include #include "npapi-headers/headers/npfunctions.h" #include "npapi-headers/headers/nptypes.h" #include "npapi-headers/headers/npruntime.h" #include "unity-webapps-base-js-object.h" #include "unity-npapi-common.h" #include "unity-npapi-debug.h" static bool NPClass_HasMethod (NPObject *npobj, NPIdentifier name); static NPObject * NPClass_Allocate (NPP npp, NPClass *aClass); static bool NPClass_Invoke (NPObject *npobj , NPIdentifier name , const NPVariant *args , uint32_t argCount , NPVariant *result); static bool NPClass_InvokeDefault (NPObject *npobj , const NPVariant *args , uint32_t argCount , NPVariant *result); static bool NPClass_HasProperty (NPObject * npobj , NPIdentifier name); static bool NPClass_GetProperty (NPObject *npobj , NPIdentifier name , NPVariant *result); static bool NPClass_SetProperty (NPObject *npobj , NPIdentifier name , const NPVariant *value); static bool NPClass_RemoveProperty (NPObject *npobj , NPIdentifier name); static bool NPClass_Enumerate (NPObject *npobj , NPIdentifier **identifier , uint32_t *count); static bool NPClass_Construct (NPObject *npobj , const NPVariant *args , uint32_t argCount , NPVariant *result); static void NPClass_Deallocate (NPObject *npobj); static void NPClass_Invalidate (NPObject *npobj); static NPClass js_object_class = { .structVersion = NP_CLASS_STRUCT_VERSION, .allocate = NPClass_Allocate, .deallocate = NPClass_Deallocate, .invalidate = NPClass_Invalidate, .hasMethod = NPClass_HasMethod, .invoke = NPClass_Invoke, .invokeDefault = NPClass_InvokeDefault, .hasProperty = NPClass_HasProperty, .getProperty = NPClass_GetProperty, .setProperty = NPClass_SetProperty, .removeProperty = NPClass_RemoveProperty, .enumerate = NPClass_Enumerate, .construct = NPClass_Construct }; static NPVariant to_string_method (NPP instance , NPObject * object , const NPVariant args[] , uint32_t argcnt); /////////////////////////////////////////////////////// // // public // /////////////////////////////////////////////////////// NPObject * unity_webapps_npapi_create_js_object (NPP instance, const char * const name) { NPObject * pObject = NPN_CreateObject (instance, &js_object_class); g_return_val_if_fail (pObject != NULL, NULL); UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) pObject; pWrapper->methods = g_hash_table_new (g_str_hash, g_str_equal); pWrapper->properties = g_hash_table_new (g_str_hash, g_str_equal); pWrapper->name = g_strdup (name); pWrapper->instance = instance; unity_webapps_npapi_add_method (pWrapper, "toString", to_string_method); return pObject; } void unity_webapps_npapi_add_array_support (UnityWebappsJavascriptObjectWrapper * pWrapper , UnityWebAppsNpapiIndexedGetPtr access) { g_return_if_fail (NULL != pWrapper); pWrapper->array_access = access; } void unity_webapps_npapi_set_deallocator (UnityWebappsJavascriptObjectWrapper * pWrapper , UnityWebappsDeallocatorPtr deallocator) { g_return_if_fail (NULL != pWrapper); pWrapper->deallocator = deallocator; } // retains name param void unity_webapps_npapi_add_method (UnityWebappsJavascriptObjectWrapper * pWrapper , const char * const name , UnityWebAppsNpapiMethodPtr pMethod) { g_return_if_fail (NULL != pWrapper); g_return_if_fail (NULL != name || 0 == strlen(name)); g_return_if_fail (NULL != pMethod); g_return_if_fail (NULL != pWrapper->methods); g_hash_table_insert (pWrapper->methods, g_strdup (name), pMethod); } // retains name param void unity_webapps_npapi_add_property (UnityWebappsJavascriptObjectWrapper * pWrapper , const char * const name , UnityWebAppsNpapiPropertyGetPtr get , UnityWebAppsNpapiPropertySetPtr set) { g_return_if_fail (NULL != pWrapper); g_return_if_fail (NULL != name || 0 == strlen(name)); g_return_if_fail (NULL != get || NULL != set); g_return_if_fail (NULL != pWrapper->properties); UnityWebAppsNpapiPropertyDescr * property = g_malloc0 (sizeof (UnityWebAppsNpapiPropertyDescr)); g_return_if_fail (NULL != property); property->get = get; property->set = set; g_hash_table_insert (pWrapper->properties, g_strdup (name), property); } /////////////////////////////////////////////////////// // // private // /////////////////////////////////////////////////////// static void free_property (UnityWebAppsNpapiPropertyDescr * property) { g_return_if_fail (NULL != property); g_free (property); } static NPVariant to_string_method (NPP instance , NPObject * object , const NPVariant args[] , uint32_t argcnt) { UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) object; // watch out w/ UTF8 NPVariant result; NULL_TO_NPVARIANT (result); g_return_val_if_fail (NULL != pWrapper, result); static const char * const format = "[Object - %s]"; char * object_descr = pWrapper->name != NULL ? pWrapper->name : "Unknown"; gsize size = strlen(format) + 1 + strlen(object_descr) + 1; char * name = g_malloc0 (size); g_snprintf (name, size, format, object_descr); char * returnValue = NPN_MemAlloc (size); memset (returnValue, 0, size); strncpy (returnValue, name, strlen(name)); STRINGZ_TO_NPVARIANT(returnValue, result); g_free (name); return result; } static NPObject * NPClass_Allocate (NPP npp, NPClass *aClass) { g_return_val_if_fail (NULL != npp, NULL); NPObject * pObject = g_malloc0 (sizeof (UnityWebappsJavascriptObjectWrapper)); return pObject; } static void NPClass_Deallocate (NPObject *npobj) { g_return_if_fail (NULL != npobj); UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) npobj; // call custom deallocator if any if (NULL != pWrapper->deallocator) { pWrapper->deallocator (pWrapper->instance, npobj); } void free_one_method (gpointer key, gpointer value, gpointer user_data) { g_free (key); } if (pWrapper->methods) { g_hash_table_foreach (pWrapper->methods, free_one_method, NULL); g_hash_table_destroy (pWrapper->methods); } void free_one_property (gpointer key, gpointer value, gpointer user_data) { g_free (key); free_property (value); } if (pWrapper->properties) { g_hash_table_foreach (pWrapper->properties, free_one_property, NULL); g_hash_table_destroy (pWrapper->properties); } g_free (pWrapper->name); g_free (pWrapper); } static void NPClass_Invalidate (NPObject *npobj) { // TODO } static bool NPClass_HasMethod (NPObject *npobj, NPIdentifier name) { NPAPI_LOG (INFO, "%s", __func__); UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) npobj; g_return_val_if_fail (NULL != pWrapper, false); if ( ! NPN_IdentifierIsString (name)) { return NULL != pWrapper->array_access; } char * methodname = NPN_UTF8FromIdentifier (name); bool hasMethod = (NULL != g_hash_table_lookup (pWrapper->methods, methodname)); NPAPI_LOG (INFO, "%s %s %s", __func__, methodname, hasMethod ? "true" : "false"); NPN_MemFree (methodname); return hasMethod; } static bool NPClass_Invoke (NPObject *npobj , NPIdentifier name , const NPVariant *args , uint32_t argCount , NPVariant *result) { NPAPI_LOG (INFO, "%s", __func__); UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) npobj; // 1. if array access if ( ! NPN_IdentifierIsString (name)) { if (NULL == pWrapper->array_access) { return false; } *result = pWrapper->array_access (pWrapper->instance , npobj , NPN_IntFromIdentifier (name)); return true; } // 2. regular method call if ( ! NPClass_HasMethod (npobj, name)) { return false; } char * methodname = NPN_UTF8FromIdentifier (name); NPAPI_LOG (INFO, "%s %s", __func__, methodname); if (NULL == pWrapper->methods) { NPN_MemFree (methodname); return false; } UnityWebAppsNpapiMethodPtr method = g_hash_table_lookup (pWrapper->methods, methodname); if (NULL == method) { NPN_MemFree (methodname); return false; } *result = method (pWrapper->instance, npobj, (NPVariant*) args, argCount); NPN_MemFree (methodname); return true; } static bool NPClass_InvokeDefault (NPObject *npobj , const NPVariant *args , uint32_t argCount , NPVariant *result) { NPAPI_LOG (INFO, "%s", __func__); return false; } static bool NPClass_HasProperty (NPObject * npobj, NPIdentifier name) { UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) npobj; g_return_val_if_fail (NULL != pWrapper, false); if ( ! NPN_IdentifierIsString (name)) { return NULL != pWrapper->array_access; } char * propertyname = NPN_UTF8FromIdentifier (name); bool hasproperty = (NULL != g_hash_table_lookup (pWrapper->properties, propertyname)); NPN_MemFree (propertyname); return hasproperty; } static bool NPClass_GetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result) { UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) npobj; g_return_val_if_fail (NULL != pWrapper, false); if ( ! NPN_IdentifierIsString (name)) { if (NULL == pWrapper->array_access) { return false; } *result = pWrapper->array_access (pWrapper->instance , npobj , NPN_IntFromIdentifier (name)); return true; } if ( ! NPClass_HasProperty (npobj, name)) { return false; } char * propertyname = NPN_UTF8FromIdentifier (name); NPAPI_LOG (INFO, "%s %s", __func__, propertyname); if (NULL == pWrapper->properties) { NPN_MemFree (propertyname); return false; } UnityWebAppsNpapiPropertyDescr * property = g_hash_table_lookup (pWrapper->properties, propertyname); if (NULL == property || NULL == property->get) { NPN_MemFree (propertyname); return false; } *result = property->get (npobj); NPN_MemFree (propertyname); return true; } static bool NPClass_SetProperty (NPObject *npobj, NPIdentifier name, const NPVariant *value) { if ( ! NPClass_HasProperty (npobj, name)) { return false; } char * propertyname = NPN_UTF8FromIdentifier (name); UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) npobj; if (NULL == pWrapper->properties) { NPN_MemFree (propertyname); return false; } UnityWebAppsNpapiPropertyDescr * property = g_hash_table_lookup (pWrapper->properties, propertyname); if (NULL == property || NULL == property->set) { NPN_MemFree (propertyname); return false; } bool result = property->set (npobj, value); NPN_MemFree (propertyname); return result; } static bool NPClass_RemoveProperty (NPObject *npobj, NPIdentifier name) { if ( ! NPClass_HasProperty (npobj, name)) { return false; } char * propertyname = NPN_UTF8FromIdentifier (name); UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) npobj; if (NULL == pWrapper->properties) { NPN_MemFree (propertyname); return false; } UnityWebAppsNpapiPropertyDescr * property = g_hash_table_lookup (pWrapper->properties, propertyname); if (NULL == property) { NPN_MemFree (propertyname); return false; } free_property (property); bool result = g_hash_table_remove (pWrapper->properties, property); NPN_MemFree (propertyname); return result; } static bool NPClass_Enumerate (NPObject *npobj, NPIdentifier **identifier, uint32_t *count) { // no properties/methods return false; } static bool NPClass_Construct (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { // no need for specific construct return false; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-binding-dispatcher.c0000644000015201777760000002371312312131641033015 0ustar pbusernogroup00000000000000/* * unity-webapps-binding-dispatcher.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "unity-webapps-binding.h" #include "unity-webapps-repository-binding.h" #include "notify-binding.h" #include "unity-webapps-binding-dispatcher.h" #include "unity-npapi-common.h" #include "unity-npapi-debug.h" typedef char * CallableName; typedef struct PluginCallableItem_t { CallableName name; UnityWebAppsNpapiMethodPtr dispatch_func; // TODO add generic arg type verification } PluginCallableItem; #define DECLARE_BINDING(binding_function_prefix,binding_function_name) \ { \ .name = #binding_function_name \ , .dispatch_func = (UnityWebAppsNpapiMethodPtr) binding_function_prefix##binding_function_name \ } #define DECLARE_UNITY_WEBAPPS_BINDING(binding_function_name) \ DECLARE_BINDING(unity_webapps_binding_,binding_function_name) #define DECLARE_NOTIFY_BINDING(binding_function_name) \ DECLARE_BINDING(binding_notify_,binding_function_name) static PluginCallableItem plugin_callable_items [] = { DECLARE_UNITY_WEBAPPS_BINDING(context_new_lazy) , DECLARE_UNITY_WEBAPPS_BINDING(context_prepare) , DECLARE_UNITY_WEBAPPS_BINDING(context_new_sync) , DECLARE_UNITY_WEBAPPS_BINDING(context_destroy) , DECLARE_UNITY_WEBAPPS_BINDING(context_get_interest_id) , DECLARE_UNITY_WEBAPPS_BINDING(context_get_name) , DECLARE_UNITY_WEBAPPS_BINDING(context_get_domain) , DECLARE_UNITY_WEBAPPS_BINDING(service_new) , DECLARE_UNITY_WEBAPPS_BINDING(service_destroy_interest_for_context) , DECLARE_UNITY_WEBAPPS_BINDING(context_add_icon) , DECLARE_UNITY_WEBAPPS_BINDING(context_set_view_is_active) , DECLARE_UNITY_WEBAPPS_BINDING(context_set_view_location) , DECLARE_UNITY_WEBAPPS_BINDING(context_on_raise_callback) , DECLARE_UNITY_WEBAPPS_BINDING(context_on_close_callback) , DECLARE_UNITY_WEBAPPS_BINDING(context_set_preview_requested_callback) , DECLARE_UNITY_WEBAPPS_BINDING(context_add_application_actions) , DECLARE_UNITY_WEBAPPS_BINDING(context_set_application_accept_data) , DECLARE_UNITY_WEBAPPS_BINDING(context_remove_application_action) , DECLARE_UNITY_WEBAPPS_BINDING(context_remove_application_actions) , DECLARE_UNITY_WEBAPPS_BINDING(permissions_allow_domain) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_init) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_on_play_pause_callback) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_on_previous_callback) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_on_next_callback) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_set_track) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_set_can_pause) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_set_can_play) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_set_can_go_next) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_set_can_go_previous) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_set_playback_state) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_get_can_pause) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_get_can_play) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_get_can_go_next) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_get_can_go_previous) , DECLARE_UNITY_WEBAPPS_BINDING(music_player_get_playback_state) , DECLARE_UNITY_WEBAPPS_BINDING(notification_show_notification) , DECLARE_UNITY_WEBAPPS_BINDING(permissions_get_domain_allowed) , DECLARE_UNITY_WEBAPPS_BINDING(permissions_get_domain_preauthorized) , DECLARE_UNITY_WEBAPPS_BINDING(permissions_allow_domain) , DECLARE_UNITY_WEBAPPS_BINDING(permissions_get_domain_dontask) , DECLARE_UNITY_WEBAPPS_BINDING(permissions_is_integration_allowed) , DECLARE_UNITY_WEBAPPS_BINDING(permissions_dontask_domain) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_set_count) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_clear_count) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_set_progress) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_clear_progress) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_set_urgent) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_add_action) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_remove_action) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_remove_actions) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_add_static_action) , DECLARE_UNITY_WEBAPPS_BINDING(launcher_remove_static_actions) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_show_indicator) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_clear_indicator) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_clear_indicators) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_set_callback) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_set_property) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_set_property_icon) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_add_action) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_get_presence) , DECLARE_UNITY_WEBAPPS_BINDING(indicator_on_presence_changed_callback) , DECLARE_UNITY_WEBAPPS_BINDING(context_set_homepage) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_new_default) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_prepare) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_resolve_url_as_json) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_get_resolved_application_status) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_get_userscript_contents) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_install_application) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_get_resolved_application_domain) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_get_resolved_application_name) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_generate_desktop_for_url_launch) , DECLARE_UNITY_WEBAPPS_BINDING(application_repository_add_desktop_to_launcher) , DECLARE_UNITY_WEBAPPS_BINDING(service_set_xid_for_browser_window_id) , DECLARE_NOTIFY_BINDING(notification_init) , DECLARE_NOTIFY_BINDING(notification_is_initted) , DECLARE_NOTIFY_BINDING(notification_new) , DECLARE_NOTIFY_BINDING(notification_show) , DECLARE_NOTIFY_BINDING(notification_destroy) }; static void for_each_callable_binding (bool (*f) (PluginCallableItem *)); //////////////////////////////////////////////////////////// // // public functions // //////////////////////////////////////////////////////////// bool webapps_binding_is_method_supported (const char * const name) { bool isCallable = false; // TODO mmmh use a proper "type safe" name specific macro to avoid NULL comparaison // on abstract type, same w/ strlen if (NULL == name || 0 == strlen (name)) { return isCallable; } bool isfound (PluginCallableItem * callable) { // TODO should assert for NULL if (NULL == callable) { // TODO BAD return false; } // TODO check a safer version isCallable = (0 == g_strcmp0 (name, callable->name)); // continue only is callable is false return ! isCallable; } NPAPI_LOG (INFO, "%s: %s", __func__, name); for_each_callable_binding (isfound); return isCallable; } NPVariant webapps_binding_dispatch_method_call (NPP instance , const char * const name , int argcnt , const NPVariant args[] , void (*logger) (const char * const s)) { NPAPI_LOG (INFO, "webapps_binding_dispatch_method_call %s, count %d", name, argcnt); PluginCallableItem * item = NULL; // TODO mmmh use a proper "type safe" name specific macro to avoid NULL comparaison // on abstract type, same w/ strlen if (NULL == name || 0 == strlen (name)) { // TODO use exceptions NPVariant result; NULL_TO_NPVARIANT(result); return result; } bool findmethod (PluginCallableItem * currentItem) { // TODO should assert for NULL if (NULL == currentItem) { // TODO BAD return false; } // TODO check a safer version if (0 == g_strcmp0 (name, currentItem->name)) { item = currentItem; } return item == NULL; } for_each_callable_binding (findmethod); if (NULL == item || NULL == item->dispatch_func) { // TODO exception NPVariant result; NULL_TO_NPVARIANT(result); return result; } // actuall call NPVariant result = (*item->dispatch_func) (instance, NULL, &args[0], argcnt); return result; } void webapps_binding_for_each (void (*f) (const char * const name, UnityWebAppsNpapiMethodPtr)) { g_return_if_fail (NULL != f); bool priv_for_each (PluginCallableItem * currentItem) { if (NULL != currentItem) { f (currentItem->name, currentItem->dispatch_func); } return true; } for_each_callable_binding (priv_for_each); } //////////////////////////////////////////////////////////// // // private // //////////////////////////////////////////////////////////// /** * @param f function pointer. Gets a callable item for each registered element found. * Should return false when the each look is supposed to be stopped (true otherwise). */ static void for_each_callable_binding (bool (*f) (PluginCallableItem *)) { g_return_if_fail (NULL != f); for (size_t i = 0 ; i < G_N_ELEMENTS(plugin_callable_items) ; ++i) { if (false == f (&plugin_callable_items[i])) { break; } } } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin-entry-funcs.c0000644000015201777760000000553512312131641032500 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin-entry-funcs.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include "unity-npapi-plugin.h" #include "unity-npapi-plugin-pp-funcs.h" // TODO bind all this to project specific defines // TODO review for better compliance : http://gplflash.sourceforge.net/gplflash2_blog/npapi.html, the format DOES matter (at least for chrome) static const char * UNITY_NPAPI_MIME_DESCR = "application/x-unity-webapps-npapi:none:Unity WebApps NPAPI Plugin"; static const char * UNITY_NPAPI_PlUGIN_NAME = "Unity WebApps plugin"; static const char * UNITY_NPAPI_PLUGIN_DESCRIPTION = "Unity WebApps plugin"; static const char * UNITY_NPAPI_PLUGIN_VERSION = "0.1"; /** * Must exist on Linux / Unix systems (verify) * */ const char * NP_GetMIMEDescription (void) { return UNITY_NPAPI_MIME_DESCR; } /** * TODO: not sure if it is actually needed * */ char * NP_GetPluginVersion (void) { return UNITY_NPAPI_PLUGIN_VERSION; } /** * Must exist on Linux / Unix systems (verify) * */ NPError NP_GetValue (void* reserved, NPPVariable variable, void* out) { if (NULL == out) { return NPERR_INVALID_PARAM; } // TODO check if other are supported switch (variable) { case NPPVpluginNameString: *((char **) out) = (char *)UNITY_NPAPI_PlUGIN_NAME; break; case NPPVpluginDescriptionString: *((char **) out) = (char *)UNITY_NPAPI_PLUGIN_DESCRIPTION; break; default: return NPERR_INVALID_PARAM; } return NPERR_NO_ERROR; } /** * Class initialize, on GNU/Linux is supposed to init both the NPN and NPP functions * pointer structs * */ NPError NP_Initialize (NPNetscapeFuncs * pBrowserFuncs , NPPluginFuncs * pPluginFuncs) { if (NULL == pBrowserFuncs || NULL == pPluginFuncs) { return NPERR_INVALID_PARAM; } if (pBrowserFuncs->size < sizeof(NPNetscapeFuncs)) { return NPERR_INVALID_FUNCTABLE_ERROR; } return (0 == unity_npapi_initialize_plugin (pBrowserFuncs, pPluginFuncs)) ? NPERR_NO_ERROR : NPERR_MODULE_LOAD_FAILED_ERROR; } NPError NP_Shutdown(void) { unity_npapi_cleanup_plugin (); return NPERR_NO_ERROR; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin-pp-funcs.h0000644000015201777760000000470512312131641031761 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin-pp-funcs.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_NPAPI_PLUGIN_NPP_FUNCS_H) #define UNITY_NPAPI_PLUGIN_NPP_FUNCS_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" /** * new plugin instance being created */ NPError NPP_New (NPMIMEType pluginType, NPP npp, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); NPError NPP_Destroy (NPP instance, NPSavedData **save); NPError NPP_SetWindow (NPP instance, NPWindow *window); NPError NPP_NewStream (NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); NPError NPP_DestroyStream (NPP instance, NPStream* stream, NPReason reason); void NPP_StreamAsFile (NPP instance, NPStream* stream, const char* fname); int32_t NPP_WriteReady (NPP instance, NPStream* stream); int32_t NPP_Write (NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buf); void NPP_Print (NPP instance, NPPrint* PrintInfo); int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); void NPP_URLNotify (NPP instance, const char* url, NPReason reason, void* notifyData); NPError NPP_GetValue (NPP instance, NPPVariable variable, void *value); NPError NPP_SetValue (NPP instance, NPNVariable variable, void *value); #endif // UNITY_NPAPI_PLUGIN_NPP_FUNCS_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-scriptable-object.h0000644000015201777760000000246712312131641032663 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_WEBAPPS_SCRIPTABLE_OBJECT_H) #define UNITY_WEBAPPS_SCRIPTABLE_OBJECT_H #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "unity-npapi-common.h" #include "unity-npapi-plugin.h" // TODO naming is stupid typedef enum npobject_support_t_ { NPOBJECT_SUPPORT_NONE, NPOBJECT_SUPPORT_BASIC, // toString & toValue } npobject_support_t; NPObject * unity_webapps_npapi_create_unity_webapps_object (NPP instance); #endif // UNITY_WEBAPPS_SCRIPTABLE_OBJECT_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/notify-binding.c0000644000015201777760000001306112312131641027365 0ustar pbusernogroup00000000000000/* * notify-binding.c * Copyright (C) Canonical LTD 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "unity-npapi-binding-utils.h" #include "wrapped-ptr-type.h" #include "wrapped-callback-type.h" NPVariant binding_notify_notification_init (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count for npapi call: notify_init"); return result; } if ( ! NPVARIANT_IS_STRING (args[0])) { NPN_SetException(npobject, "Invalid argument type for npapi call: notify_init"); return result; } char * app_name = NULL; if (!is_null_or_void (args[0])) { app_name = create_safe_string_for (&args[0]); } gboolean ret_val = notify_init (app_name); BOOLEAN_TO_NPVARIANT (ret_val, result); g_free (app_name); return result; } NPVariant binding_notify_notification_is_initted (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); gboolean ret_val = notify_is_initted (); BOOLEAN_TO_NPVARIANT (ret_val, result); return result; } NPVariant binding_notify_notification_new (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count for npapi call: notify_notification_new"); return result; } if ( ! NPVARIANT_IS_STRING(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ( ! NPVARIANT_IS_STRING(args[2]) && ! is_null_or_void(args[2]) ) ) { NPN_SetException(npobject, "Invalid argument type for npapi call: notify_notification_new"); return result; } char * summary = NULL; char * body = NULL; char * icon = NULL; if ( ! is_null_or_void (args[0])) { summary = create_safe_string_for (&args[0]); } if ( ! is_null_or_void (args[1])) { body = create_safe_string_for (&args[1]); } if ( ! is_null_or_void (args[2])) { icon = create_safe_string_for (&args[2]); } NotifyNotification * ret_val = notify_notification_new (summary, body, icon); g_free (summary); g_free (body); g_free (icon); if (NULL == ret_val) return result; NPObject * object = create_wrapped_ptr_object_for (instance, ret_val); if (NULL == object) { return result; } OBJECT_TO_NPVARIANT(object, result); return result; } NPVariant binding_notify_notification_show (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count for npapi call: notify_notification_show"); return result; } if ( ( ! NPVARIANT_IS_OBJECT(args[0]) && ! is_null_or_void(args[0]) ) || ( ! NPVARIANT_IS_OBJECT(args[1]) && ! is_null_or_void(args[1]) ) ) { NPN_SetException(npobject, "Invalid argument type for npapi call: notify_notification_show"); return result; } NotifyNotification * notification = NULL; if (!is_null_or_void (args[0])) { notification = (void*) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; } GError * error = NULL; gboolean ret_val = notify_notification_show (notification, &error); if (! ret_val) { NPN_SetException(npobject, error->message); g_error_free (error); return result; } BOOLEAN_TO_NPVARIANT (ret_val, result); return result; } NPVariant binding_notify_notification_destroy (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count for npapi call: notify_unref"); return result; } if ( ! NPVARIANT_IS_OBJECT(args[0]) && ! is_null_or_void(args[0]) ) { NPN_SetException(npobject, "Invalid argument type for npapi call: notify_unref"); return result; } gpointer object = NULL; if (!is_null_or_void (args[0])) { object = (void*) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; } g_object_unref (object); return result; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin-npn-funcs.c0000644000015201777760000002332012312131641032122 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin-plugin-npn-funcs.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" NPNetscapeFuncs * pBrowser_NPN_Functions = NULL; void NPN_Version (int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor) { *plugin_major = NP_VERSION_MAJOR; *plugin_minor = NP_VERSION_MINOR; // TODO *netscape_major = 0; *netscape_minor = 0; } NPError NPN_GetURLNotify (NPP instance, const char *url, const char *target, void* notifyData) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->geturlnotify (instance, url, target, notifyData); } NPError NPN_GetURL (NPP instance, const char *url, const char *target) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->geturl (instance, url, target); } NPError NPN_PostURLNotify (NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->posturlnotify (instance, url, window, len, buf, file, notifyData); } NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->posturl (instance, url, window, len, buf, file); } NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->requestread (stream, rangeList); } NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->newstream (instance, type, target, stream); } int32_t NPN_Write(NPP instance, NPStream *stream, int32_t len, void *buffer) { if (NULL == pBrowser_NPN_Functions) { return 0; } return pBrowser_NPN_Functions->write (instance, stream, len, buffer); } NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->destroystream (instance, stream, reason); } void NPN_Status(NPP instance, const char *message) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->status (instance, message); } const char* NPN_UserAgent(NPP instance) { if (NULL == pBrowser_NPN_Functions) { return NULL; } return pBrowser_NPN_Functions->uagent(instance); } void* NPN_MemAlloc(uint32_t size) { if (NULL == pBrowser_NPN_Functions) { return NULL; } return pBrowser_NPN_Functions->memalloc(size); } void NPN_MemFree(void* ptr) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->memfree(ptr); } uint32_t NPN_MemFlush (uint32_t size) { if (NULL == pBrowser_NPN_Functions) { return 0; } return pBrowser_NPN_Functions->memflush(size); } void NPN_ReloadPlugins (NPBool reloadPages) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->reloadplugins(reloadPages); } NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->getvalue(instance, variable, value); } NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value) { if (NULL == pBrowser_NPN_Functions) { return NPERR_INVALID_PLUGIN_ERROR; } return pBrowser_NPN_Functions->setvalue(instance, variable, value); } void NPN_InvalidateRect(NPP instance, NPRect *invalidRect) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->invalidaterect(instance, invalidRect); } void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->invalidateregion(instance, invalidRegion); } void NPN_ForceRedraw(NPP instance) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->forceredraw(instance); } NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) { NPIdentifier identifier; if (NULL == pBrowser_NPN_Functions) { return identifier; } identifier = pBrowser_NPN_Functions->getstringidentifier(name); return identifier; } void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers) { if (NULL == pBrowser_NPN_Functions) { return; } return pBrowser_NPN_Functions->getstringidentifiers(names, nameCount, identifiers); } NPIdentifier NPN_GetIntIdentifier(int32_t id) { if (NULL == pBrowser_NPN_Functions) { return 0; } return pBrowser_NPN_Functions->getintidentifier(id); } bool NPN_IdentifierIsString(NPIdentifier identifier) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->identifierisstring(identifier); } NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) { if (NULL == pBrowser_NPN_Functions) { return NULL; } return pBrowser_NPN_Functions->utf8fromidentifier(identifier); } int32_t NPN_IntFromIdentifier(NPIdentifier identifier) { if (NULL == pBrowser_NPN_Functions) { return 0; } return pBrowser_NPN_Functions->intfromidentifier(identifier); } NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) { if (NULL == pBrowser_NPN_Functions) { return NULL; } return pBrowser_NPN_Functions->createobject(npp, aClass); } NPObject *NPN_RetainObject(NPObject *obj) { if (NULL == pBrowser_NPN_Functions) { return NULL; } return pBrowser_NPN_Functions->retainobject(obj); } void NPN_ReleaseObject(NPObject *obj) { if (NULL == pBrowser_NPN_Functions) { return; } return pBrowser_NPN_Functions->releaseobject(obj); } bool NPN_Invoke (NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->invoke(npp, obj, methodName, args, argCount, result); } bool NPN_InvokeDefault (NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->invokeDefault(npp, obj, args, argCount, result); } bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script, NPVariant *result) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->evaluate(npp, obj, script, result); } bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, NPVariant *result) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->getproperty(npp, obj, propertyName, result); } bool NPN_SetProperty (NPP npp, NPObject* obj, NPIdentifier propertyName, const NPVariant *value) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->setproperty(npp, obj, propertyName, value); } bool NPN_RemoveProperty (NPP npp, NPObject* obj, NPIdentifier propertyName) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->removeproperty(npp, obj, propertyName); } bool NPN_Enumerate (NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->enumerate(npp, obj, identifier, count); } bool NPN_Construct (NPP npp, NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->construct(npp, obj, args, argCount, result); } bool NPN_HasProperty (NPP npp, NPObject* obj, NPIdentifier propertyName) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->hasproperty(npp, obj, propertyName); } bool NPN_HasMethod (NPP npp, NPObject* obj, NPIdentifier methodName) { if (NULL == pBrowser_NPN_Functions) { return false; } return pBrowser_NPN_Functions->hasmethod(npp, obj, methodName); } void NPN_ReleaseVariantValue (NPVariant *variant) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->releasevariantvalue(variant); } void NPN_SetException (NPObject* obj, const NPUTF8 *message) { if (NULL == pBrowser_NPN_Functions) { return; } pBrowser_NPN_Functions->setexception(obj, message); } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-tools.h0000644000015201777760000000207012312131641030063 0ustar pbusernogroup00000000000000/* * unity-npapi-tools.h * Copyright (C) Canonical LTD 2013 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_NPAPI_TOOLS_H) #define UNITY_NPAPI_TOOLS_H typedef struct _UnityWebappsContext UnityWebappsContext; void unity_npapi_tools_set_xid_for_browser_window_id(UnityWebappsContext *context, int window_id); #endif // UNITY_NPAPI_TOOLS_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/wrapped-callback-type.c0000644000015201777760000001111412312131641030615 0ustar pbusernogroup00000000000000/* * wrapped-callback-type.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include "wrapped-callback-type.h" static bool NPClass_HasMethod (NPObject *npobj, NPIdentifier name); static NPObject * NPClass_Allocate (NPP npp, NPClass *aClass); static bool NPClass_Invoke (NPObject *npobj , NPIdentifier name , const NPVariant *args , uint32_t argCount , NPVariant *result); static bool NPClass_InvokeDefault (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); static bool NPClass_HasProperty (NPObject * npobj, NPIdentifier name); static bool NPClass_GetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result); static bool NPClass_SetProperty (NPObject *npobj, NPIdentifier name, const NPVariant *value); static bool NPClass_RemoveProperty (NPObject *npobj, NPIdentifier name); static bool NPClass_Enumerate (NPObject *npobj, NPIdentifier **identifier, uint32_t *count); static bool NPClass_Construct (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); static void NPClass_Deallocate (NPObject *npobj); static void NPClass_Invalidate (NPObject *npobj); static NPClass wrapped_callback_class = { .structVersion = NP_CLASS_STRUCT_VERSION, .allocate = NPClass_Allocate, .deallocate = NPClass_Deallocate, .invalidate = NPClass_Invalidate, .hasMethod = NPClass_HasMethod, .invoke = NPClass_Invoke, .invokeDefault = NPClass_InvokeDefault, .hasProperty = NPClass_HasProperty, .getProperty = NPClass_GetProperty, .setProperty = NPClass_SetProperty, .removeProperty = NPClass_RemoveProperty, .enumerate = NPClass_Enumerate, .construct = NPClass_Construct }; /////////////////////////////////////////////////////// // // public // /////////////////////////////////////////////////////// NPObject * create_wrapped_callback_object_for (NPP instance, void * callback) { NPObject * pObject = NPN_CreateObject (instance, &wrapped_callback_class); if (NULL == pObject) { // TODO Ooops return NULL; } ((wrapped_callback_t *) pObject)->wrapped_callback = callback; ((wrapped_callback_t *) pObject)->instance = instance; return pObject; } /////////////////////////////////////////////////////// // // private // /////////////////////////////////////////////////////// static bool NPClass_HasMethod (NPObject *npobj, NPIdentifier name) { return false; } static NPObject * NPClass_Allocate (NPP npp, NPClass *aClass) { if (NULL == npp || NULL == npp->pdata) { // TODO error handling return NULL; } wrapped_callback_t * pObject = g_malloc0 (sizeof (wrapped_callback_t)); return (NPObject *) pObject; } static void NPClass_Deallocate (NPObject *npobj) { g_free (npobj); } static void NPClass_Invalidate (NPObject *npobj) { // TODO } static bool NPClass_Invoke (NPObject *npobj , NPIdentifier name , const NPVariant *args , uint32_t argCount , NPVariant *result) { // Not invokable return false; } static bool NPClass_InvokeDefault (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { // NPN_Invoke return false; } static bool NPClass_HasProperty (NPObject * npobj, NPIdentifier name) { // no properties return false; } static bool NPClass_GetProperty (NPObject *npobj, NPIdentifier name, NPVariant *result) { // no properties return false; } static bool NPClass_SetProperty (NPObject *npobj, NPIdentifier name, const NPVariant *value) { // no properties return false; } static bool NPClass_RemoveProperty (NPObject *npobj, NPIdentifier name) { // no properties return false; } static bool NPClass_Enumerate (NPObject *npobj, NPIdentifier **identifier, uint32_t *count) { // no properties/methods return false; } static bool NPClass_Construct (NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { // no need for specific construct return false; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/libunity_npapi_plugin-0.1.pc.in0000644000015201777760000000051112312131641032126 0ustar pbusernogroup00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ datarootdir=@datarootdir@ datadir=@datadir@ includedir=@includedir@/libunity_webapps_npapi Name: libunity_webapps_npapi Description: NPAPI binding to libunity-webapps library. Version: @VERSION@ Requires: Libs: -L${libdir} -lunity_webapps_npapi Cflags: -I${includedir} unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-tools.c0000644000015201777760000000550412312131641030063 0ustar pbusernogroup00000000000000/* * unity-npapi-tools.c * Copyright (C) Canonical LTD 2013 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #define WNCK_I_KNOW_THIS_IS_UNSTABLE #include #include #include #include #include "unity-npapi-tools.h" void unity_npapi_tools_set_xid_for_browser_window_id(UnityWebappsContext *context, int window_id) { const gchar * const CHROMIUM_LINUX_SESSION_ID_PROPERTY = "CHROMIUM_LINUX_SESSION_ID_PROPERTY"; WnckScreen *screen; GList *windows, *walk; // idempotent gtk_init(NULL, NULL); screen = wnck_screen_get_default(); // TODO find a way to get it from the WnckScreen? GdkDisplay* display = gdk_display_get_default(); wnck_screen_force_update (screen); windows = wnck_screen_get_windows_stacked (screen); for (walk = windows; walk != NULL; walk = walk->next) { WnckWindow *window = WNCK_WINDOW (walk->data); GdkWindow *active_window = gdk_x11_window_foreign_new_for_display (display, wnck_window_get_xid(window)); if (NULL == active_window) { g_message ("Could not retrieve GdkWindow for xid %ld", wnck_window_get_xid(window)); continue; } GdkAtom atom; gint format = 0; gint out_length = 0; gint * session_id = NULL; gboolean have_prop = gdk_property_get (active_window, gdk_atom_intern(CHROMIUM_LINUX_SESSION_ID_PROPERTY, FALSE), gdk_atom_intern("CARDINAL", FALSE), 0L, 4, FALSE, &atom, &format, &out_length, (guchar **)&session_id); if (TRUE == have_prop && NULL != session_id && window_id == session_id[0]) { unity_webapps_context_set_view_window (context, (guint64) wnck_window_get_xid (window)); g_free (session_id); break; } } } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/Makefile.am0000644000015201777760000000365412312131641026344 0ustar pbusernogroup00000000000000AM_CPPFLAGS = \ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" $(UNITY_NPAPI_PLUGIN_CFLAGS) \ -DXP_UNIX \ $(UNITY_NPAPI_PLUGIN_COVERAGE_CXXFLAGS) \ $(NPAPI_DEBUG_CFLAGS) AM_CFLAGS =\ -Wall\ -g\ $(UNITY_NPAPI_PLUGIN_COVERAGE_CFLAGS) lib_LTLIBRARIES = libunity_npapi_plugin.la libunity_npapi_plugin_la_CPPFLAGS = $(UNITY_NPAPI_PLUGIN_CFLAGS) $(NPAPI_DEBUG_CFLAGS) \ $(UNITY_NPAPI_PLUGIN_COVERAGE_CXXFLAGS) libunity_npapi_plugin_la_SOURCES = \ unity-npapi-plugin-pp-funcs.c \ unity-npapi-plugin-pp-funcs.h \ unity-npapi-plugin.c \ unity-npapi-plugin.h \ unity-webapps-binding.c \ unity-webapps-binding.h \ notify-binding.c \ notify-binding.h \ unity-webapps-repository-binding.c \ unity-webapps-repository-binding.h \ unity-npapi-plugin-npn-funcs.c \ unity-npapi-plugin-npn-funcs.h \ unity-npapi-plugin-entry-funcs.c \ unity-npapi-plugin-entry-funcs.h \ wrapped-ptr-type.c \ wrapped-ptr-type.h \ unity-webapps-scriptable-object.c \ unity-webapps-scriptable-object.h \ unity-webapps-base-js-object.c \ unity-webapps-base-js-object.h \ wrapped-callback-type.c \ wrapped-callback-type.h \ unity-webapps-binding-dispatcher.c \ unity-webapps-binding-dispatcher.h \ unity-webapps-binding-test.c \ unity-webapps-binding-test.h \ unity-npapi-binding-utils.c \ unity-npapi-binding-utils.h \ unity-npapi-common.h \ unity-npapi-tools.c \ unity-npapi-tools.h \ unity-npapi-debug.h libunity_npapi_plugin_la_LDFLAGS = $(UNITY_NPAPI_PLUGIN_COVERAGE_LDFLAGS) libunity_npapi_plugin_la_LIBADD = $(UNITY_NPAPI_PLUGIN_LIBS) include_HEADERS = unity-npapi-plugin-pp-funcs.h pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libunity_npapi_plugin-0.1.pc EXTRA_DIST = \ libunity_npapi_plugin-0.1.pc.in \ npapi-headers/headers/npapi.h \ npapi-headers/headers/npfunctions.h \ npapi-headers/headers/npruntime.h \ npapi-headers/headers/nptypes.h unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-binding-test.c0000644000015201777760000000075512312131641031647 0ustar pbusernogroup00000000000000#include #include "unity-webapps-binding-test.h" static int test_mode_on = 0; static OnReachedUnityWebappsFunc reachedfunc = NULL; void unity_webapps_binding_test_set_test_mode_on(OnReachedUnityWebappsFunc func) { reachedfunc = func; test_mode_on = 1; } void unity_webapps_binding_test_reached_func_call (void) { if (NULL != reachedfunc && test_mode_on) { reachedfunc(); } } int unity_webapps_binding_test_is_test_mode_on(void) { return test_mode_on; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-binding-utils.c0000644000015201777760000000414712312131641031475 0ustar pbusernogroup00000000000000/* * unity-webapps-binding-utils.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "npapi-headers/headers/npruntime.h" bool is_null_or_void (NPVariant variant) { return NPVARIANT_IS_NULL(variant) || NPVARIANT_IS_VOID(variant); } gchar * create_safe_string_for (const NPVariant * const pVariant) { g_return_val_if_fail (NULL != pVariant, NULL); char * pSafeString = (gchar*)g_malloc0 (NPVARIANT_TO_STRING(*pVariant).UTF8Length + 1); g_strlcpy (pSafeString , NPVARIANT_TO_STRING(*pVariant).UTF8Characters , NPVARIANT_TO_STRING(*pVariant).UTF8Length + 1); return pSafeString; } gboolean is_boolean_convertible_value (NPVariant variant) { return NPVARIANT_IS_BOOLEAN(variant) || NPVARIANT_IS_INT32(variant) || NPVARIANT_IS_DOUBLE(variant); } gboolean extract_boolean_value_from (NPVariant variant) { // TODO mmh defaults to? gboolean value = false; if (! is_boolean_convertible_value(variant)) { g_warning("Non boolean convertible NPAPI variant"); return value; } if (NPVARIANT_IS_INT32(variant)) { value = NPVARIANT_TO_INT32(variant) != 0; } else if (NPVARIANT_IS_BOOLEAN(variant)) { value = NPVARIANT_TO_BOOLEAN(variant); } else { value = NPVARIANT_TO_DOUBLE(variant) != 0.0; } return value; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-base-js-object.h0000644000015201777760000000450512312131641032052 0ustar pbusernogroup00000000000000/* * unity-webapps-base-js-object.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_WEBAPPS_BASE_JS_OBJECT_H) #define UNITY_WEBAPPS_BASE_JS_OBJECT_H #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "unity-npapi-common.h" typedef struct UnityWebappsJavascriptObjectWrapper_t { NPObject object; NPP instance; char * name; // named methods, string -> UnityWebAppsNpapiMethodPtr GHashTable * methods; // string -> UnityWebAppsNpapiPropertyDescr * GHashTable * properties; // if array access is supported, right now only GET is allowed UnityWebAppsNpapiIndexedGetPtr array_access; // custom allocator / deallocator UnityWebappsDeallocatorPtr deallocator; // default invokable //TODO void * reserved; } UnityWebappsJavascriptObjectWrapper; NPObject * unity_webapps_npapi_create_js_object (NPP instance, const char * const name); void unity_webapps_npapi_add_method (UnityWebappsJavascriptObjectWrapper * pWrapper , const char * const name , UnityWebAppsNpapiMethodPtr pMethod); void unity_webapps_npapi_add_property (UnityWebappsJavascriptObjectWrapper * pWrapper , const char * const name , UnityWebAppsNpapiPropertyGetPtr get , UnityWebAppsNpapiPropertySetPtr set); void unity_webapps_npapi_add_array_support (UnityWebappsJavascriptObjectWrapper * pWrapper , UnityWebAppsNpapiIndexedGetPtr access); void unity_webapps_npapi_set_deallocator (UnityWebappsJavascriptObjectWrapper * pWrapper , UnityWebappsDeallocatorPtr deallocator); #endif //UNITY_WEBAPPS_BASE_JS_OBJECT_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin-npn-funcs.h0000644000015201777760000000173212312131641032132 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin-npn-funcs.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_NPAPI_PLUGIN_NPN_FUNCS_H) #define UNITY_NPAPI_PLUGIN_NPN_FUNCS_H /** * * */ extern NPNetscapeFuncs * pBrowser_NPN_Functions; #endif // UNITY_NPAPI_PLUGIN_NPN_FUNCS_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin-entry-funcs.h0000644000015201777760000000222512312131641032476 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin-entry-funcs.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_NPAPI_PLUGIN_ENTRY_FUNCS_H) #define UNITY_NPAPI_PLUGIN_ENTRY_FUNCS_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" /** * * Defines the basic plugin entry points (required by npapi): * * NP_GetMIMEDescription * NP_GetValue * NP_Initialize * NP_Shutdown * */ #endif // UNITY_NPAPI_PLUGIN_ENTRY_FUNCS_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin.h0000644000015201777760000000371312312131641030226 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_NPAPI_PLUGIN_H) #define UNITY_NPAPI_PLUGIN_H #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" /** * Basic struct for a npapi plugin * */ typedef struct unity_npapi_plugin_t_ { NPPluginFuncs * pPluginFuncs; // the plugin global instance NPP npp; // we do create a few objects on the fly, need to keep track of them // to properly clean them on a per-context basis GHashTable * retained_objects; } unity_npapi_plugin_t; void unity_npapi_add_retained_objects_for_context (unity_npapi_plugin_t * plugin , gpointer context , NPObject *); void unity_npapi_free_retained_objects_for_context (unity_npapi_plugin_t * plugin , gpointer context); void unity_npapi_free_all_retained_objects (unity_npapi_plugin_t * plugin); /** * * */ int unity_npapi_initialize_plugin (NPNetscapeFuncs * pBrowserFuncs , NPPluginFuncs * pPluginFuncs); /** * * */ int unity_npapi_cleanup_plugin (void); #endif // UNITY_NPAPI_PLUGIN_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-binding.c0000644000015201777760000025172412312131641030676 0ustar pbusernogroup00000000000000/* * unity-webapps-binding.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "npapi-headers/headers/npruntime.h" #include "wrapped-ptr-type.h" #include "wrapped-callback-type.h" #include "unity-webapps-binding-test.h" #include "unity-npapi-binding-utils.h" #include "unity-webapps-scriptable-object.h" #include "unity-npapi-plugin.h" #include "unity-npapi-tools.h" NPVariant unity_webapps_binding_service_new (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsService * service = unity_webapps_service_new (); NPObject * object = create_wrapped_ptr_object_for (instance, service); if (NULL == object) { NPN_SetException(object, "Unable to get a new service object"); return result; } OBJECT_TO_NPVARIANT(object, result); return result; } /** * * @ */ NPVariant unity_webapps_binding_context_new_sync (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 5) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_STRING(args[2]) || ( ! NPVARIANT_IS_STRING(args[3]) && ! is_null_or_void (args[3])) || ( ! NPVARIANT_IS_STRING(args[4]) && ! is_null_or_void (args[4])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_new_sync"); return result; } UnityWebappsService * service = (UnityWebappsService *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; const gchar * name = create_safe_string_for (&args[1]); const gchar * domain = create_safe_string_for (&args[2]); const gchar * icon_url = NULL; if ( ! is_null_or_void (args[3])) { icon_url = create_safe_string_for (&args[3]); } const gchar * mime_types = NULL; if ( ! is_null_or_void (args[4])) { mime_types = create_safe_string_for (&args[4]); } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsContext * context = unity_webapps_context_new_sync (service, name, domain, icon_url, mime_types); g_free ((gpointer) name); g_free ((gpointer) domain); g_free ((gpointer) icon_url); g_free ((gpointer) mime_types); NPObject * object = create_wrapped_ptr_object_for (instance, context); if (NULL == object) { NPN_SetException(npobject, "Unable to properly wrap the returned object"); return result; } OBJECT_TO_NPVARIANT(object, result); return result; } NPVariant unity_webapps_binding_context_new_lazy (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 5) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_STRING(args[2]) || ( ! NPVARIANT_IS_STRING(args[3]) && ! is_null_or_void (args[3])) || ( ! NPVARIANT_IS_STRING(args[4]) && ! is_null_or_void (args[4])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_new_lazy"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsService * service = (UnityWebappsService *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; const gchar * name = create_safe_string_for (&args[1]); const gchar * domain = create_safe_string_for (&args[2]); const gchar * icon_url = NULL; if ( ! is_null_or_void (args[3])) { icon_url = create_safe_string_for (&args[3]); } const gchar * mime_types = NULL; if ( ! is_null_or_void (args[4])) { mime_types = create_safe_string_for (&args[4]); } UnityWebappsContext * context = unity_webapps_context_new_lazy (service, name, domain, icon_url, mime_types); g_free ((gpointer) name); g_free ((gpointer) domain); g_free ((gpointer) icon_url); g_free ((gpointer) mime_types); NPObject * object = create_wrapped_ptr_object_for (instance, context); if (NULL == object) { NPN_SetException(npobject, "Unable to wrap context in proper object"); return result; } OBJECT_TO_NPVARIANT(object, result); return result; } static void UnityWebappsContextPrepareCallback_dispatcher (UnityWebappsContext * context, gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [2]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); //context NULL_TO_NPVARIANT (args[1]); //user data NPVariant response; NPN_InvokeDefault (pCallbackObject->instance, pCallbackObject->wrapped_callback, args, G_N_ELEMENTS(args), &response); NPN_ReleaseVariantValue(&response); } NPVariant unity_webapps_binding_context_prepare (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(object, "Invalid argument type in NPAPI function call: context_prepare"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); unity_webapps_context_prepare (context , UnityWebappsContextPrepareCallback_dispatcher , wrappedCallback); return result; } NPVariant unity_webapps_binding_context_destroy (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! is_boolean_convertible_value(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_destroy"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gboolean user_abandoned = extract_boolean_value_from(args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_context_destroy (context, user_abandoned); return result; } NPVariant unity_webapps_binding_context_add_icon (NPP instance , NPObject * npobject, const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ( ! NPVARIANT_IS_STRING(args[1]) && ! is_null_or_void(args[1]) ) || ( ! NPVARIANT_IS_INT32(args[2]) && ! NPVARIANT_IS_DOUBLE(args[2]) ) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_add_icon"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; const gchar * url = create_safe_string_for (&args[1]); gint size = 0; if (NPVARIANT_IS_INT32(args[2])) { size = NPVARIANT_TO_INT32(args[2]); } else { size = NPVARIANT_TO_DOUBLE(args[2]); } REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_context_add_icon (context, url, size); g_free ((gpointer) url); return result; } NPVariant unity_webapps_binding_context_set_view_is_active (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! is_boolean_convertible_value(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_set_view_is_active"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gboolean active = extract_boolean_value_from(args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_context_set_view_is_active (context, active); return result; } NPVariant unity_webapps_binding_context_set_view_location (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_set_view_location"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; const gchar * location = create_safe_string_for (&args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_context_set_view_location (context, location); g_free ((gpointer) location); return result; } static void UnityWebappsContextRaiseCallback_dispatcher (UnityWebappsContext *context , const gchar *file , gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [3]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); //context NULL_TO_NPVARIANT (args[1]); //file NULL_TO_NPVARIANT (args[2]); //user data if (NULL != file && 0 != strlen(file)) { gint size = strlen(file) + 1; gchar * ret = NPN_MemAlloc (size); if (NULL != ret) { memset (ret, 0, size); strncpy (ret, file, size); STRINGZ_TO_NPVARIANT(ret, args[1]); } } NPVariant response; NPN_InvokeDefault (pCallbackObject->instance , pCallbackObject->wrapped_callback , args , G_N_ELEMENTS(args) , &response); NPN_ReleaseVariantValue(&response); } static void UnityWebappsContextCloseCallback_dispatcher (UnityWebappsContext *context , gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [2]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); //context NULL_TO_NPVARIANT (args[1]); //user data NPVariant response; NPN_InvokeDefault (pCallbackObject->instance , pCallbackObject->wrapped_callback , args , G_N_ELEMENTS(args) , &response); NPN_ReleaseVariantValue(&response); } NPVariant unity_webapps_binding_context_on_raise_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_on_raise_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_context_on_raise_callback (context , UnityWebappsContextRaiseCallback_dispatcher , wrappedCallback); return result; } NPVariant unity_webapps_binding_context_on_close_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_on_close_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_context_on_close_callback (context , UnityWebappsContextCloseCallback_dispatcher , wrappedCallback); return result; } static const gchar * UnityWebappsContextPreviewCallback_dispatcher (UnityWebappsContext * context , gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [2]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); //context NULL_TO_NPVARIANT (args[1]); //user data NPVariant response; NPN_InvokeDefault (pCallbackObject->instance , pCallbackObject->wrapped_callback , args , G_N_ELEMENTS(args) , &response); // we must have received something if ( ! NPVARIANT_IS_STRING (response)) { return NULL; } // TODO // NPN_ReleaseVariantValue(&response); return create_safe_string_for (&response); } NPVariant unity_webapps_binding_context_set_preview_requested_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_set_preview_requested_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_context_set_preview_requested_callback (context , UnityWebappsContextPreviewCallback_dispatcher , wrappedCallback); return result; } void UnityWebappsContextActionCallback_dispatcher (UnityWebappsContext *context , gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [2]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); NULL_TO_NPVARIANT (args[1]); NPVariant response; NPN_InvokeDefault (pCallbackObject->instance , pCallbackObject->wrapped_callback , args , G_N_ELEMENTS(args) , &response); NPN_ReleaseVariantValue (&response); } NPVariant unity_webapps_binding_context_remove_application_action (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_remove_application_action"); return result; } // TODO retain object UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; char * label = create_safe_string_for (&args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO leak callback ... unity_webapps_context_remove_application_action (context, label); g_free (label); return result; } NPVariant unity_webapps_binding_context_set_application_accept_data (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_set_application_accept_data"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO retain object UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPVariant mimeTypesCountVariant; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(args[1]) , NPN_GetStringIdentifier("length") , &mimeTypesCountVariant)) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: invalid argument (no length property)"); return result; } if (! NPVARIANT_IS_DOUBLE(mimeTypesCountVariant)) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: invalid argument (invalid length property)"); return result; } int mimeTypesCount = (int) NPVARIANT_TO_DOUBLE(mimeTypesCountVariant); NPN_ReleaseVariantValue(&mimeTypesCountVariant); if (mimeTypesCount == 0) { return result; } if (mimeTypesCount < 0) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: invalid mime types count"); return result; } // first pass to get the proper size to allocate size_t mimeTypesSize = 0; int mimeTypesIdx = 0; for ( ; mimeTypesIdx < mimeTypesCount ; ++mimeTypesIdx) { NPVariant curMimeType; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(args[1]) , NPN_GetIntIdentifier(mimeTypesIdx) , &curMimeType)) { break; } if (! NPVARIANT_IS_STRING(curMimeType)) { break; } mimeTypesSize += NPVARIANT_TO_STRING(curMimeType).UTF8Length + 1; NPN_ReleaseVariantValue(&curMimeType); } if (mimeTypesIdx != mimeTypesCount) { NPN_SetException(npobject, "Malformed mime types object"); return result; } char* pMimeTypes = g_malloc0(mimeTypesSize); size_t mimeTypesStructSize = sizeof(UnityWebappsStrWrapperDesc) * mimeTypesCount; UnityWebappsStrWrapperDesc* pMimeTypesStruct = g_malloc0(mimeTypesStructSize); char * pCurMimeTypes = pMimeTypes; for (mimeTypesIdx = 0 ; mimeTypesIdx < mimeTypesCount ; ++mimeTypesIdx) { NPVariant curMimeType; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(args[1]) , NPN_GetIntIdentifier(mimeTypesIdx) , &curMimeType)) { break; } if (! NPVARIANT_IS_STRING(curMimeType)) { break; } const size_t curMimeTypeSize = NPVARIANT_TO_STRING(curMimeType).UTF8Length + 1; pMimeTypesStruct[mimeTypesIdx].str = pCurMimeTypes; pCurMimeTypes += curMimeTypeSize; g_strlcpy((char *) pMimeTypesStruct[mimeTypesIdx].str , NPVARIANT_TO_STRING(curMimeType).UTF8Characters , curMimeTypeSize); NPN_ReleaseVariantValue(&curMimeType); } if (mimeTypesIdx != mimeTypesCount) { NPN_SetException(npobject, "Malformed mime types object"); g_free(pMimeTypes); g_free(pMimeTypesStruct); return result; } unity_webapps_context_set_application_accept_data (context , pMimeTypesStruct , mimeTypesCount); g_free(pMimeTypes); g_free(pMimeTypesStruct); return result; } // TODO cleanup this mess NPVariant unity_webapps_binding_context_add_application_actions (NPP instance , NPObject * npobject , const NPVariant * args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_DOUBLE(args[2]) && ! NPVARIANT_IS_INT32(args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_add_application_actions"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO retain object UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; int actionsCount = 0; if (NPVARIANT_IS_INT32(args[2])) { actionsCount = NPVARIANT_TO_INT32(args[2]); } else if (NPVARIANT_IS_DOUBLE(args[2])) { actionsCount = NPVARIANT_TO_DOUBLE(args[2]); } if (actionsCount == 0) { return result; } if (actionsCount < 0) { NPN_SetException(npobject, "Invalid action count"); return result; } // first pass to get the proper size to allocate size_t actionPathsSize = 0; int curActionIdx = 0; for ( ; curActionIdx < actionsCount ; ++curActionIdx) { NPVariant curAction; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(args[1]) , NPN_GetIntIdentifier(curActionIdx) , &curAction)) { break; } if (! NPVARIANT_IS_OBJECT(curAction)) { break; } NPVariant actionPath; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(curAction) , NPN_GetStringIdentifier("path") , &actionPath)) { NPN_ReleaseVariantValue(&curAction); break; } if (! NPVARIANT_IS_STRING(actionPath)) { NPN_ReleaseVariantValue(&curAction); NPN_ReleaseVariantValue(&actionPath); break; } actionPathsSize += NPVARIANT_TO_STRING(actionPath).UTF8Length + 1; NPN_ReleaseVariantValue(&curAction); NPN_ReleaseVariantValue(&actionPath); } if (curActionIdx != actionsCount) { NPN_SetException(npobject, "Malformed action description object"); return result; } size_t actionStructSize = sizeof(UnityWebappsApplicationActionDesc) * actionsCount; char* pActionPaths = g_malloc0(actionPathsSize); UnityWebappsApplicationActionDesc* pActions = g_malloc0(actionStructSize); char* pCurActionPath = pActionPaths; for(curActionIdx = 0 ; curActionIdx < actionsCount ; ++curActionIdx) { NPVariant curAction; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(args[1]) , NPN_GetIntIdentifier(curActionIdx) , &curAction)) { break; } if (! NPVARIANT_IS_OBJECT(curAction)) { break; } NPVariant actionPath; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(curAction) , NPN_GetStringIdentifier("path") , &actionPath)) { NPN_ReleaseVariantValue(&curAction); break; } if (! NPVARIANT_IS_STRING(actionPath)) { NPN_ReleaseVariantValue(&curAction); NPN_ReleaseVariantValue(&actionPath); break; } const size_t curActionPathSize = NPVARIANT_TO_STRING(actionPath).UTF8Length + 1; pActions[curActionIdx].path = pCurActionPath; pCurActionPath += curActionPathSize; g_strlcpy((char *) pActions[curActionIdx].path , NPVARIANT_TO_STRING(actionPath).UTF8Characters , curActionPathSize); NPN_ReleaseVariantValue(&actionPath); NPVariant actionCallback; if (! NPN_GetProperty(instance , NPVARIANT_TO_OBJECT(curAction) , NPN_GetStringIdentifier("callback") , &actionCallback)) { NPN_ReleaseVariantValue(&curAction); break; } if (! NPVARIANT_IS_OBJECT(actionCallback)) { NPN_ReleaseVariantValue(&curAction); NPN_ReleaseVariantValue(&actionCallback); break; } NPObject * callback = NPVARIANT_TO_OBJECT(actionCallback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); pActions[curActionIdx].callback = UnityWebappsContextActionCallback_dispatcher; pActions[curActionIdx].user_data = wrappedCallback; g_message ("adding action path name %s", pActions[curActionIdx].path); NPN_ReleaseVariantValue(&curAction); } if (curActionIdx != actionsCount) { // should not happen NPN_SetException(npobject, "Malformed action description object"); g_free(pActionPaths); g_free(pActions); return result; } unity_webapps_context_add_application_actions (context , pActions , actionsCount); g_free(pActionPaths); g_free(pActions); return result; } NPVariant unity_webapps_binding_context_remove_application_actions (NPP instance , NPObject * npobject , const NPVariant * args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_remove_application_actions"); return result; } // TODO retain object UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_context_remove_application_actions (context); return result; } /** * Music player * */ NPVariant unity_webapps_binding_music_player_init (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_init"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * title = create_safe_string_for (&args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_music_player_init (context, title); g_free (title); return result; } void UnityWebappsMusicPlayerCallback_dispatcher (UnityWebappsContext *context, gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [2]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); //context NULL_TO_NPVARIANT (args[1]); //user data NPVariant response; NPN_InvokeDefault (pCallbackObject->instance , pCallbackObject->wrapped_callback , args , G_N_ELEMENTS(args) , &response); NPN_ReleaseVariantValue(&response); } NPVariant unity_webapps_binding_music_player_on_play_pause_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_on_play_pause_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_music_player_on_play_pause_callback (context , UnityWebappsMusicPlayerCallback_dispatcher , wrappedCallback); return result; } NPVariant unity_webapps_binding_music_player_on_previous_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_on_previous_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_music_player_on_previous_callback (context , UnityWebappsMusicPlayerCallback_dispatcher , wrappedCallback); return result; } NPVariant unity_webapps_binding_music_player_on_next_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_on_next_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_music_player_on_next_callback (context , UnityWebappsMusicPlayerCallback_dispatcher , wrappedCallback); return result; } NPVariant unity_webapps_binding_music_player_set_track (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 5) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ( ! NPVARIANT_IS_STRING(args[1]) && ! is_null_or_void (args[1])) || ( ! NPVARIANT_IS_STRING(args[2]) && ! is_null_or_void (args[2])) || ( ! NPVARIANT_IS_STRING(args[3]) && ! is_null_or_void (args[3])) || ( ! NPVARIANT_IS_STRING(args[4]) && ! is_null_or_void (args[4])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_set_track"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * artist = NULL; if (! is_null_or_void (args[1])) { artist = create_safe_string_for (&args[1]); } gchar * album = NULL; if (! is_null_or_void (args[2])) { album = create_safe_string_for (&args[2]); } gchar * title = NULL; if (! is_null_or_void (args[3])) { title = create_safe_string_for (&args[3]); } gchar * icon_url = NULL; if (! is_null_or_void (args[4])) { icon_url = create_safe_string_for (&args[4]); } REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_music_player_set_track (context, artist, album, title, icon_url); g_free (artist); g_free (album); g_free (title); g_free (icon_url); return result; } NPVariant unity_webapps_binding_music_player_get_playback_state (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_get_playback_state"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); INT32_TO_NPVARIANT ((int32_t) unity_webapps_music_player_get_playback_state (context), result); return result; } NPVariant unity_webapps_binding_music_player_get_can_go_previous (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_get_can_go_previous"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); BOOLEAN_TO_NPVARIANT ((bool) unity_webapps_music_player_get_can_go_previous (context), result); return result; } NPVariant unity_webapps_binding_music_player_get_can_go_next (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_get_can_go_next"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); BOOLEAN_TO_NPVARIANT ((bool) unity_webapps_music_player_get_can_go_next (context), result); return result; } NPVariant unity_webapps_binding_music_player_get_can_play (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_get_can_play"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); BOOLEAN_TO_NPVARIANT ((bool) unity_webapps_music_player_get_can_play (context), result); return result; } NPVariant unity_webapps_binding_music_player_get_can_pause (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_get_can_pause"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); BOOLEAN_TO_NPVARIANT ((bool) unity_webapps_music_player_get_can_pause (context), result); return result; } NPVariant unity_webapps_binding_music_player_set_playback_state (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ( ! NPVARIANT_IS_BOOLEAN(args[1]) && ! NPVARIANT_IS_INT32(args[1]) && ! NPVARIANT_IS_DOUBLE(args[1]) ) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_set_playback_state"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; // TODO should check the value against a max state or invalid state (or delegate to function) UnityWebappsMusicPlayerPlaybackState state = UNITY_WEBAPPS_MUSIC_PLAYER_PLAYBACK_STATE_PLAYING; if (NPVARIANT_IS_INT32(args[1])) { state = (NPVARIANT_TO_INT32(args[1]) != 0) ? UNITY_WEBAPPS_MUSIC_PLAYER_PLAYBACK_STATE_PAUSED : UNITY_WEBAPPS_MUSIC_PLAYER_PLAYBACK_STATE_PLAYING; } else if (NPVARIANT_IS_BOOLEAN(args[1])) { state = (NPVARIANT_TO_BOOLEAN(args[1]) != 0) ? UNITY_WEBAPPS_MUSIC_PLAYER_PLAYBACK_STATE_PAUSED : UNITY_WEBAPPS_MUSIC_PLAYER_PLAYBACK_STATE_PLAYING; } else { state = (NPVARIANT_TO_DOUBLE(args[1]) != 0.0) ? UNITY_WEBAPPS_MUSIC_PLAYER_PLAYBACK_STATE_PAUSED : UNITY_WEBAPPS_MUSIC_PLAYER_PLAYBACK_STATE_PLAYING; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_music_player_set_playback_state (context, state); return result; } NPVariant unity_webapps_binding_music_player_set_can_go_previous (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! is_boolean_convertible_value(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_set_can_go_previous"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; // TODO should check the value against a max state or invalid state (or delegate to function) gboolean can_go_previous = extract_boolean_value_from(args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_music_player_set_can_go_previous (context, can_go_previous); return result; } NPVariant unity_webapps_binding_music_player_set_can_go_next (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! is_boolean_convertible_value(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_set_can_go_next"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; // TODO should check the value against a max state or invalid state (or delegate to function) gboolean can_go_next = extract_boolean_value_from(args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_music_player_set_can_go_next (context, can_go_next); return result; } NPVariant unity_webapps_binding_music_player_set_can_play (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) && ! is_boolean_convertible_value(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_set_can_play"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; // TODO should check the value against a max state or invalid state (or delegate to function) gboolean can_go_play = extract_boolean_value_from(args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_music_player_set_can_play (context, can_go_play); return result; } NPVariant unity_webapps_binding_music_player_set_can_pause (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! is_boolean_convertible_value(args[1]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: music_player_set_can_pause"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; // TODO should check the value against a max state or invalid state (or delegate to function) gboolean can_go_pause = extract_boolean_value_from(args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_music_player_set_can_pause (context, can_go_pause); return result; } /** * Permissions * */ NPVariant unity_webapps_binding_permissions_is_integration_allowed (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 0) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call: permissions_is_integration_allowed"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); gboolean isallowed = unity_webapps_permissions_is_integration_allowed(); BOOLEAN_TO_NPVARIANT(isallowed, result); return result; } NPVariant unity_webapps_binding_permissions_get_domain_allowed (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_STRING(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: permissions_get_domain_allowed"); return result; } gchar * domain = create_safe_string_for (&args[0]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); gboolean isallowed = unity_webapps_permissions_get_domain_allowed (domain); BOOLEAN_TO_NPVARIANT(isallowed, result); g_free (domain); return result; } NPVariant unity_webapps_binding_permissions_get_domain_preauthorized (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_STRING(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: permissions_get_domain_preauthorized"); return result; } gchar * domain = create_safe_string_for (&args[0]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); gboolean ispreauthorized = unity_webapps_permissions_get_domain_preauthorized (domain); BOOLEAN_TO_NPVARIANT(ispreauthorized, result); g_free (domain); return result; } NPVariant unity_webapps_binding_permissions_allow_domain (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_STRING(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: permissions_allow_domain"); return result; } gchar * domain = create_safe_string_for (&args[0]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_permissions_allow_domain (domain); g_free (domain); return result; } NPVariant unity_webapps_binding_permissions_get_domain_dontask (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_STRING(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: permissions_get_domain_dontask"); return result; } gchar * domain = create_safe_string_for (&args[0]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); gboolean dontask = unity_webapps_permissions_get_domain_dontask (domain); BOOLEAN_TO_NPVARIANT (dontask, result); g_free (domain); return result; } NPVariant unity_webapps_binding_permissions_dontask_domain (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_STRING(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: permissions_dontask_domain"); return result; } gchar * domain = create_safe_string_for (&args[0]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_permissions_dontask_domain (domain); g_free (domain); return result; } /** * Notification * */ NPVariant unity_webapps_binding_notification_show_notification (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO fix that, automatically infer the mandatory argument count, etc. if (argCount != 4) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ( ! NPVARIANT_IS_STRING(args[2]) && ! is_null_or_void (args[2])) || ( ! NPVARIANT_IS_STRING(args[3]) && ! is_null_or_void (args[3])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: notification_show_notification"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * summary = create_safe_string_for (&args[1]); gchar * body = NULL; if (NPVARIANT_IS_STRING(args[2])) { body = create_safe_string_for (&args[2]); } gchar * icon_url = NULL; if (NPVARIANT_IS_STRING(args[3])) { icon_url = create_safe_string_for (&args[3]); } REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_notification_show_notification (context, summary, body, icon_url); g_free (summary); g_free (body); g_free (icon_url); return result; } /** * Launcher * * */ NPVariant unity_webapps_binding_launcher_set_count (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || (! NPVARIANT_IS_INT32(args[1]) && ! NPVARIANT_IS_DOUBLE(args[1])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: launcher_set_count"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gint count = 0; if (NPVARIANT_IS_INT32(args[1])) { count = NPVARIANT_TO_INT32(args[1]); } else if (NPVARIANT_IS_DOUBLE(args[1])) { count = NPVARIANT_TO_DOUBLE(args[1]); } REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_launcher_set_count (context, count); return result; } NPVariant unity_webapps_binding_launcher_clear_count (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: launcher_clear_count"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_launcher_clear_count (context); return result; } NPVariant unity_webapps_binding_launcher_set_progress (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_DOUBLE(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: launcher_set_progress"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gdouble progress = NPVARIANT_TO_DOUBLE(args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_launcher_set_progress (context, progress); return result; } NPVariant unity_webapps_binding_launcher_clear_progress (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: launcher_clear_progress"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_launcher_clear_progress (context); return result; } NPVariant unity_webapps_binding_launcher_set_urgent (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: launcher_set_urgent"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_launcher_set_urgent (context); return result; } void UnityWebappsLauncherCallback_dispatcher (UnityWebappsContext *context , gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [2]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); NULL_TO_NPVARIANT (args[1]); NPVariant response; NPN_InvokeDefault (pCallbackObject->instance , pCallbackObject->wrapped_callback , args , G_N_ELEMENTS(args) , &response); NPN_ReleaseVariantValue (&response); } NPVariant unity_webapps_binding_launcher_add_action (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 4) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_OBJECT(args[2]) || ( ! NPVARIANT_IS_OBJECT(args[3]) && ! is_null_or_void (args[3])) ) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * label = create_safe_string_for (&args[1]); NPObject * callback = NPVARIANT_TO_OBJECT(args[2]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_launcher_add_action (context , label , UnityWebappsLauncherCallback_dispatcher , wrappedCallback); g_free (label); return result; } NPVariant unity_webapps_binding_launcher_remove_action (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: launcher_remove_action"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * label = create_safe_string_for (&args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_launcher_remove_action (context, label); g_free (label); return result; } NPVariant unity_webapps_binding_launcher_remove_actions (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: launcher_remove_actions"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_launcher_remove_actions (context); return result; } /** * Message indicator * * */ void UnityWebappsIndicatorCallback_dispatcher (UnityWebappsContext *context, gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [2]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); NULL_TO_NPVARIANT (args[1]); NPVariant response; NPN_InvokeDefault (pCallbackObject->instance , pCallbackObject->wrapped_callback , args , G_N_ELEMENTS(args) , &response); NPN_ReleaseVariantValue (&response); } NPVariant unity_webapps_binding_indicator_show_indicator (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * name = create_safe_string_for (&args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_indicator_show_indicator (context, name); g_free (name); return result; } NPVariant unity_webapps_binding_indicator_clear_indicator (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_clear_indicator"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * name = create_safe_string_for (&args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_indicator_clear_indicator (context, name); g_free ((gpointer) name); return result; } NPVariant unity_webapps_binding_indicator_clear_indicators (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_clear_indicators"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_indicator_clear_indicators (context); return result; } NPVariant unity_webapps_binding_indicator_set_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 4) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_OBJECT(args[2]) || ( ! NPVARIANT_IS_OBJECT(args[3]) && ! is_null_or_void (args[3])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_set_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * name = create_safe_string_for (&args[1]); NPObject * callback = NPVARIANT_TO_OBJECT(args[2]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_indicator_set_callback (context , name , UnityWebappsIndicatorCallback_dispatcher , wrappedCallback); g_free (name); return result; } NPVariant unity_webapps_binding_indicator_set_property (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 4) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_STRING(args[2]) || ! NPVARIANT_IS_STRING(args[3]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_set_property"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * name = create_safe_string_for (&args[1]); gchar * property = create_safe_string_for (&args[2]); gchar * value = create_safe_string_for (&args[3]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_indicator_set_property (context, name, property, value); g_free (name); g_free (property); g_free (value); return result; } NPVariant unity_webapps_binding_indicator_set_property_icon (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 4) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_STRING(args[2]) || ! NPVARIANT_IS_STRING(args[3]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_set_property_icon"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * name = create_safe_string_for (&args[1]); gchar * property = create_safe_string_for (&args[2]); gchar * icon_url = create_safe_string_for (&args[3]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_indicator_set_property_icon (context, name, property, icon_url); g_free (name); g_free (property); g_free (icon_url); return result; } NPVariant unity_webapps_binding_indicator_add_action (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 4) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_OBJECT(args[2]) || ( ! NPVARIANT_IS_OBJECT(args[3]) && ! is_null_or_void (args[3])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_add_action"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * label = create_safe_string_for (&args[1]); NPObject * callback = NPVARIANT_TO_OBJECT(args[2]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); // don't really care about the last param (simplification) NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_indicator_add_action (context, label, UnityWebappsIndicatorCallback_dispatcher, wrappedCallback); g_free (label); return result; } NPVariant unity_webapps_binding_indicator_get_presence (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_get_presence"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; REACHED_UNITY_WEBAPPS_FUNC_CALL(); gchar * presence = unity_webapps_indicator_get_presence (context); if (NULL != presence) { // TODO strlen -> gnome utf8 gint size = strlen(presence) + 1; gchar * ret = NPN_MemAlloc (size); if (NULL == ret) { NPN_SetException(npobject, "Could not allocate proper memory for call to: context_get_name"); return result; } memset (ret, 0, size); strncpy (ret, presence, size); STRINGZ_TO_NPVARIANT(ret, result); } return result; } NPVariant unity_webapps_binding_indicator_on_presence_changed_callback (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || ( ! NPVARIANT_IS_OBJECT(args[2]) && ! is_null_or_void (args[2])) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: indicator_on_presence_changed_callback"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; NPObject * callback = NPVARIANT_TO_OBJECT(args[1]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); REACHED_UNITY_WEBAPPS_FUNC_CALL(); // TODO !!!! // mmmh make sure that it works fine (that the same dispatcher function can be registered multiple times) unity_webapps_indicator_on_presence_changed_callback (context, UnityWebappsIndicatorCallback_dispatcher, wrappedCallback); return result; } NPVariant unity_webapps_binding_context_set_homepage (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function call: context_set_homepage"); return result; } UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * homepage = create_safe_string_for (&args[1]); REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_webapps_context_set_homepage (context, homepage); g_free ((gpointer) homepage); return result; } NPVariant unity_webapps_binding_service_set_xid_for_browser_window_id (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer && handle the NULL case if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_OBJECT(args[1]) || (! NPVARIANT_IS_INT32(args[2]) && ! NPVARIANT_IS_DOUBLE(args[2])) ) { NPN_SetException(object, "Invalid argument type in NPAPI function call: service_set_xid"); return result; } UnityWebappsService * service = (UnityWebappsService *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[1].value.objectValue)->pWrapped; int window_id = 0; if (NPVARIANT_IS_INT32(args[2])) { window_id = NPVARIANT_TO_INT32(args[2]); } else if (NPVARIANT_IS_DOUBLE(args[2])) { window_id = NPVARIANT_TO_DOUBLE(args[2]); } REACHED_UNITY_WEBAPPS_FUNC_CALL(); unity_npapi_tools_set_xid_for_browser_window_id (context, window_id); return result; } NPVariant unity_webapps_binding_context_get_interest_id (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(object, "Invalid argument type in NPAPI function call: context_get_interest_id"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gint interest_id = unity_webapps_context_get_interest_id (context); INT32_TO_NPVARIANT(interest_id, result); return result; } NPVariant unity_webapps_binding_context_get_name (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(object, "Invalid argument type in NPAPI function call: context_get_name"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; const gchar * name = unity_webapps_context_get_name (context); if (NULL != name) { gint size = strlen(name) + 1; gchar * ret = NPN_MemAlloc (size); if (NULL == ret) { NPN_SetException(object, "Could not allocate proper memory for call to: context_get_name"); return result; } memset (ret, 0, size); strncpy (ret, name, size); STRINGZ_TO_NPVARIANT(ret, result); } return result; } NPVariant unity_webapps_binding_context_get_domain (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(object, "Invalid argument type in NPAPI function call: context_get_domain"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsContext * context = (UnityWebappsContext *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; const gchar * domain = unity_webapps_context_get_domain (context); if (NULL != domain) { gint size = strlen(domain) + 1; gchar * ret = NPN_MemAlloc (size); if (NULL == ret) { NPN_SetException(object, "Could not allocate proper memory for call to: context_get_name"); return result; } memset (ret, 0, size); strncpy (ret, domain, size); STRINGZ_TO_NPVARIANT(ret, result); } return result; } NPVariant unity_webapps_binding_service_destroy_interest_for_context (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 5) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_STRING(args[2]) || (! NPVARIANT_IS_INT32(args[3]) && ! NPVARIANT_IS_DOUBLE(args[3])) || ! is_boolean_convertible_value(args[4]) ) { NPN_SetException(object, "Invalid argument type in NPAPI function call: service_destroy_interest_for_context"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsService * service = (UnityWebappsService *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; const gchar *name = create_safe_string_for(&args[1]); const gchar *domain = create_safe_string_for(&args[2]); gint interest_id = -1; if (NPVARIANT_IS_INT32(args[3])) { interest_id = NPVARIANT_TO_INT32(args[3]); } else if (NPVARIANT_IS_DOUBLE(args[3])) { interest_id = (gint) NPVARIANT_TO_DOUBLE(args[3]); } gboolean abandoned = extract_boolean_value_from(args[4]); unity_webapps_service_destroy_interest_for_context (service , name , domain , interest_id , abandoned); g_free((gpointer) name); g_free((gpointer) domain); return result; } NPVariant unity_webapps_binding_launcher_add_static_action (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 3) { NPN_SetException (npobject, "Invalid number of arguments for function call"); return result; } if ( ( ! NPVARIANT_IS_OBJECT(args[0]) && ! is_null_or_void(args[0]) ) || ( ! NPVARIANT_IS_STRING(args[1]) && ! is_null_or_void(args[1]) ) || ( ! NPVARIANT_IS_STRING(args[2]) && ! is_null_or_void(args[2]) ) ) { NPN_SetException(npobject, "Invalid argument type for function call"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsContext * context = NULL; if ( ! is_null_or_void (args[0])) { context = (void*) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; } const gchar * label = ""; if ( ! is_null_or_void (args[1])) { label = create_safe_string_for (&args[1]); } const gchar * page = ""; if ( ! is_null_or_void (args[2])) { page = create_safe_string_for (&args[2]); } unity_webapps_launcher_add_static_action(context, label, page); g_free ((gpointer) label); g_free ((gpointer) page); return result; } NPVariant unity_webapps_binding_launcher_remove_static_actions (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException (npobject, "Invalid number of arguments for function call"); return result; } if ( ( ! NPVARIANT_IS_OBJECT(args[0]) && ! is_null_or_void(args[0]) ) ) { NPN_SetException(npobject, "Invalid argument type for function call"); return result; } UnityWebappsContext * context = NULL; REACHED_UNITY_WEBAPPS_FUNC_CALL(); if ( ! is_null_or_void (args[0])) { context = (void*) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; } unity_webapps_launcher_remove_static_actions(context); return result; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-binding-dispatcher.h0000644000015201777760000000263412312131641033021 0ustar pbusernogroup00000000000000/* * unity-webapps-binding-dispatcher.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_WEBAPPS_BINDING_DISPATCHER_H) #define UNITY_WEBAPPS_BINDING_DISPATCHER_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "unity-npapi-common.h" bool webapps_binding_is_method_supported (const char * const name); NPVariant webapps_binding_dispatch_method_call (NPP instance , const char * const name , int argcnt , const NPVariant args[] , void (*logger) (const char * const s)); void webapps_binding_for_each (void (*f) (const char * const name, UnityWebAppsNpapiMethodPtr)); #endif // UNITY_WEBAPPS_BINDING_DISPATCHER_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/wrapped-callback-type.h0000644000015201777760000000250312312131641030624 0ustar pbusernogroup00000000000000/* * wrapped-callback-type.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (WRAPPED_CALLBACK_TYPE_H) #define WRAPPED_CALLBACK_TYPE_H #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" // TODO should probably be more general typedef struct wrapped_callback_t_ { NPObject object; NPObject * wrapped_callback; NPP instance; // const gint argscnt; NPVariant args [0]; } wrapped_callback_t; /** * * @param callback can be NULL */ NPObject * create_wrapped_callback_object_for (NPP instance, void * callback); #endif // WRAPPED_CALLBACK_TYPE_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-repository-binding.h0000644000015201777760000001041012312131641033101 0ustar pbusernogroup00000000000000/* * unity-webapps-repository-binding.h * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_WEBAPPS_REPOSITORY_BINDING_H) #define UNITY_WEBAPPS_REPOSITORY_BINDING_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npruntime.h" #include "npapi-headers/headers/nptypes.h" NPVariant unity_webapps_binding_application_repository_add_desktop_to_launcher (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_generate_desktop_for_url_launch (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_new_default (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_prepare (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_resolve_url_as_json (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_get_resolved_application_status (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_install_application (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_get_userscript_contents (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_get_resolved_application_domain (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); NPVariant unity_webapps_binding_application_repository_get_resolved_application_name (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount); #endif // UNITY_WEBAPPS_REPOSITORY_BINDING_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-scriptable-object.c0000644000015201777760000000501312312131641032644 0ustar pbusernogroup00000000000000/* * unity-webapps-scriptable-object.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include "unity-webapps-scriptable-object.h" #include "unity-webapps-binding-dispatcher.h" #include "unity-webapps-base-js-object.h" /////////////////////////////////////////////////////// // // public // /////////////////////////////////////////////////////// NPObject * unity_webapps_npapi_create_unity_webapps_object (NPP instance) { g_return_val_if_fail (NULL != instance, NULL); UnityWebappsJavascriptObjectWrapper * pWrapper = (UnityWebappsJavascriptObjectWrapper *) unity_webapps_npapi_create_js_object (instance, "Unity Webapps"); g_return_val_if_fail (NULL != pWrapper, NULL); void on_webapps_binding (const char * const name, UnityWebAppsNpapiMethodPtr method) { unity_webapps_npapi_add_method (pWrapper, name, method); } webapps_binding_for_each (on_webapps_binding); return (NPObject *) pWrapper; } /////////////////////////////////////////////////////// // // private // /////////////////////////////////////////////////////// #if defined(NPAPI_DEBUG_ENABLED) /** * A pScriptable object should be available so that the function can "close" over it * */ # define DEFINE_LOGGER(name) \ void name (const char * const s) \ { \ if (NULL != pScriptable->instance && NULL != pScriptable->logging_browser_object) \ { \ NPVariant message; \ STRINGZ_TO_NPVARIANT(s, message); \ NPVariant args [] = { message }; \ NPVariant response; \ NPN_InvokeDefault (pScriptable->instance, pScriptable->logging_browser_object, &args[0], 1, &response); \ NPN_ReleaseVariantValue (&response); \ } \ } \ do {} while (0) #else // defined(NPAPI_DEBUG_ENABLED) # define DEFINE_LOGGER(name) void name (const char * const s) {} #endif unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-binding-test.h0000644000015201777760000000054512312131641031651 0ustar pbusernogroup00000000000000#ifndef UNITY_WEBAPPS_BINDING_TEST_H #define UNITY_WEBAPPS_BINDING_TEST_H typedef void (* OnReachedUnityWebappsFunc) (void); void unity_webapps_binding_test_set_test_mode_on(OnReachedUnityWebappsFunc); int unity_webapps_binding_test_is_test_mode_on(void); void unity_webapps_binding_test_reached_func_call (void); #endif // UNITY_WEBAPPS_BINDING_TEST_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/notify-binding.h0000644000015201777760000000303612312131641027373 0ustar pbusernogroup00000000000000/* * notify-binding.h * Copyright (C) Canonical LTD 2012 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (NOTIFY_BINDING_TEST_H) #define NOTIFY_BINDING_TEST_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/nptypes.h" #include "npapi-headers/headers/npruntime.h" NPVariant binding_notify_notification_init (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount); NPVariant binding_notify_notification_is_initted (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount); NPVariant binding_notify_notification_new (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount); NPVariant binding_notify_notification_show (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount); NPVariant binding_notify_notification_destroy (NPP instance, NPObject * npobject, const NPVariant *args, uint32_t argCount); #endif // NOTIFY_BINDING_TEST_H unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-webapps-repository-binding.c0000644000015201777760000004176112312131647033117 0ustar pbusernogroup00000000000000/* * unity-webapps-repository-binding.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "npapi-headers/headers/npruntime.h" #include "wrapped-ptr-type.h" #include "wrapped-callback-type.h" #include "unity-webapps-binding-test.h" #include "unity-npapi-binding-utils.h" #include "unity-webapps-scriptable-object.h" #include "unity-npapi-plugin.h" #include "unity-webapps-base-js-object.h" gchar* unity_webapps_desktop_infos_build_desktop_basename(const gchar* name, const gchar* domain); void unity_webapps_desktop_infos_generate_desktop_for_url_launch(const gchar* name, const gchar* domain, const gchar* icon_url, const gchar* url); static gboolean unity_webapps_binding_does_desktop_file_exists(const gchar *name, const gchar* domain) { GDesktopAppInfo *appinfo; gchar *desktop_basename; gchar *desktop_id; gboolean exists; exists = FALSE; g_return_val_if_fail(NULL != name, exists); g_return_val_if_fail(NULL != domain, exists); desktop_basename = unity_webapps_desktop_infos_build_desktop_basename(name, domain); desktop_id = g_strdup_printf("%s.desktop", desktop_basename); // Make sure that the desktop file exists appinfo = g_desktop_app_info_new(desktop_id); if (NULL == appinfo) { // local search gchar *local_desktop_filename = g_build_filename (g_get_user_data_dir(), "applications", desktop_id, NULL); appinfo = g_desktop_app_info_new_from_filename(local_desktop_filename); g_free(local_desktop_filename); } g_free(desktop_id); g_free(desktop_basename); exists = (appinfo != NULL); return exists; } NPVariant unity_webapps_binding_application_repository_generate_desktop_for_url_launch (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 4) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_STRING(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_STRING(args[2]) || ! NPVARIANT_IS_STRING(args[3])) { NPN_SetException(object, "Invalid argument type in NPAPI function" " call: generate_desktop_for_url_launch"); return result; } gchar * name = create_safe_string_for (&args[0]); gchar * domain = create_safe_string_for (&args[1]); gchar * url = create_safe_string_for (&args[2]); gchar * icon_url = create_safe_string_for (&args[3]); if ( ! unity_webapps_binding_does_desktop_file_exists(name, domain)) unity_webapps_desktop_infos_generate_desktop_for_url_launch(name, domain, icon_url, url); g_free(name); g_free(domain); g_free(url); g_free(icon_url); return result; } NPVariant unity_webapps_binding_application_repository_add_desktop_to_launcher (NPP instance , NPObject * object , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 2) { NPN_SetException(object, "Invalid argument count in NPAPI function call"); return result; } if ( ! NPVARIANT_IS_STRING(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(object, "Invalid argument type in NPAPI function" " call: application_repository_add_desktop_to_launcher"); return result; } gchar * name = create_safe_string_for (&args[0]); gchar * domain = create_safe_string_for (&args[1]); if (unity_webapps_binding_does_desktop_file_exists(name, domain)) { gchar *desktop_basename = unity_webapps_desktop_infos_build_desktop_basename(name, domain); gchar *desktop_id = g_strdup_printf("application://%s.desktop", desktop_basename); unity_webapps_application_repository_add_desktop_to_launcher(desktop_id); g_free(desktop_id); g_free(desktop_basename); } else g_message("Could not find desktop file for webapp: %s", name); g_free(name); g_free(domain); return result; } NPVariant unity_webapps_binding_application_repository_new_default (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 0) { NPN_SetException(npobject, "Invalid argument count in NPAPI function " "call: application_repository_new_default"); return result; } REACHED_UNITY_WEBAPPS_FUNC_CALL(); UnityWebappsApplicationRepository * repository = unity_webapps_application_repository_new_default (); NPObject * object = create_wrapped_ptr_object_for (instance, repository); if (NULL == object) { NPN_SetException(object, "Unable to get a new repository object"); return result; } OBJECT_TO_NPVARIANT(object, result); return result; } NPVariant unity_webapps_binding_application_repository_prepare (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); if (argCount != 1) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if (! NPVARIANT_IS_OBJECT(args[0])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function " "call: application_repository_prepare"); return result; } UnityWebappsApplicationRepository * repo = (UnityWebappsApplicationRepository *) ((wrapped_void_ptr_t *) NPVARIANT_TO_OBJECT(args[0]))->pWrapped; BOOLEAN_TO_NPVARIANT ((bool) unity_webapps_application_repository_prepare(repo), result); return result; } static NPVariant _string_to_npvariant(const gchar * s) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO strlen -> glib utf8 gint size = strlen(s) + 1; gchar * ret = NPN_MemAlloc (size); if (NULL == ret) return result; memset (ret, 0, size); g_strlcpy (ret, s, size); STRINGZ_TO_NPVARIANT(ret, result); return result; } NPVariant unity_webapps_binding_application_repository_resolve_url_as_json (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO fix that, automatically infer the mandatory argument count, etc. if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function" " call: application_repository_resolve_url"); return result; } UnityWebappsApplicationRepository * repo = (UnityWebappsApplicationRepository *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * url = create_safe_string_for (&args[1]); const gchar * names_as_json = unity_webapps_application_repository_resolve_url_as_json(repo, url); if (NULL != names_as_json) { result = _string_to_npvariant(names_as_json); g_free(names_as_json); } g_free (url); return result; } NPVariant unity_webapps_binding_application_repository_get_resolved_application_status (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO fix that, automatically infer the mandatory argument count, etc. if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function" " call: application_repository_get_resolved_application_status"); return result; } UnityWebappsApplicationRepository * repo = (UnityWebappsApplicationRepository *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * application = create_safe_string_for (&args[1]); UnityWebappsApplicationStatus status = unity_webapps_application_repository_get_resolved_application_status(repo, application); g_free(application); INT32_TO_NPVARIANT(status, result); return result; } static void UnityWebappsApplicationRepositoryInstallCallback_dispatcher (UnityWebappsApplicationRepository *repository , const gchar *name , UnityWebappsApplicationStatus status , gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [4]; // TODO call w/ meaningful values NULL_TO_NPVARIANT (args[0]); //repo STRINGZ_TO_NPVARIANT (name, args[1]); //name INT32_TO_NPVARIANT (status, args[2]); //status NULL_TO_NPVARIANT (args[3]); //user data NPVariant response; NPN_InvokeDefault (pCallbackObject->instance, pCallbackObject->wrapped_callback, args, G_N_ELEMENTS(args), &response); NPN_ReleaseVariantValue(&response); } NPVariant unity_webapps_binding_application_repository_install_application (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO fix that, automatically infer the mandatory argument count, etc. if (argCount != 4) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1]) || ! NPVARIANT_IS_OBJECT(args[2]) ) { NPN_SetException(npobject, "Invalid argument type in NPAPI function" " call: application_repository_install_application"); return result; } UnityWebappsApplicationRepository * repo = (UnityWebappsApplicationRepository *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * name = create_safe_string_for (&args[1]); NPObject * callback = NPVARIANT_TO_OBJECT(args[2]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, repo, callback); NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, repo, wrappedCallback); unity_webapps_application_repository_install_application (repo, name, UnityWebappsApplicationRepositoryInstallCallback_dispatcher, wrappedCallback); g_free(name); return result; } NPVariant unity_webapps_binding_application_repository_get_userscript_contents (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO fix that, automatically infer the mandatory argument count, etc. if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function" " call: application_repository_get_userscript_contents"); return result; } UnityWebappsApplicationRepository * repo = (UnityWebappsApplicationRepository *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * name = create_safe_string_for (&args[1]); gchar * content = unity_webapps_application_repository_get_userscript_contents(repo, name); if (NULL != content) { result = _string_to_npvariant(content); } g_free(name); return result; } NPVariant unity_webapps_binding_application_repository_get_resolved_application_domain (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO fix that, automatically infer the mandatory argument count, etc. if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function" " call: application_repository_get_resolved_application_domain"); return result; } UnityWebappsApplicationRepository * repo = (UnityWebappsApplicationRepository *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * application = create_safe_string_for (&args[1]); const gchar * domain = unity_webapps_application_repository_get_resolved_application_domain(repo, application); if (NULL != domain) { result = _string_to_npvariant(domain); } g_free (application); return result; } NPVariant unity_webapps_binding_application_repository_get_resolved_application_name (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); // TODO fix that, automatically infer the mandatory argument count, etc. if (argCount != 2) { NPN_SetException(npobject, "Invalid argument count in NPAPI function call"); return result; } // TODO must add proper type validation layer if ( ! NPVARIANT_IS_OBJECT(args[0]) || ! NPVARIANT_IS_STRING(args[1])) { NPN_SetException(npobject, "Invalid argument type in NPAPI function" " call: application_repository_get_resolved_application_name"); return result; } UnityWebappsApplicationRepository * repo = (UnityWebappsApplicationRepository *) ((wrapped_void_ptr_t *) args[0].value.objectValue)->pWrapped; gchar * application = create_safe_string_for (&args[1]); const gchar * name = unity_webapps_application_repository_get_resolved_application_name(repo, application); if (NULL != name) { result = _string_to_npvariant(name); } g_free (application); return result; } unity-chromium-extension-3.0.0+14.04.20140318/npapi-plugin/src/unity-npapi-plugin.c0000644000015201777760000001117612312131641030223 0ustar pbusernogroup00000000000000/* * unity-npapi-plugin.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include "unity-npapi-plugin.h" #include "unity-npapi-plugin-npn-funcs.h" static bool fill_plugin_functions (NPPluginFuncs * pFuncs); static bool fill_browser_functions (NPNetscapeFuncs * pFuncs); int unity_npapi_initialize_plugin (NPNetscapeFuncs * pBrowserFuncs, NPPluginFuncs * pPluginFuncs) { g_return_val_if_fail (NULL != pBrowserFuncs, EINVAL); g_return_val_if_fail (NULL != pPluginFuncs, EINVAL); if (false == fill_browser_functions (pBrowserFuncs)) { return ENOENT; } if (false == fill_plugin_functions (pPluginFuncs)) { return ENOENT; } return 0; } int unity_npapi_cleanup_plugin (void) { return 0; } void unity_npapi_add_retained_objects_for_context (unity_npapi_plugin_t * plugin , gpointer context , NPObject * retained_object) { g_return_if_fail(NULL != plugin); if (NULL == plugin->retained_objects) { return; } if (! g_hash_table_contains(plugin->retained_objects, context)) { g_hash_table_insert(plugin->retained_objects, context, g_list_alloc ()); } GList * objects = g_hash_table_lookup(plugin->retained_objects, context); g_return_if_fail(NULL != objects); NPN_RetainObject(retained_object); g_hash_table_replace(plugin->retained_objects , context , g_list_append(objects, retained_object)); } static void release_npobjects (GList * objects) { if (NULL == objects) { return; } GList * item = g_list_first(objects); while (NULL != item) { if (NULL != item->data) { NPN_ReleaseObject((NPObject*) item->data); } item = g_list_next(item); } } void unity_npapi_free_retained_objects_for_context (unity_npapi_plugin_t * plugin , gpointer context) { g_return_if_fail(NULL != plugin); if (NULL == plugin->retained_objects) { return; } g_return_if_fail(g_hash_table_contains(plugin->retained_objects, context)); GList * objects = g_hash_table_lookup(plugin->retained_objects, context); if (NULL != objects) { release_npobjects (objects); g_list_free(objects); } g_hash_table_remove(plugin->retained_objects, context); } void unity_npapi_free_all_retained_objects (unity_npapi_plugin_t * plugin) { g_return_if_fail(NULL != plugin); if (NULL == plugin->retained_objects) { return; } GHashTableIter iter; g_hash_table_iter_init (&iter, plugin->retained_objects); gpointer context = NULL; gpointer objects = NULL; while (g_hash_table_iter_next (&iter, &context, &objects)) { release_npobjects (objects); g_list_free (objects); } g_hash_table_unref (plugin->retained_objects); plugin->retained_objects = NULL; } ///////////////////////////////////////////////////// // // private // ///////////////////////////////////////////////////// static bool fill_browser_functions (NPNetscapeFuncs * pFuncs) { g_return_val_if_fail (NULL != pFuncs, false); pBrowser_NPN_Functions = pFuncs; return true; } static bool fill_plugin_functions (NPPluginFuncs * pFuncs) { g_return_val_if_fail (NULL != pFuncs, false); pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; pFuncs->size = sizeof(NPPluginFuncs); pFuncs->newp = NPP_New; pFuncs->destroy = NPP_Destroy; pFuncs->setwindow = NPP_SetWindow; pFuncs->newstream = NPP_NewStream; pFuncs->destroystream = NPP_DestroyStream; pFuncs->asfile = NPP_StreamAsFile; pFuncs->writeready = NPP_WriteReady; pFuncs->write = NPP_Write; pFuncs->print = NPP_Print; pFuncs->event = NPP_HandleEvent; pFuncs->urlnotify = NPP_URLNotify; pFuncs->javaClass = NULL; // not used pFuncs->getvalue = NPP_GetValue; pFuncs->setvalue = NPP_SetValue; return true; } unity-chromium-extension-3.0.0+14.04.20140318/configure.ac0000644000015201777760000000330012312131647023376 0ustar pbusernogroup00000000000000dnl Process this file with autoconf to produce a configure script. dnl Created by Anjuta application wizard. AC_INIT(unity_webapps_chromium, 3.1) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([1.11]) AM_SILENT_RULES([yes]) AC_PROG_CC AC_PROG_CC_C99 AM_PROG_CC_C_O AC_CONFIG_MACRO_DIR([m4]) AC_DISABLE_STATIC LT_INIT PKG_CHECK_MODULES(UNITY_NPAPI_PLUGIN, [libunity_webapps-0.2 glib-2.0 libnotify libunity-webapps-repository libwnck-1.0]) dnl *************************************************************************** dnl debug dnl *************************************************************************** AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging. [default=no]]), [enable_debug="yes"],[enable_debug="no"]) if test "x$enable_debug" = "xyes"; then NPAPI_DEBUG_CFLAGS="-DNPAPI_DEBUG_ENABLED" else NPAPI_DEBUG_CFLAGS="" fi AC_SUBST(NPAPI_DEBUG_CFLAGS) dnl ========== Tests ========== AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [Enable tests. [default=no]]), [enable_tests="yes"], [enable_tests="no"]) if test "x$enable_tests" = "xyes"; then AC_DEFINE([ENABLE_TESTS], 1, [Enable tests.]) # Tests need debug to be enabled enable_debug="yes" fi AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"]) dnl ===== gcov coverage reporting ===== m4_include([m4/gcov.m4]) AC_TDD_GCOV AC_SUBST(UNITY_NPAPI_PLUGIN_COVERAGE_CFLAGS) AC_SUBST(UNITY_NPAPI_PLUGIN_COVERAGE_CXXFLAGS) AC_SUBST(UNITY_NPAPI_PLUGIN_COVERAGE_LDFLAGS) AC_OUTPUT([ Makefile chromium-extension/Makefile npapi-plugin/src/libunity_npapi_plugin-0.1.pc npapi-plugin/Makefile npapi-plugin/src/Makefile tests/Makefile tests/unit/Makefile tests/unit/npapi/Makefile po/Makefile]) unity-chromium-extension-3.0.0+14.04.20140318/tests/0000755000015201777760000000000012312132125022246 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/0000755000015201777760000000000012312132125023225 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/0000755000015201777760000000000012312132125024334 5ustar pbusernogroup00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-add-application-actions-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-add-application-actions-test.0000644000015201777760000000647512312131641033501 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_add_application_actions_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_add_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_add_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_add_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_context_add_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); INT32_TO_NPVARIANT(0,args[2]); NPVariant result = unity_webapps_binding_context_add_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_add_application_actions_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-new-lazy-test.c0000644000015201777760000000752412312131641030717 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_new_lazy_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_new_lazy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_new_lazy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_new_lazy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_context_new_lazy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[5]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NPVariant result = unity_webapps_binding_context_new_lazy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[5]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); STRINGZ_TO_NPVARIANT("",args[2]); STRINGZ_TO_NPVARIANT("",args[3]); STRINGZ_TO_NPVARIANT("",args[4]); NPVariant result = unity_webapps_binding_context_new_lazy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_new_lazy_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-action-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-action-tes0000644000015201777760000000031012312131641033577 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_REMOVE_APPLICATION_ACTION_TEST_H #define UNITY_WEBAPPS_CONTEXT_REMOVE_APPLICATION_ACTION_TEST_H int unity_webapps_context_remove_application_action_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-set-progress-test.c0000644000015201777760000000522412312131641031716 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_set_progress_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_set_progress (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_launcher_set_progress (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_launcher_set_progress (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); DOUBLE_TO_NPVARIANT(0.0,args[1]); NPVariant result = unity_webapps_binding_launcher_set_progress (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_set_progress_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-pause-test.h0000644000015201777760000000026312312131641032526 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_PAUSE_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_PAUSE_TEST_H int unity_webapps_music_player_get_can_pause_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-get-interest-id-test.h0000644000015201777760000000025212312131641032151 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_GET_INTEREST_ID_TEST_H #define UNITY_WEBAPPS_CONTEXT_GET_INTEREST_ID_TEST_H int unity_webapps_context_get_interest_id_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-on-close-callback-test.c0000644000015201777760000000644712312131641032425 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_on_close_callback_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_on_close_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_on_close_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_on_close_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_context_on_close_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); NPVariant result = unity_webapps_binding_context_on_close_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_on_close_callback_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/permissions-is-integration-allowed-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/permissions-is-integration-allowed-te0000644000015201777760000000314112312131641033620 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_permissions_is_integration_allowed_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_permissions_is_integration_allowed (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_permissions_is_integration_allowed (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_permissions_is_integration_allowed_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-remove-static-actions-test.h0000644000015201777760000000027712312131641033511 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_REMOVE_STATIC_ACTIONS_TEST_H #define UNITY_WEBAPPS_LAUNCHER_REMOVE_STATIC_ACTIONS_TEST_H int unity_webapps_launcher_remove_static_actions_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-homepage-test.h0000644000015201777760000000024112312131641031521 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_SET_HOMEPAGE_TEST_H #define UNITY_WEBAPPS_CONTEXT_SET_HOMEPAGE_TEST_H int unity_webapps_context_set_homepage_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-pause-test.c0000644000015201777760000000526512312131641032544 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_set_can_pause_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_set_can_pause (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_set_can_pause (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_music_player_set_can_pause (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); BOOLEAN_TO_NPVARIANT(false,args[1]); NPVariant result = unity_webapps_binding_music_player_set_can_pause (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_set_can_pause_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/permissions-is-integration-allowed-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/permissions-is-integration-allowed-te0000644000015201777760000000031312312131641033616 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_PERMISSIONS_IS_INTEGRATION_ALLOWED_TEST_H #define UNITY_WEBAPPS_PERMISSIONS_IS_INTEGRATION_ALLOWED_TEST_H int unity_webapps_permissions_is_integration_allowed_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-get-interest-id-test.c0000644000015201777760000000414512312131641032151 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_get_interest_id_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_get_interest_id (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_get_interest_id (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_context_get_interest_id (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_get_interest_id_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-playback-state-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-playback-state-test.0000644000015201777760000000030212312131641033414 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_SET_PLAYBACK_STATE_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_SET_PLAYBACK_STATE_TEST_H int unity_webapps_music_player_set_playback_state_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-get-name-test.c0000644000015201777760000000410212312131641030633 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_get_name_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_get_name (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_get_name (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_context_get_name (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_get_name_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-go-next-test.h0000644000015201777760000000027112312131641032771 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_GO_NEXT_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_GO_NEXT_TEST_H int unity_webapps_music_player_get_can_go_next_test(void); #endif ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-playback-state-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-playback-state-test.0000644000015201777760000000030212312131641033400 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_GET_PLAYBACK_STATE_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_GET_PLAYBACK_STATE_TEST_H int unity_webapps_music_player_get_playback_state_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-set-property-icon-test.h0000644000015201777760000000026612312131641033045 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_INDICATOR_SET_PROPERTY_ICON_TEST_H #define UNITY_WEBAPPS_INDICATOR_SET_PROPERTY_ICON_TEST_H int unity_webapps_indicator_set_property_icon_test(void); #endif ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-go-previous-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-go-previous-test0000644000015201777760000000533112312131641033457 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_set_can_go_previous_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_set_can_go_previous (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_set_can_go_previous (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_music_player_set_can_go_previous (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); BOOLEAN_TO_NPVARIANT(false,args[1]); NPVariant result = unity_webapps_binding_music_player_set_can_go_previous (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_set_can_go_previous_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-init-test.c0000644000015201777760000000517412312131641031041 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_init_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_init (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_init (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_music_player_init (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); NPVariant result = unity_webapps_binding_music_player_init (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_init_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-view-is-active-test.h0000644000015201777760000000026312312131641032574 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_SET_VIEW_IS_ACTIVE_TEST_H #define UNITY_WEBAPPS_CONTEXT_SET_VIEW_IS_ACTIVE_TEST_H int unity_webapps_context_set_view_is_active_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-view-location-test.h0000644000015201777760000000026012312131641032515 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_SET_VIEW_LOCATION_TEST_H #define UNITY_WEBAPPS_CONTEXT_SET_VIEW_LOCATION_TEST_H int unity_webapps_context_set_view_location_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-add-action-test.h0000644000015201777760000000023612312131641031267 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_ADD_ACTION_TEST_H #define UNITY_WEBAPPS_LAUNCHER_ADD_ACTION_TEST_H int unity_webapps_launcher_add_action_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-set-property-test.h0000644000015201777760000000024712312131641032116 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_INDICATOR_SET_PROPERTY_TEST_H #define UNITY_WEBAPPS_INDICATOR_SET_PROPERTY_TEST_H int unity_webapps_indicator_set_property_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-remove-actions-test.h0000644000015201777760000000025212312131641032215 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_REMOVE_ACTIONS_TEST_H #define UNITY_WEBAPPS_LAUNCHER_REMOVE_ACTIONS_TEST_H int unity_webapps_launcher_remove_actions_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-set-count-test.c0000644000015201777760000000517712312131641031211 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_set_count_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_set_count (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_launcher_set_count (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_launcher_set_count (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); INT32_TO_NPVARIANT(0,args[1]); NPVariant result = unity_webapps_binding_launcher_set_count (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_set_count_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-playback-state-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-playback-state-test.0000644000015201777760000000421512312131641033407 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_get_playback_state_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_get_playback_state (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_get_playback_state (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_music_player_get_playback_state (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_get_playback_state_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-clear-progress-test.h0000644000015201777760000000025212312131641032212 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_CLEAR_PROGRESS_TEST_H #define UNITY_WEBAPPS_LAUNCHER_CLEAR_PROGRESS_TEST_H int unity_webapps_launcher_clear_progress_test(void); #endif ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-go-previous-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-go-previous-test0000644000015201777760000000030512312131641033437 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_GO_PREVIOUS_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_GO_PREVIOUS_TEST_H int unity_webapps_music_player_get_can_go_previous_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-clear-count-test.c0000644000015201777760000000412612312131641031475 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_clear_count_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_clear_count (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_launcher_clear_count (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_launcher_clear_count (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_clear_count_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-remove-action-test.h0000644000015201777760000000024712312131641032036 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_REMOVE_ACTION_TEST_H #define UNITY_WEBAPPS_LAUNCHER_REMOVE_ACTION_TEST_H int unity_webapps_launcher_remove_action_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-set-callback-test.h0000644000015201777760000000024712312131641031766 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_INDICATOR_SET_CALLBACK_TEST_H #define UNITY_WEBAPPS_INDICATOR_SET_CALLBACK_TEST_H int unity_webapps_indicator_set_callback_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-play-test.h0000644000015201777760000000026012312131641032367 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_PLAY_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_PLAY_TEST_H int unity_webapps_music_player_set_can_play_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-go-next-test.h0000644000015201777760000000027112312131641033005 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_GO_NEXT_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_GO_NEXT_TEST_H int unity_webapps_music_player_set_can_go_next_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/test_common.c0000644000015201777760000000102712312131641027031 0ustar pbusernogroup00000000000000#include #include "test_common.h" void NPN_SetException(NPObject *npobj, const NPUTF8 *message) { NPTestObject * tobject = (NPTestObject *) npobj; tobject->exceptioncalled = true; } NPObject * NPN_RetainObject(NPObject *npobj) { return npobj; } bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { return true; } void NPN_ReleaseVariantValue(NPVariant *variant) {} void * NPN_MemAlloc (uint32_t size) { return g_malloc0(size); } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/notification-show-notification-test.c0000644000015201777760000000764212312131641033620 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_notification_show_notification_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_notification_show_notification (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_notification_show_notification (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_notification_show_notification (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_notification_show_notification (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[5]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NPVariant result = unity_webapps_binding_notification_show_notification (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[4]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); STRINGZ_TO_NPVARIANT("",args[2]); STRINGZ_TO_NPVARIANT("",args[3]); NPVariant result = unity_webapps_binding_notification_show_notification (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_notification_show_notification_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-clear-indicators-test.c0000644000015201777760000000416412312131641032661 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_indicator_clear_indicators_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_indicator_clear_indicators (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_indicator_clear_indicators (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_indicator_clear_indicators (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_indicator_clear_indicators_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-remove-actions-test.c0000644000015201777760000000414512312131641032215 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_remove_actions_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_remove_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_launcher_remove_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_launcher_remove_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_remove_actions_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-view-location-test.c0000644000015201777760000000525412312131641032520 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_set_view_location_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_set_view_location (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_set_view_location (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_context_set_view_location (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); NPVariant result = unity_webapps_binding_context_set_view_location (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_set_view_location_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-play-test.c0000644000015201777760000000415712312131641032357 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_get_can_play_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_get_can_play (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_get_can_play (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_music_player_get_can_play (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_get_can_play_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-new-lazy-test.h0000644000015201777760000000022512312131641030713 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_NEW_LAZY_TEST_H #define UNITY_WEBAPPS_CONTEXT_NEW_LAZY_TEST_H int unity_webapps_context_new_lazy_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-add-action-test.c0000644000015201777760000000755412312131641031274 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_add_action_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_launcher_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_launcher_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_launcher_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[5]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NPVariant result = unity_webapps_binding_launcher_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[4]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[3]); NPVariant result = unity_webapps_binding_launcher_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_add_action_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-show-indicator-test.h0000644000015201777760000000025512312131641032372 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_INDICATOR_SHOW_INDICATOR_TEST_H #define UNITY_WEBAPPS_INDICATOR_SHOW_INDICATOR_TEST_H int unity_webapps_indicator_show_indicator_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-clear-indicator-test.h0000644000015201777760000000026012312131641032474 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_INDICATOR_CLEAR_INDICATOR_TEST_H #define UNITY_WEBAPPS_INDICATOR_CLEAR_INDICATOR_TEST_H int unity_webapps_indicator_clear_indicator_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-add-static-action-test.h0000644000015201777760000000026312312131641032554 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_ADD_STATIC_ACTION_TEST_H #define UNITY_WEBAPPS_LAUNCHER_ADD_STATIC_ACTION_TEST_H int unity_webapps_launcher_add_static_action_test(void); #endif ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-action-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-action-tes0000644000015201777760000000533412312131641033612 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_remove_application_action_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_remove_application_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_remove_application_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_context_remove_application_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); NPVariant result = unity_webapps_binding_context_remove_application_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_remove_application_action_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-on-close-callback-test.h0000644000015201777760000000026012312131641032415 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_ON_CLOSE_CALLBACK_TEST_H #define UNITY_WEBAPPS_CONTEXT_ON_CLOSE_CALLBACK_TEST_H int unity_webapps_context_on_close_callback_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/test_common.h0000644000015201777760000000103112312131641027031 0ustar pbusernogroup00000000000000#include "unity-webapps-binding.h" typedef struct NPTestObject_t { NPObject object; bool exceptioncalled; } NPTestObject; void NPN_SetException(NPObject *npobj, const NPUTF8 *message); NPObject * NPN_RetainObject(NPObject *npobj); bool NPN_InvokeDefault(NPP npp , NPObject *npobj , const NPVariant *args , uint32_t argCount , NPVariant *result); void NPN_ReleaseVariantValue(NPVariant *variant); void * NPN_MemAlloc (uint32_t size); unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-get-domain-test.h0000644000015201777760000000023312312131641031170 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_GET_DOMAIN_TEST_H #define UNITY_WEBAPPS_CONTEXT_GET_DOMAIN_TEST_H int unity_webapps_context_get_domain_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-track-test.c0000644000015201777760000001076012312131641031770 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_set_track_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_set_track (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_set_track (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_set_track (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_music_player_set_track (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_music_player_set_track (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[6]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NULL_TO_NPVARIANT(args[5]); NPVariant result = unity_webapps_binding_music_player_set_track (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[5]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); STRINGZ_TO_NPVARIANT("",args[2]); STRINGZ_TO_NPVARIANT("",args[3]); STRINGZ_TO_NPVARIANT("",args[4]); NPVariant result = unity_webapps_binding_music_player_set_track (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_set_track_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-play-pause-callback-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-play-pause-callback-t0000644000015201777760000000655512312131641033371 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_on_play_pause_callback_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_on_play_pause_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_on_play_pause_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_on_play_pause_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_music_player_on_play_pause_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); NPVariant result = unity_webapps_binding_music_player_on_play_pause_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_on_play_pause_callback_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-preview-requested-callback-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-preview-requested-callbac0000644000015201777760000000660212312131641033577 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_set_preview_requested_callback_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_set_preview_requested_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_set_preview_requested_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_set_preview_requested_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_context_set_preview_requested_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); NPVariant result = unity_webapps_binding_context_set_preview_requested_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_set_preview_requested_callback_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-go-next-test.c0000644000015201777760000000530112312131641032777 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_set_can_go_next_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_set_can_go_next (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_set_can_go_next (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_music_player_set_can_go_next (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); BOOLEAN_TO_NPVARIANT(false,args[1]); NPVariant result = unity_webapps_binding_music_player_set_can_go_next (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_set_can_go_next_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-actions-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-actions-te0000644000015201777760000000031312312131641033602 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_REMOVE_APPLICATION_ACTIONS_TEST_H #define UNITY_WEBAPPS_CONTEXT_REMOVE_APPLICATION_ACTIONS_TEST_H int unity_webapps_context_remove_application_actions_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-view-is-active-test.c0000644000015201777760000000526512312131641032576 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_set_view_is_active_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_set_view_is_active (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_set_view_is_active (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_context_set_view_is_active (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); BOOLEAN_TO_NPVARIANT(false,args[1]); NPVariant result = unity_webapps_binding_context_set_view_is_active (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_set_view_is_active_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-prepare-test.c0000644000015201777760000000634112312131641030603 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_prepare_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_prepare (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_prepare (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_prepare (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_context_prepare (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); NPVariant result = unity_webapps_binding_context_prepare (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_prepare_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-play-test.c0000644000015201777760000000525712312131641032375 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_set_can_play_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_set_can_play (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_set_can_play (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_music_player_set_can_play (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); BOOLEAN_TO_NPVARIANT(false,args[1]); NPVariant result = unity_webapps_binding_music_player_set_can_play (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_set_can_play_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-play-test.h0000644000015201777760000000026012312131641032353 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_PLAY_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_GET_CAN_PLAY_TEST_H int unity_webapps_music_player_get_can_play_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-homepage-test.c0000644000015201777760000000521612312131641031523 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_set_homepage_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_set_homepage (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_set_homepage (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_context_set_homepage (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); NPVariant result = unity_webapps_binding_context_set_homepage (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_set_homepage_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-pause-test.c0000644000015201777760000000416412312131641032525 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_get_can_pause_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_get_can_pause (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_get_can_pause (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_music_player_get_can_pause (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_get_can_pause_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-play-pause-callback-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-play-pause-callback-t0000644000015201777760000000031612312131641033356 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_ON_PLAY_PAUSE_CALLBACK_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_ON_PLAY_PAUSE_CALLBACK_TEST_H int unity_webapps_music_player_on_play_pause_callback_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-set-callback-test.c0000644000015201777760000000760412312131641031765 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_indicator_set_callback_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_indicator_set_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_indicator_set_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_indicator_set_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_indicator_set_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[5]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NPVariant result = unity_webapps_binding_indicator_set_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[4]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[3]); NPVariant result = unity_webapps_binding_indicator_set_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_indicator_set_callback_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-set-property-icon-test.c0000644000015201777760000000761212312131641033042 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_indicator_set_property_icon_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_indicator_set_property_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_indicator_set_property_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_indicator_set_property_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_indicator_set_property_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[5]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NPVariant result = unity_webapps_binding_indicator_set_property_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[4]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); STRINGZ_TO_NPVARIANT("",args[2]); STRINGZ_TO_NPVARIANT("",args[3]); NPVariant result = unity_webapps_binding_indicator_set_property_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_indicator_set_property_icon_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/Makefile.am0000644000015201777760000003523312312131641026400 0ustar pbusernogroup00000000000000AM_CPPFLAGS = \ $(UNITY_NPAPI_PLUGIN_CFLAGS) $(NPAPI_DEBUG_CFLAGS) \ -I$(top_srcdir)/npapi-plugin/src noinst_PROGRAMS = \ context-add-application-actions-test \ context-remove-application-actions-test \ context-remove-application-action-test \ context-add-application-actions-test \ context-remove-application-actions-test \ context-remove-application-action-test \ context-get-domain-test \ context-get-interest-id-test \ context-get-name-test \ context-new-lazy-test \ context-on-close-callback-test \ context-on-raise-callback-test \ context-prepare-test \ context-set-homepage-test \ context-set-view-is-active-test \ context-set-view-location-test \ indicator-add-action-test \ indicator-clear-indicators-test \ indicator-clear-indicator-test \ indicator-set-callback-test \ indicator-set-property-icon-test \ indicator-set-property-test \ indicator-show-indicator-test \ launcher-add-action-test \ launcher-clear-count-test \ launcher-clear-progress-test \ launcher-remove-actions-test \ launcher-remove-action-test \ launcher-set-count-test \ launcher-set-progress-test \ launcher-set-urgent-test \ launcher-add-static-action-test \ launcher-remove-static-actions-test \ music-player-get-can-go-next-test \ music-player-get-can-go-previous-test \ music-player-get-can-pause-test \ music-player-get-can-play-test \ music-player-get-playback-state-test \ music-player-init-test \ music-player-on-next-callback-test \ music-player-on-play-pause-callback-test \ music-player-on-previous-callback-test \ music-player-set-can-go-next-test \ music-player-set-can-go-previous-test \ music-player-set-can-pause-test \ music-player-set-can-play-test \ music-player-set-playback-state-test \ music-player-set-track-test \ permissions-is-integration-allowed-test \ notification-show-notification-test context_get_domain_test_SOURCES = \ context-get-domain-test.c \ context-get-domain-test.h \ test_common.c \ test_common.h context_get_domain_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_get_interest_id_test_SOURCES = \ context-get-interest-id-test.c \ context-get-interest-id-test.h \ test_common.c \ test_common.h context_get_interest_id_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_get_name_test_SOURCES = \ context-get-name-test.c \ context-get-name-test.h \ test_common.c \ test_common.h context_get_name_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_new_lazy_test_SOURCES = \ context-new-lazy-test.c \ context-new-lazy-test.h \ test_common.c \ test_common.h context_new_lazy_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_on_close_callback_test_SOURCES = \ context-on-close-callback-test.c \ context-on-close-callback-test.h \ test_common.c \ test_common.h context_on_close_callback_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_on_raise_callback_test_SOURCES = \ context-on-raise-callback-test.c \ context-on-raise-callback-test.h \ test_common.c \ test_common.h context_on_raise_callback_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_prepare_test_SOURCES = \ context-prepare-test.c \ context-prepare-test.h \ test_common.c \ test_common.h context_prepare_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_set_homepage_test_SOURCES = \ context-set-homepage-test.c \ context-set-homepage-test.h \ test_common.c \ test_common.h context_set_homepage_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_set_view_is_active_test_SOURCES = \ context-set-view-is-active-test.c \ context-set-view-is-active-test.h \ test_common.c \ test_common.h context_set_view_is_active_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_set_view_location_test_SOURCES = \ context-set-view-location-test.c \ context-set-view-location-test.h \ test_common.c \ test_common.h context_set_view_location_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_add_application_actions_test_SOURCES = \ context-add-application-actions-test.c \ context-add-application-actions-test.h \ test_common.c \ test_common.h context_add_application_actions_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_remove_application_actions_test_SOURCES = \ context-remove-application-actions-test.c \ context-remove-application-actions-test.h \ test_common.c \ test_common.h context_remove_application_actions_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la context_remove_application_action_test_SOURCES = \ context-remove-application-action-test.c \ context-remove-application-action-test.h \ test_common.c \ test_common.h context_remove_application_action_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la indicator_add_action_test_SOURCES = \ indicator-add-action-test.c \ indicator-add-action-test.h \ test_common.c \ test_common.h indicator_add_action_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la indicator_clear_indicators_test_SOURCES = \ indicator-clear-indicators-test.c \ indicator-clear-indicators-test.h \ test_common.c \ test_common.h indicator_clear_indicators_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la indicator_clear_indicator_test_SOURCES = \ indicator-clear-indicator-test.c \ indicator-clear-indicator-test.h \ test_common.c \ test_common.h indicator_clear_indicator_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la indicator_set_callback_test_SOURCES = \ indicator-set-callback-test.c \ indicator-set-callback-test.h \ test_common.c \ test_common.h indicator_set_callback_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la indicator_set_property_icon_test_SOURCES = \ indicator-set-property-icon-test.c \ indicator-set-property-icon-test.h \ test_common.c \ test_common.h indicator_set_property_icon_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la indicator_set_property_test_SOURCES = \ indicator-set-property-test.c \ indicator-set-property-test.h \ test_common.c \ test_common.h indicator_set_property_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la indicator_show_indicator_test_SOURCES = \ indicator-show-indicator-test.c \ indicator-show-indicator-test.h \ test_common.c \ test_common.h indicator_show_indicator_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_add_action_test_SOURCES = \ launcher-add-action-test.c \ launcher-add-action-test.h \ test_common.c \ test_common.h launcher_add_action_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_clear_count_test_SOURCES = \ launcher-clear-count-test.c \ launcher-clear-count-test.h \ test_common.c \ test_common.h launcher_clear_count_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_clear_progress_test_SOURCES = \ launcher-clear-progress-test.c \ launcher-clear-progress-test.h \ test_common.c \ test_common.h launcher_clear_progress_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_remove_actions_test_SOURCES = \ launcher-remove-actions-test.c \ launcher-remove-actions-test.h \ test_common.c \ test_common.h launcher_remove_actions_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_remove_action_test_SOURCES = \ launcher-remove-action-test.c \ launcher-remove-action-test.h \ test_common.c \ test_common.h launcher_remove_action_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_set_count_test_SOURCES = \ launcher-set-count-test.c \ launcher-set-count-test.h \ test_common.c \ test_common.h launcher_set_count_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_set_progress_test_SOURCES = \ launcher-set-progress-test.c \ launcher-set-progress-test.h \ test_common.c \ test_common.h launcher_set_progress_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_set_urgent_test_SOURCES = \ launcher-set-urgent-test.c \ launcher-set-urgent-test.h \ test_common.c \ test_common.h launcher_set_urgent_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_add_static_action_test_SOURCES = \ launcher-add-static-action-test.c \ launcher-add-static-action-test.h \ test_common.c \ test_common.h launcher_add_static_action_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la launcher_remove_static_actions_test_SOURCES = \ launcher-remove-static-actions-test.c \ launcher-remove-static-actions-test.h \ test_common.c \ test_common.h launcher_remove_static_actions_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_get_can_go_next_test_SOURCES = \ music-player-get-can-go-next-test.c \ music-player-get-can-go-next-test.h \ test_common.c \ test_common.h music_player_get_can_go_next_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_get_can_go_previous_test_SOURCES = \ music-player-get-can-go-previous-test.c \ music-player-get-can-go-previous-test.h \ test_common.c \ test_common.h music_player_get_can_go_previous_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_get_can_pause_test_SOURCES = \ music-player-get-can-pause-test.c \ music-player-get-can-pause-test.h \ test_common.c \ test_common.h music_player_get_can_pause_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_get_can_play_test_SOURCES = \ music-player-get-can-play-test.c \ music-player-get-can-play-test.h \ test_common.c \ test_common.h music_player_get_can_play_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_get_playback_state_test_SOURCES = \ music-player-get-playback-state-test.c \ music-player-get-playback-state-test.h \ test_common.c \ test_common.h music_player_get_playback_state_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_init_test_SOURCES = \ music-player-init-test.c \ music-player-init-test.h \ test_common.c \ test_common.h music_player_init_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_on_next_callback_test_SOURCES = \ music-player-on-next-callback-test.c \ music-player-on-next-callback-test.h \ test_common.c \ test_common.h music_player_on_next_callback_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_on_play_pause_callback_test_SOURCES = \ music-player-on-play-pause-callback-test.c \ music-player-on-play-pause-callback-test.h \ test_common.c \ test_common.h music_player_on_play_pause_callback_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_on_previous_callback_test_SOURCES = \ music-player-on-previous-callback-test.c \ music-player-on-previous-callback-test.h \ test_common.c \ test_common.h music_player_on_previous_callback_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_set_can_go_next_test_SOURCES = \ music-player-set-can-go-next-test.c \ music-player-set-can-go-next-test.h \ test_common.c \ test_common.h music_player_set_can_go_next_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_set_can_go_previous_test_SOURCES = \ music-player-set-can-go-previous-test.c \ music-player-set-can-go-previous-test.h \ test_common.c \ test_common.h music_player_set_can_go_previous_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_set_can_pause_test_SOURCES = \ music-player-set-can-pause-test.c \ music-player-set-can-pause-test.h \ test_common.c \ test_common.h music_player_set_can_pause_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_set_can_play_test_SOURCES = \ music-player-set-can-play-test.c \ music-player-set-can-play-test.h \ test_common.c \ test_common.h music_player_set_can_play_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_set_playback_state_test_SOURCES = \ music-player-set-playback-state-test.c \ music-player-set-playback-state-test.h \ test_common.c \ test_common.h music_player_set_playback_state_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la music_player_set_track_test_SOURCES = \ music-player-set-track-test.c \ music-player-set-track-test.h \ test_common.c \ test_common.h music_player_set_track_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la permissions_is_integration_allowed_test_SOURCES = \ permissions-is-integration-allowed-test.c \ permissions-is-integration-allowed-test.h \ test_common.c \ test_common.h permissions_is_integration_allowed_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la notification_show_notification_test_SOURCES = \ notification-show-notification-test.c \ notification-show-notification-test.h \ test_common.c \ test_common.h notification_show_notification_test_LDADD = \ $(UNITY_NPAPI_PLUGIN_LIBS) \ $(top_builddir)/npapi-plugin/src/libunity_npapi_plugin.la TESTS = $(noinst_PROGRAMS) unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-destroy-test.h0000644000015201777760000000022212312131641030633 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_DESTROY_TEST_H #define UNITY_WEBAPPS_CONTEXT_DESTROY_TEST_H int unity_webapps_context_destroy_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-destroy-test.c0000644000015201777760000000501512312131641030633 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_destroy_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_destroy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_destroy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_context_destroy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } } // check arg types // check that function is reached w/ proper args { NPTestObject tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); BOOLEAN_TO_NPVARIANT(false,args[1]); NPVariant result = unity_webapps_binding_context_destroy (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (tobject.exceptioncalled || !func_reached) { return 1; } } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_destroy_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-add-static-action-test.c0000644000015201777760000000641412312131641032553 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_add_static_action_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_add_static_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_launcher_add_static_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_launcher_add_static_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_launcher_add_static_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); STRINGZ_TO_NPVARIANT("",args[2]); NPVariant result = unity_webapps_binding_launcher_add_static_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_add_static_action_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-set-count-test.h0000644000015201777760000000023312312131641031202 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_SET_COUNT_TEST_H #define UNITY_WEBAPPS_LAUNCHER_SET_COUNT_TEST_H int unity_webapps_launcher_set_count_test(void); #endif ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-playback-state-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-playback-state-test.0000644000015201777760000000532112312131641033422 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_set_playback_state_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_set_playback_state (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_set_playback_state (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_music_player_set_playback_state (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); INT32_TO_NPVARIANT(1,args[1]); NPVariant result = unity_webapps_binding_music_player_set_playback_state (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_set_playback_state_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-clear-indicators-test.h0000644000015201777760000000026312312131641032662 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_INDICATOR_CLEAR_INDICATORS_TEST_H #define UNITY_WEBAPPS_INDICATOR_CLEAR_INDICATORS_TEST_H int unity_webapps_indicator_clear_indicators_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-add-icon-test.h0000644000015201777760000000022512312131641030623 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_ADD_ICON_TEST_H #define UNITY_WEBAPPS_CONTEXT_ADD_ICON_TEST_H int unity_webapps_context_add_icon_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-pause-test.h0000644000015201777760000000026312312131641032542 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_PAUSE_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_PAUSE_TEST_H int unity_webapps_music_player_set_can_pause_test(void); #endif ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-go-previous-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-can-go-previous-test0000644000015201777760000000030512312131641033453 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_GO_PREVIOUS_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_SET_CAN_GO_PREVIOUS_TEST_H int unity_webapps_music_player_set_can_go_previous_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-show-indicator-test.c0000644000015201777760000000524612312131641032372 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_indicator_show_indicator_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_indicator_show_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_indicator_show_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_indicator_show_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); NPVariant result = unity_webapps_binding_indicator_show_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_indicator_show_indicator_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-get-name-test.h0000644000015201777760000000022512312131641030642 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_GET_NAME_TEST_H #define UNITY_WEBAPPS_CONTEXT_GET_NAME_TEST_H int unity_webapps_context_get_name_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-next-callback-test.h0000644000015201777760000000027412312131641033221 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_ON_NEXT_CALLBACK_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_ON_NEXT_CALLBACK_TEST_H int unity_webapps_music_player_on_next_callback_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-add-action-test.h0000644000015201777760000000024112312131641031436 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_INDICATOR_ADD_ACTION_TEST_H #define UNITY_WEBAPPS_INDICATOR_ADD_ACTION_TEST_H int unity_webapps_indicator_add_action_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-add-icon-test.c0000644000015201777760000000630312312131641030621 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_add_icon_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_add_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_add_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_add_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_context_add_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); INT32_TO_NPVARIANT(0,args[2]); NPVariant result = unity_webapps_binding_context_add_icon (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_add_icon_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-remove-action-test.c0000644000015201777760000000523212312131641032030 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_remove_action_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_remove_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_launcher_remove_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_launcher_remove_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); NPVariant result = unity_webapps_binding_launcher_remove_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_remove_action_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-previous-callback-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-previous-callback-tes0000644000015201777760000000653712312131641033515 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_on_previous_callback_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_on_previous_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_on_previous_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_on_previous_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_music_player_on_previous_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); NPVariant result = unity_webapps_binding_music_player_on_previous_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_on_previous_callback_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-preview-requested-callback-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-set-preview-requested-callbac0000644000015201777760000000032712312131641033575 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_SET_PREVIEW_REQUESTED_CALLBACK_TEST_H #define UNITY_WEBAPPS_CONTEXT_SET_PREVIEW_REQUESTED_CALLBACK_TEST_H int unity_webapps_context_set_preview_requested_callback_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-next-callback-test.c0000644000015201777760000000650312312131641033215 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_on_next_callback_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_on_next_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_music_player_on_next_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_on_next_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_music_player_on_next_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); NPVariant result = unity_webapps_binding_music_player_on_next_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_on_next_callback_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-clear-progress-test.c0000644000015201777760000000414512312131641032212 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_clear_progress_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_clear_progress (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_launcher_clear_progress (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_launcher_clear_progress (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_clear_progress_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-add-action-test.c0000644000015201777760000000756412312131641031450 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_indicator_add_action_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_indicator_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_indicator_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_indicator_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_indicator_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[5]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NPVariant result = unity_webapps_binding_indicator_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[4]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[3]); NPVariant result = unity_webapps_binding_indicator_add_action (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_indicator_add_action_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-add-application-actions-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-add-application-actions-test.0000644000015201777760000000030212312131641033460 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_ADD_APPLICATION_ACTIONS_TEST_H #define UNITY_WEBAPPS_CONTEXT_ADD_APPLICATION_ACTIONS_TEST_H int unity_webapps_context_add_application_actions_test(void); #endif ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-previous-callback-test.hunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-on-previous-callback-tes0000644000015201777760000000031012312131641033474 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_ON_PREVIOUS_CALLBACK_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_ON_PREVIOUS_CALLBACK_TEST_H int unity_webapps_music_player_on_previous_callback_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-get-domain-test.c0000644000015201777760000000411412312131641031165 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_get_domain_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_get_domain (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_get_domain (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_context_get_domain (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_get_domain_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-remove-static-actions-test.c0000644000015201777760000000421012312131641033473 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_remove_static_actions_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_remove_static_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_launcher_remove_static_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_launcher_remove_static_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_remove_static_actions_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-clear-count-test.h0000644000015201777760000000024112312131641031474 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_CLEAR_COUNT_TEST_H #define UNITY_WEBAPPS_LAUNCHER_CLEAR_COUNT_TEST_H int unity_webapps_launcher_clear_count_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-clear-indicator-test.c0000644000015201777760000000525412312131641032477 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_indicator_clear_indicator_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_indicator_clear_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_indicator_clear_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_indicator_clear_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[2]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); NPVariant result = unity_webapps_binding_indicator_clear_indicator (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_indicator_clear_indicator_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-on-raise-callback-test.h0000644000015201777760000000026012312131641032413 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_ON_RAISE_CALLBACK_TEST_H #define UNITY_WEBAPPS_CONTEXT_ON_RAISE_CALLBACK_TEST_H int unity_webapps_context_on_raise_callback_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-set-track-test.h0000644000015201777760000000024712312131641031774 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_SET_TRACK_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_SET_TRACK_TEST_H int unity_webapps_music_player_set_track_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-set-urgent-test.h0000644000015201777760000000023612312131641031361 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_SET_URGENT_TEST_H #define UNITY_WEBAPPS_LAUNCHER_SET_URGENT_TEST_H int unity_webapps_launcher_set_urgent_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-on-raise-callback-test.c0000644000015201777760000000644712312131641032423 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_on_raise_callback_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_on_raise_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_context_on_raise_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_on_raise_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[4]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NPVariant result = unity_webapps_binding_context_on_raise_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[3]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[1]); OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[2]); NPVariant result = unity_webapps_binding_context_on_raise_callback (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_on_raise_callback_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-go-previous-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-go-previous-test0000644000015201777760000000422212312131641033441 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_get_can_go_previous_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_get_can_go_previous (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_get_can_go_previous (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_music_player_get_can_go_previous (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_get_can_go_previous_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-init-test.h0000644000015201777760000000023012312131641031032 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_MUSIC_PLAYER_INIT_TEST_H #define UNITY_WEBAPPS_MUSIC_PLAYER_INIT_TEST_H int unity_webapps_music_player_init_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/music-player-get-can-go-next-test.c0000644000015201777760000000417612312131641032774 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_music_player_get_can_go_next_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_music_player_get_can_go_next (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_music_player_get_can_go_next (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_music_player_get_can_go_next (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_music_player_get_can_go_next_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/indicator-set-property-test.c0000644000015201777760000000754212312131641032116 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_indicator_set_property_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_indicator_set_property (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[1]; NULL_TO_NPVARIANT(args[0]); NPVariant result = unity_webapps_binding_indicator_set_property (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_indicator_set_property (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[3]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NPVariant result = unity_webapps_binding_indicator_set_property (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[5]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NULL_TO_NPVARIANT(args[2]); NULL_TO_NPVARIANT(args[3]); NULL_TO_NPVARIANT(args[4]); NPVariant result = unity_webapps_binding_indicator_set_property (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[4]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); STRINGZ_TO_NPVARIANT("",args[1]); STRINGZ_TO_NPVARIANT("",args[2]); STRINGZ_TO_NPVARIANT("",args[3]); NPVariant result = unity_webapps_binding_indicator_set_property (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_indicator_set_property_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-set-urgent-test.c0000644000015201777760000000412112312131641031351 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_launcher_set_urgent_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_launcher_set_urgent (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_launcher_set_urgent (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_launcher_set_urgent (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_launcher_set_urgent_test()) { return 1; } return 0; } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-actions-test.cunity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-remove-application-actions-te0000644000015201777760000000423412312131641033610 0ustar pbusernogroup00000000000000 #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int unity_webapps_context_remove_application_actions_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count { NPTestObject tobject = {0}; NPVariant args[0]; NPVariant result = unity_webapps_binding_context_remove_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } { NPTestObject tobject = {0}; NPVariant args[2]; NULL_TO_NPVARIANT(args[0]); NULL_TO_NPVARIANT(args[1]); NPVariant result = unity_webapps_binding_context_remove_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } // check arg types // check that function is reached w/ proper args { wrapped_void_ptr_t tobject = {0}; NPVariant args[1]; OBJECT_TO_NPVARIANT((NPObject*) &tobject,args[0]); NPVariant result = unity_webapps_binding_context_remove_application_actions (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } return 0; } int main (int argc, char **argv) { if (unity_webapps_context_remove_application_actions_test()) { return 1; } return 0; } unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/launcher-set-progress-test.h0000644000015201777760000000024412312131641031720 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_LAUNCHER_SET_PROGRESS_TEST_H #define UNITY_WEBAPPS_LAUNCHER_SET_PROGRESS_TEST_H int unity_webapps_launcher_set_progress_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/notification-show-notification-test.h0000644000015201777760000000027712312131641033622 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_NOTIFICATION_SHOW_NOTIFICATION_TEST_H #define UNITY_WEBAPPS_NOTIFICATION_SHOW_NOTIFICATION_TEST_H int unity_webapps_notification_show_notification_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/npapi/context-prepare-test.h0000644000015201777760000000022212312131641030600 0ustar pbusernogroup00000000000000 #ifndef UNITY_WEBAPPS_CONTEXT_PREPARE_TEST_H #define UNITY_WEBAPPS_CONTEXT_PREPARE_TEST_H int unity_webapps_context_prepare_test(void); #endif unity-chromium-extension-3.0.0+14.04.20140318/tests/unit/Makefile.am0000644000015201777760000000002012312131641025253 0ustar pbusernogroup00000000000000SUBDIRS = npapi unity-chromium-extension-3.0.0+14.04.20140318/tests/functional/0000755000015201777760000000000012312132125024410 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/functional/npapi/0000755000015201777760000000000012312132125025517 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/functional/npapi/driver.py0000644000015201777760000000200312312131641027361 0ustar pbusernogroup00000000000000import sys import os def get_test_folders(path): import os if not os.path.exists(path): raise Exception("Invalid path: does not exist") return [os.path.join(path,folder) for folder in os.listdir(path) if os.path.isdir(os.path.join(path,folder)) and folder.endswith('_test')] def launch_test(path): import os if not os.path.exists(path): raise Exception("Invalid path for test: " + path) import subprocess subprocess.check_call(['xdg-open']) def detect_chrome_exec(): import gio return gio.app_info_get_default_for_uri_scheme('http').get_executable() chrome_exec = detect_chrome_exec() if not "chrome" in chrome_exec or not "chromium" in chrome_exec: # TODO fix this w/ proper parameters/flags print "Only work with chrome as the default browser" sys.exit(1) # add test_folders = get_test_folders(os.getcwd()) for test_folder in test_folders: import subprocess print subprocess.check_output ([chrome_exec, '--load-extension="' + test_folder + '"']) unity-chromium-extension-3.0.0+14.04.20140318/tests/functional/npapi/context_new_lazy_test/0000755000015201777760000000000012312132125032152 5ustar pbusernogroup00000000000000././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/functional/npapi/context_new_lazy_test/manifest.jsonunity-chromium-extension-3.0.0+14.04.20140318/tests/functional/npapi/context_new_lazy_test/manifest.0000644000015201777760000000104412312131641033762 0ustar pbusernogroup00000000000000{ "name": "Test - npapi context_new_lazy", "version": "0.1", "description": "Test", "background_page": "background-page.html", "permissions": ["tabs", "http://*/*"], "plugins": [ /** The "path" property specifies the path to your plugin, relative to the manifest file. * The "public" property specifies whether your plugin can be accessed by regular web pages; * the default is false, meaning only your extension can load the plugin. */ { "path": "libunity_npapi_plugin.so", "public": true } ] } ././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/functional/npapi/context_new_lazy_test/background-page.htmlunity-chromium-extension-3.0.0+14.04.20140318/tests/functional/npapi/context_new_lazy_test/backgroun0000644000015201777760000000406112312131641034053 0ustar pbusernogroup00000000000000 Unity Webapps Extension Test Background Page unity-chromium-extension-3.0.0+14.04.20140318/tests/stress/0000755000015201777760000000000012312132125023571 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/Makefile.am0000644000015201777760000000001612312131641024301 0ustar pbusernogroup00000000000000SUBDIRS = unitunity-chromium-extension-3.0.0+14.04.20140318/tests/extension/0000755000015201777760000000000012312132125024262 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/extension/bulked-actions/0000755000015201777760000000000012312132125027166 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/extension/bulked-actions/manifest.json0000644000015201777760000000107112312131641031670 0ustar pbusernogroup00000000000000{ "name": "Test - bulked actions test", "version": "0.1.3", "description": "Test - bulked actions test", "background_page": "background-page.html", "permissions": ["tabs", "http://*/*"], "plugins": [ /** The "path" property specifies the path to your plugin, relative to the manifest file. * The "public" property specifies whether your plugin can be accessed by regular web pages; * the default is false, meaning only your extension can load the plugin. */ { "path": "libunity_npapi_plugin.so", "public": true } ] } unity-chromium-extension-3.0.0+14.04.20140318/tests/extension/bulked-actions/background-page.html0000644000015201777760000000360112312131641033107 0ustar pbusernogroup00000000000000 Unity Webapps Extension Test Background Page unity-chromium-extension-3.0.0+14.04.20140318/tests/extension/context-as-uid-in-js/0000755000015201777760000000000012312132125030144 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/extension/context-as-uid-in-js/manifest.json0000644000015201777760000000115712312131641032653 0ustar pbusernogroup00000000000000{ "name": "Test - displays a given valid context as a proper UID", "version": "0.1.3", "description": "Test - displays a given valid context as a proper UID", "background_page": "background-page.html", "permissions": ["tabs", "http://*/*"], "plugins": [ /** The "path" property specifies the path to your plugin, relative to the manifest file. * The "public" property specifies whether your plugin can be accessed by regular web pages; * the default is false, meaning only your extension can load the plugin. */ { "path": "libunity_npapi_plugin.so", "public": true } ] } ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/tests/extension/context-as-uid-in-js/background-page.htmlunity-chromium-extension-3.0.0+14.04.20140318/tests/extension/context-as-uid-in-js/background-page.h0000644000015201777760000000116412312131641033352 0ustar pbusernogroup00000000000000 Unity Webapps Extension Test Background Page unity-chromium-extension-3.0.0+14.04.20140318/NEWS0000644000015201777760000000000012312131641021573 0ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/0000755000015201777760000000000012312132125024372 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/parser.py0000644000015201777760000001325412312131641026247 0ustar pbusernogroup00000000000000def _next_statement(content, idx): statement = '' initidx = idx while idx < len(content) and content[idx] != ';': idx = idx + 1 idx = idx + 1 statement = content[initidx:idx-1] return idx, statement.strip().replace('\n', '') def _tokenize_statement(statement): tokens = r""" (?P[a-zA-Z_][a-zA-Z0-9_]*) |(?P[,]) |(?P[\(]) |(?P[\)]) |(?P[\*]) |(?P[;]) |(?P[\n]) |(?P[\s]) |(?P[}]) |(?P[{]) """ import re tre = re.compile(tokens,re.X) idx = 0 m = tre.match(statement, idx) while m: idx = m.end() yield m.lastgroup.strip(), m.group(m.lastgroup).strip() m = tre.match(statement, idx) def _is_whitespace_token(t): return t == 'newline' or t == 'whitespace' def _next(stream): try: return stream.next() except: return None def _eat_tokens(stream, stop_predicate): tokens = [] while True: t = _next(stream) while t and _is_whitespace_token(t[0]): t = _next(stream) if not t: break tokens.append(t) if stop_predicate and stop_predicate(t): break return tokens def _expect_tokens(types, stream): tokens = [] try: while len(types) != 0: cur_type = types.pop(0) t = _next(stream) while _is_whitespace_token(t[0]): t = _next(stream) if not t: break tokens.append(t) if not t[0] == cur_type: return False, tokens except IndexError, e: pass return True, tokens # TODO review this mess def _parse_typedef_statement(statement, token_stream): # expects a given shape (callback definitions) t = _next(token_stream) while t and t[0] != 'openparen': t = _next(token_stream) if not t: print "Could not properly parse typedef statement:", statement return False, {} result, tokens = _expect_tokens(['star', 'identifier', 'closeparen'], token_stream) if not result or len(tokens) != 3: print 'Could not properly parse typedef statement (not a pointer to func):', statement return False, {} description = {'type': 'func_typedef', 'name': tokens[1]} param_tokens = _eat_tokens(token_stream, lambda t: len(t) == 2 and t[0] == 'closeparen') if not len(param_tokens) != 0 or not (param_tokens[0][0] == 'openparen' and param_tokens[-1][0] == 'closeparen'): print 'Could not properly parse typedef statement (not a pointer to func):', statement return False, {} param_tokens.pop(0); param_tokens.pop() description['parameters'] = [] param = [] while len(param_tokens) != 0: param.append(param_tokens.pop(0)) if len(param_tokens) == 0 or param_tokens[0][0] == 'coma': # TODO validate params param_name = param.pop()[1] description['parameters'].append ({'name': param_name , 'type': ' '.join ([p[1] for p in param])}) param = [] return True, description # TODO review this mess def _parse_function_decl_statement(prev_token, statement, token_stream): # expects a given shape param_tokens = _eat_tokens(token_stream, lambda t: len(t) == 2 and t[0] == 'openparen') if not len(param_tokens) >= 2 or len(param_tokens[-1]) != 2 or param_tokens[-1][0] != 'openparen': print 'Could not properly parse function declaration statement:', statement return False, {} param_tokens.pop() # TODO validate 'identifier' description = {'type': 'func_decl', 'name': param_tokens.pop()} description['return'] = [prev_token[1]] description['return'].extend ([p[1] for p in param_tokens]) tokens = _eat_tokens(token_stream, lambda t: len(t) == 2 and t[0] == 'closeparen') if not tokens or len(tokens) < 2 or tokens[-1][0] != 'closeparen': print 'Could not properly parse function declaration statement:', statement return False, {} description['parameters'] = [] param = [] while len(tokens) != 0: param.append(tokens.pop(0)) if len(tokens) == 0 or tokens[0][0] == 'coma' or tokens[0][0] == 'closeparen': # TODO validate params # assume type + param name if len(param) >= 2: param_name = param.pop()[1] description['parameters'].append ({'name': param_name , 'type': ' '.join ([p[1] for p in param])}) param = [] if len(tokens) != 0: tokens.pop(0) return True, description def _parse_statement(statement): if len(statement.strip()) == 0: return False, {} token_stream = _tokenize_statement(statement) t = _next(token_stream) if not t: return False, {} if not t[0] == 'identifier': print 'Ignoring statement:', statement, 'does not start with a proper identifier' return False, {} if t[1] == 'typedef': return _parse_typedef_statement(statement, token_stream) if t[1] == 'struct': print 'Skipping struct statement:', statement return False, {} return _parse_function_decl_statement(t, statement, token_stream) def parse(content): idx = 0 idx, statement = _next_statement(content, idx) descriptions = [] while statement != '' or idx < len(content): parsed, description = _parse_statement(statement) if parsed: descriptions.append (description) idx, statement = _next_statement(content, idx) return descriptions unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/source_generator.py0000644000015201777760000001625312312131641030323 0ustar pbusernogroup00000000000000""" """ import common_gen import npapi_meta def generate_sources_for(function_descriptions, callback_decls): content = "" func_decls = [] content += _generate_callback_dispatchers (callback_decls) for func_description in function_descriptions: func_decls.append(_generate_source_for(func_description, callback_decls)) content += '\n'.join (func_decls) return content def _generate_callback_dispatchers(callback_decls): dispatchers = [] for callback_decl in callback_decls: dispatchers.append (_generate_callback_dispatcher_for(callback_decl)) return "\n".join(dispatchers) def _generate_source_for(func_description, callback_decls): function_name = common_gen.get_binding_function_prefix () + func_description['name'][1].replace (common_gen.get_unity_webapps_function_prefix(), '') arg_count_validation_chunk = _generate_function_argument_count_check (len(func_description['parameters'])); arg_validation_chunk = _generate_function_argument_type_validation (func_description['parameters']) var_creation_chunk = _generate_variable_creation_for_args (func_description['parameters'], callback_decls) func_call_chunk = _generate_webapps_function_call_for (func_description, callback_decls); free_resources_chunk = _generate_free_arguments_for (func_description['parameters']); return """ NPVariant %s (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount) { NPVariant result; NULL_TO_NPVARIANT (result); %s %s %s %s %s return result; } """ % (function_name , arg_count_validation_chunk , arg_validation_chunk , var_creation_chunk , func_call_chunk , free_resources_chunk ) def _generate_function_argument_count_check (count): return """ if (argCount != %s) { NPN_SetException (npobject, "Invalid number of arguments for function call"); return result; } """ % str(count) def _generate_function_argument_type_validation (args): validators = [] types = [arg['type'] for arg in args] for i, t in enumerate(types): arg = '(args[' + str(i) + '])' meta = npapi_meta.get_meta_info_for_type(t) validators.append (' ( ! ' + meta['validator'] + arg + ' && ! is_null_or_void' + arg + ' )') if len(validators) == 0: return "" return """ if ( %s ) { NPN_SetException(npobject, "Invalid argument type for function call"); return result; } """ % " || \n\t".join (validators) def _is_pointer_type(param_type): return param_type.strip().endswith('*') def _generate_webapps_function_call_for (func_decl, callback_decls): func_params = func_decl['parameters'] callback_types = [callback_decl['name'][1] for callback_decl in callback_decls] params = [] # twisted way to "modify the state of the post-argument" generations # given information extracted in a current state param_modifier = lambda param: param for func_param in func_params: name = func_param['name'] if func_param['type'] in callback_types: name = _get_dispatcher_function_name(func_param['type']) param_modifier = lambda param: param == "user_data" and "wrappedCallback" or param else: name = param_modifier(name) params.append (name) fun_call = "REACHED_UNITY_WEBAPPS_FUNC_CALL();\n" fun_call += func_decl['name'][1] + "(" + ", ".join (params) + ");\n" return_type = ' '.join(func_decl['return']) if return_type != 'void' and _is_pointer_type(return_type): fun_call = return_type + ' ret_val = ' + fun_call meta = npapi_meta.get_meta_info_for_type(return_type) if meta and meta['nullable']: fun_call = fun_call + """ if (NULL == ret_val) { return result; } NPObject * object = create_wrapped_ptr_object_for (instance, ret_val); if (NULL == object) { NPN_SetException(npobject, "Unable to wrap return value from NPAPI call"); return result; } OBJECT_TO_NPVARIANT(object, result); """ else: fun_call = fun_call + """ %s (ret_val, result); """ % meta['to_variant'] return fun_call def _generate_free_arguments_for (args): arg_infos = zip (range(len(args)) , [arg['type'] for arg in args] , [arg['name'] for arg in args]) gen = [] for idx, arg_type, arg_name in arg_infos: meta = npapi_meta.get_meta_info_for_type (arg_type) if not meta: print "_generate_free_arguments_for: No meta information found for type: ", arg_type else: if meta.has_key('can_free') and meta['can_free']: gen.append ("\tg_free (" + arg_name + ");") return '\n'.join (gen) def _generate_variable_creation_for_arg (idx, arg_type, arg_name, callback_decls): meta = npapi_meta.get_meta_info_for_type (arg_type) src = '' callback_types = [callback_decl['name'][1] for callback_decl in callback_decls] if arg_type in callback_types: # handle callback gen src += _generate_callback_handling(idx, callback_decls[callback_types.index(arg_type)]) elif meta['create_var']: src += "\t%s %s = %s;\n" % (arg_type, arg_name, meta['null']) if not meta['creator'] is None: src += """ if ( ! is_null_or_void (args[%d])) { \t%s = %s; } """ % (idx, arg_name, meta['creator'] % idx) return src def _generate_variable_creation_for_args (args, callback_decls): arg_infos = zip (range(len(args)) , [arg['type'] for arg in args] , [arg['name'] for arg in args]) gen = [] for idx, arg_type, arg_name in arg_infos: gen.append (_generate_variable_creation_for_arg (idx, arg_type, arg_name, callback_decls)) return '\n'.join (gen) def _generate_callback_handling (param_idx, callback_decl): return """ NPObject * callback = NPVARIANT_TO_OBJECT(args[%d]); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, callback); NPObject * wrappedCallback = create_wrapped_callback_object_for (instance, callback); ADD_NPOBJECT_RETAIN_FOR_CONTEXT(instance, context, wrappedCallback); """ % (param_idx, ) def _get_dispatcher_function_name (name): return "%s_dispatcher" % name def _generate_callback_dispatcher_for (callback_decl): name = callback_decl['name'][1] dispatcher_func_name = _get_dispatcher_function_name(name) params = callback_decl['parameters'] return """ static void %s (UnityWebappsContext * context, gpointer user_data) { // not really safe ... wrapped_callback_t * pCallbackObject = (wrapped_callback_t *) user_data; // fill out the arguments NPVariant args [%d]; // TODO call w/ meaningful values %s NPVariant response; NPN_InvokeDefault (pCallbackObject->instance, pCallbackObject->wrapped_callback, args, G_N_ELEMENTS(args), &response); NPN_ReleaseVariantValue(&response); } """ % (dispatcher_func_name,len(params), "\n".join (["NULL_TO_NPVARIANT (args[%d]); //%s" % (i,param['name']) for i, param in enumerate(params)])) unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/prepasses.py0000644000015201777760000000156412312131641026761 0ustar pbusernogroup00000000000000""" Defines a set of prepasses to cleanup a given header for FFI-npapi generation """ _PASSES = [] def _add_pass(p): _PASSES.append(p) # pre-passes definitions def _cleanup_comments(content): """ cleanup C/C++ style comments bad usage of regexp but works for our simplified context """ import re return re.sub (r"/\*.*?\*/|//[^\n]*", '', content, flags=re.DOTALL) def _cleanup_pp_statements(content): """ cleanup of preprocessor statements again assume some structure in the input string, very simplistic """ import re directive_re = re.compile("^\s*#.*$") return "\n".join ([line for line in content.split('\n') if not directive_re.match(line)]) _add_pass (_cleanup_comments) _add_pass (_cleanup_pp_statements) def run_prepasses(content): for pas in _PASSES: content = pas(content) return content unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/0000755000015201777760000000000012312132125025534 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/0000755000015201777760000000000012312132125026445 5ustar pbusernogroup00000000000000././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/pre-pass-cleanup-data-2.resultunity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/pre-pass-cleanup-data-2.r0000644000015201777760000001441112312131641033060 0ustar pbusernogroup00000000000000 typedef struct _UnityWebappsContextPrivate UnityWebappsContextPrivate; typedef struct _UnityWebappsContext UnityWebappsContext; struct _UnityWebappsContext { GObject object; UnityWebappsContextPrivate *priv; }; typedef struct _UnityWebappsContextClass UnityWebappsContextClass; struct _UnityWebappsContextClass { GObjectClass parent_class; }; typedef void (*UnityWebappsContextReadyCallback) (UnityWebappsContext *, gpointer user_data); typedef void (*UnityWebappsContextRaiseCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextNotifyCallback) (UnityWebappsContext *, gint, gpointer); typedef void (*UnityWebappsContextViewNotifyCallback) (UnityWebappsContext *, gint, gboolean, gpointer); typedef void (*UnityWebappsContextLocationNotifyCallback) (UnityWebappsContext *, gint, const gchar *, gpointer); typedef void (*UnityWebappsContextWindowNotifyCallback) (UnityWebappsContext *, gint, guint64, gpointer); typedef const gchar * (*UnityWebappsContextPreviewCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextPreviewReadyCallback) (UnityWebappsContext *context, gint interest_id, const gchar *preview_data, gpointer user_data); typedef void (*UnityWebappsContextActionCallback) (UnityWebappsContext *context, gpointer user_data); typedef struct { const gchar *path; UnityWebappsContextActionCallback callback; gpointer user_data; } UnityWebappsApplicationActionDesc; GType unity_webapps_context_get_type (void) G_GNUC_CONST; void unity_webapps_context_new (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url, UnityWebappsContextReadyCallback callback, gpointer user_data); UnityWebappsContext *unity_webapps_context_new_sync (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_destroy (UnityWebappsContext *context, gboolean user_abandoned); const gchar *unity_webapps_context_get_context_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_domain (UnityWebappsContext *context); const gchar *unity_webapps_context_get_desktop_name (UnityWebappsContext *context); gchar *unity_webapps_context_get_icon_name (UnityWebappsContext *context); void unity_webapps_context_add_icon (UnityWebappsContext *context, const gchar *url, gint size); void unity_webapps_context_on_raise_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); void unity_webapps_context_on_close_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); gboolean unity_webapps_context_get_view_is_active (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_is_active (UnityWebappsContext *context, gboolean active); void unity_webapps_context_on_view_is_active_changed (UnityWebappsContext *context, UnityWebappsContextViewNotifyCallback callback, gpointer user_data); UnityWebappsContext * unity_webapps_context_new_for_context_name (UnityWebappsService *service, const gchar *context_name); GVariant *unity_webapps_context_list_interests (UnityWebappsContext *context); void unity_webapps_context_on_interest_appeared (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_on_interest_vanished (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_raise (UnityWebappsContext *context); void unity_webapps_context_raise_interest (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_close (UnityWebappsContext *context); void unity_webapps_context_close_interest (UnityWebappsContext *context, gint interest_id); gchar *unity_webapps_context_get_interest_owner (UnityWebappsContext *context, gint interest_id); gchar * unity_webapps_context_get_view_location (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_location (UnityWebappsContext *context, const gchar *location); void unity_webapps_context_on_view_location_changed (UnityWebappsContext *context, UnityWebappsContextLocationNotifyCallback callback, gpointer user_data); guint64 unity_webapps_context_get_view_window (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_window (UnityWebappsContext *context, guint64 window); void unity_webapps_context_on_view_window_changed (UnityWebappsContext *context, UnityWebappsContextWindowNotifyCallback callback, gpointer user_data); void unity_webapps_context_set_preview_requested_callback (UnityWebappsContext *context, UnityWebappsContextPreviewCallback callback, gpointer user_data); void unity_webapps_context_request_preview (UnityWebappsContext *context, gint interest_id, UnityWebappsContextPreviewReadyCallback callback, gpointer user_data); void unity_webapps_context_add_application_actions (UnityWebappsContext *context, UnityWebappsApplicationActionDesc *actions, gint len); void unity_webapps_context_remove_application_action (UnityWebappsContext *context, const gchar *label); void unity_webapps_context_remove_application_actions (UnityWebappsContext *context); UnityWebappsService *unity_webapps_context_get_service (UnityWebappsContext *context); void unity_webapps_context_set_homepage (UnityWebappsContext *context, const gchar *homepage); void unity_webapps_service_set_xid_for_browser_window_id (UnityWebappsService *service, UnityWebappsContext *context, int window_id); UnityWebappsContext * unity_webapps_context_new_lazy (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_prepare (UnityWebappsContext *context, UnityWebappsContextReadyCallback callback, gpointer user_data); gint unity_webapps_context_get_focus_interest (UnityWebappsContext *context); unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/parser-data-10000644000015201777760000001440112312131641030733 0ustar pbusernogroup00000000000000 typedef struct _UnityWebappsContextPrivate UnityWebappsContextPrivate; typedef struct _UnityWebappsContext UnityWebappsContext; struct _UnityWebappsContext { GObject object; UnityWebappsContextPrivate *priv; }; typedef struct _UnityWebappsContextClass UnityWebappsContextClass; struct _UnityWebappsContextClass { GObjectClass parent_class; }; typedef void (*UnityWebappsContextReadyCallback) (UnityWebappsContext *, gpointer user_data); typedef void (*UnityWebappsContextRaiseCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextNotifyCallback) (UnityWebappsContext *, gint, gpointer); typedef void (*UnityWebappsContextViewNotifyCallback) (UnityWebappsContext *, gint, gboolean, gpointer); typedef void (*UnityWebappsContextLocationNotifyCallback) (UnityWebappsContext *, gint, const gchar *, gpointer); typedef void (*UnityWebappsContextWindowNotifyCallback) (UnityWebappsContext *, gint, guint64, gpointer); typedef const gchar * (*UnityWebappsContextPreviewCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextPreviewReadyCallback) (UnityWebappsContext *context, gint interest_id, const gchar *preview_data, gpointer user_data); typedef void (*UnityWebappsContextActionCallback) (UnityWebappsContext *context, gpointer user_data); typedef struct { const gchar *path; UnityWebappsContextActionCallback callback; gpointer user_data; } UnityWebappsApplicationActionDesc; GType unity_webapps_context_get_type (void) G_GNUC_CONST; void unity_webapps_context_new (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url, UnityWebappsContextReadyCallback callback, gpointer user_data); UnityWebappsContext *unity_webapps_context_new_sync (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_destroy (UnityWebappsContext *context, gboolean user_abandoned); const gchar *unity_webapps_context_get_context_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_domain (UnityWebappsContext *context); const gchar *unity_webapps_context_get_desktop_name (UnityWebappsContext *context); gchar *unity_webapps_context_get_icon_name (UnityWebappsContext *context); void unity_webapps_context_add_icon (UnityWebappsContext *context, const gchar *url, gint size); void unity_webapps_context_on_raise_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); void unity_webapps_context_on_close_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); gboolean unity_webapps_context_get_view_is_active (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_is_active (UnityWebappsContext *context, gboolean active); void unity_webapps_context_on_view_is_active_changed (UnityWebappsContext *context, UnityWebappsContextViewNotifyCallback callback, gpointer user_data); UnityWebappsContext * unity_webapps_context_new_for_context_name (UnityWebappsService *service, const gchar *context_name); GVariant *unity_webapps_context_list_interests (UnityWebappsContext *context); void unity_webapps_context_on_interest_appeared (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_on_interest_vanished (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_raise (UnityWebappsContext *context); void unity_webapps_context_raise_interest (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_close (UnityWebappsContext *context); void unity_webapps_context_close_interest (UnityWebappsContext *context, gint interest_id); gchar *unity_webapps_context_get_interest_owner (UnityWebappsContext *context, gint interest_id); gchar * unity_webapps_context_get_view_location (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_location (UnityWebappsContext *context, const gchar *location); void unity_webapps_context_on_view_location_changed (UnityWebappsContext *context, UnityWebappsContextLocationNotifyCallback callback, gpointer user_data); guint64 unity_webapps_context_get_view_window (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_window (UnityWebappsContext *context, guint64 window); void unity_webapps_context_on_view_window_changed (UnityWebappsContext *context, UnityWebappsContextWindowNotifyCallback callback, gpointer user_data); void unity_webapps_context_set_preview_requested_callback (UnityWebappsContext *context, UnityWebappsContextPreviewCallback callback, gpointer user_data); void unity_webapps_context_request_preview (UnityWebappsContext *context, gint interest_id, UnityWebappsContextPreviewReadyCallback callback, gpointer user_data); void unity_webapps_context_add_application_actions (UnityWebappsContext *context, UnityWebappsApplicationActionDesc *actions, gint len); void unity_webapps_context_remove_application_action (UnityWebappsContext *context, const gchar *label); void unity_webapps_context_remove_application_actions (UnityWebappsContext *context); UnityWebappsService *unity_webapps_context_get_service (UnityWebappsContext *context); void unity_webapps_context_set_homepage (UnityWebappsContext *context, const gchar *homepage); void unity_webapps_service_set_xid_for_browser_window_id (UnityWebappsService *service, UnityWebappsContext *context, int window_id); UnityWebappsContext * unity_webapps_context_new_lazy (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_prepare (UnityWebappsContext *context, UnityWebappsContextReadyCallback callback, gpointer user_data); gint unity_webapps_context_get_focus_interest (UnityWebappsContext *context); unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/pre-pass-cleanup-data-20000644000015201777760000002020412312131641032615 0ustar pbusernogroup00000000000000/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * unity-webapps-context.h * Copyright (C) Canonical LTD 2011 * * Author: Robert Carr * unity-webapps is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * unity-webapps is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see ."; */ #ifndef __UNITY_WEBAPPS_CONTEXT_H #define __UNITY_WEBAPPS_CONTEXT_H #include "unity-webapps-service.h" #include "unity-webapps-gen-context.h" #define UNITY_WEBAPPS_TYPE_CONTEXT (unity_webapps_context_get_type()) #define UNITY_WEBAPPS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), UNITY_WEBAPPS_TYPE_CONTEXT, UnityWebappsContext)) #define UNITY_WEBAPPS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), UNITY_WEBAPPS_TYPE_CONTEXT, UnityWebappsContextClass)) #define UNITY_WEBAPPS_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), UNITY_WEBAPPS_TYPE_CONTEXT)) #define UNITY_WEBAPPS_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_WEBAPPS_TYPE_CONTEXT)) #define UNITY_WEBAPPS_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), UNITY_WEBAPPS_TYPE_CONTEXT, UnityWebappsContextClass)) typedef struct _UnityWebappsContextPrivate UnityWebappsContextPrivate; typedef struct _UnityWebappsContext UnityWebappsContext; #include "unity-webapps-notification-context.h" #include "unity-webapps-indicator-context.h" #include "unity-webapps-music-player-context.h" #include "unity-webapps-launcher-context.h" struct _UnityWebappsContext { GObject object; UnityWebappsContextPrivate *priv; }; typedef struct _UnityWebappsContextClass UnityWebappsContextClass; struct _UnityWebappsContextClass { GObjectClass parent_class; }; typedef void (*UnityWebappsContextReadyCallback) (UnityWebappsContext *, gpointer user_data); typedef void (*UnityWebappsContextRaiseCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextNotifyCallback) (UnityWebappsContext *, gint, gpointer); typedef void (*UnityWebappsContextViewNotifyCallback) (UnityWebappsContext *, gint, gboolean, gpointer); typedef void (*UnityWebappsContextLocationNotifyCallback) (UnityWebappsContext *, gint, const gchar *, gpointer); typedef void (*UnityWebappsContextWindowNotifyCallback) (UnityWebappsContext *, gint, guint64, gpointer); typedef const gchar * (*UnityWebappsContextPreviewCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextPreviewReadyCallback) (UnityWebappsContext *context, gint interest_id, const gchar *preview_data, gpointer user_data); typedef void (*UnityWebappsContextActionCallback) (UnityWebappsContext *context, gpointer user_data); typedef struct { const gchar *path; UnityWebappsContextActionCallback callback; gpointer user_data; } UnityWebappsApplicationActionDesc; GType unity_webapps_context_get_type (void) G_GNUC_CONST; void unity_webapps_context_new (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url, UnityWebappsContextReadyCallback callback, gpointer user_data); UnityWebappsContext *unity_webapps_context_new_sync (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_destroy (UnityWebappsContext *context, gboolean user_abandoned); const gchar *unity_webapps_context_get_context_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_domain (UnityWebappsContext *context); const gchar *unity_webapps_context_get_desktop_name (UnityWebappsContext *context); gchar *unity_webapps_context_get_icon_name (UnityWebappsContext *context); void unity_webapps_context_add_icon (UnityWebappsContext *context, const gchar *url, gint size); void unity_webapps_context_on_raise_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); void unity_webapps_context_on_close_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); gboolean unity_webapps_context_get_view_is_active (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_is_active (UnityWebappsContext *context, gboolean active); void unity_webapps_context_on_view_is_active_changed (UnityWebappsContext *context, UnityWebappsContextViewNotifyCallback callback, gpointer user_data); UnityWebappsContext * unity_webapps_context_new_for_context_name (UnityWebappsService *service, const gchar *context_name); GVariant *unity_webapps_context_list_interests (UnityWebappsContext *context); void unity_webapps_context_on_interest_appeared (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_on_interest_vanished (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_raise (UnityWebappsContext *context); void unity_webapps_context_raise_interest (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_close (UnityWebappsContext *context); void unity_webapps_context_close_interest (UnityWebappsContext *context, gint interest_id); gchar *unity_webapps_context_get_interest_owner (UnityWebappsContext *context, gint interest_id); gchar * unity_webapps_context_get_view_location (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_location (UnityWebappsContext *context, const gchar *location); void unity_webapps_context_on_view_location_changed (UnityWebappsContext *context, UnityWebappsContextLocationNotifyCallback callback, gpointer user_data); guint64 unity_webapps_context_get_view_window (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_window (UnityWebappsContext *context, guint64 window); void unity_webapps_context_on_view_window_changed (UnityWebappsContext *context, UnityWebappsContextWindowNotifyCallback callback, gpointer user_data); void unity_webapps_context_set_preview_requested_callback (UnityWebappsContext *context, UnityWebappsContextPreviewCallback callback, gpointer user_data); void unity_webapps_context_request_preview (UnityWebappsContext *context, gint interest_id, UnityWebappsContextPreviewReadyCallback callback, gpointer user_data); void unity_webapps_context_add_application_actions (UnityWebappsContext *context, UnityWebappsApplicationActionDesc *actions, gint len); void unity_webapps_context_remove_application_action (UnityWebappsContext *context, const gchar *label); void unity_webapps_context_remove_application_actions (UnityWebappsContext *context); UnityWebappsService *unity_webapps_context_get_service (UnityWebappsContext *context); void unity_webapps_context_set_homepage (UnityWebappsContext *context, const gchar *homepage); void unity_webapps_service_set_xid_for_browser_window_id (UnityWebappsService *service, UnityWebappsContext *context, int window_id); UnityWebappsContext * unity_webapps_context_new_lazy (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_prepare (UnityWebappsContext *context, UnityWebappsContextReadyCallback callback, gpointer user_data); gint unity_webapps_context_get_focus_interest (UnityWebappsContext *context); #endif unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/parser-data-1.result0000644000015201777760000000356312312131641032257 0ustar pbusernogroup00000000000000unity_webapps_context_get_type unity_webapps_context_new unity_webapps_context_new_sync unity_webapps_context_destroy unity_webapps_context_get_context_name unity_webapps_context_get_name unity_webapps_context_get_domain unity_webapps_context_get_desktop_name unity_webapps_context_get_icon_name unity_webapps_context_add_icon unity_webapps_context_on_raise_callback unity_webapps_context_on_close_callback unity_webapps_context_get_view_is_active unity_webapps_context_set_view_is_active unity_webapps_context_on_view_is_active_changed unity_webapps_context_new_for_context_name unity_webapps_context_list_interests unity_webapps_context_on_interest_appeared unity_webapps_context_on_interest_vanished unity_webapps_context_raise unity_webapps_context_raise_interest unity_webapps_context_close unity_webapps_context_close_interest unity_webapps_context_get_interest_owner unity_webapps_context_get_view_location unity_webapps_context_set_view_location unity_webapps_context_on_view_location_changed unity_webapps_context_get_view_window unity_webapps_context_set_view_window unity_webapps_context_on_view_window_changed unity_webapps_context_set_preview_requested_callback unity_webapps_context_request_preview unity_webapps_context_add_application_actions unity_webapps_context_remove_application_action unity_webapps_context_remove_application_actions unity_webapps_context_get_service unity_webapps_context_set_homepage unity_webapps_service_set_xid_for_browser_window_id unity_webapps_context_new_lazy unity_webapps_context_prepare unity_webapps_context_get_focus_interest UnityWebappsContextReadyCallback UnityWebappsContextRaiseCallback UnityWebappsContextNotifyCallback UnityWebappsContextViewNotifyCallback UnityWebappsContextLocationNotifyCallback UnityWebappsContextWindowNotifyCallback UnityWebappsContextPreviewCallback UnityWebappsContextPreviewReadyCallback UnityWebappsContextActionCallback././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/pre-pass-cleanup-data-1.resultunity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/pre-pass-cleanup-data-1.r0000644000015201777760000000330412312131641033056 0ustar pbusernogroup00000000000000 typedef struct _UnityWebappsContextPrivate UnityWebappsContextPrivate; typedef struct _UnityWebappsContext UnityWebappsContext; struct _UnityWebappsContext { GObject object; UnityWebappsContextPrivate *priv; }; typedef struct _UnityWebappsContextClass UnityWebappsContextClass; struct _UnityWebappsContextClass { GObjectClass parent_class; }; typedef void (*UnityWebappsContextReadyCallback) (UnityWebappsContext *, gpointer user_data); typedef void (*UnityWebappsContextRaiseCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextNotifyCallback) (UnityWebappsContext *, gint, gpointer); typedef void (*UnityWebappsContextViewNotifyCallback) (UnityWebappsContext *, gint, gboolean, gpointer); typedef void (*UnityWebappsContextLocationNotifyCallback) (UnityWebappsContext *, gint, const gchar *, gpointer); typedef void (*UnityWebappsContextWindowNotifyCallback) (UnityWebappsContext *, gint, guint64, gpointer); typedef const gchar * (*UnityWebappsContextPreviewCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextPreviewReadyCallback) (UnityWebappsContext *context, gint interest_id, const gchar *preview_data, gpointer user_data); typedef void (*UnityWebappsContextActionCallback) (UnityWebappsContext *context, gpointer user_data); typedef struct { const gchar *path; UnityWebappsContextActionCallback callback; gpointer user_data; } UnityWebappsApplicationActionDesc; GType unity_webapps_context_get_type (void) G_GNUC_CONST; void unity_webapps_context_new (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url, UnityWebappsContextReadyCallback callback, gpointer user_data); unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/header-gen-data-10000644000015201777760000001440112312131641031436 0ustar pbusernogroup00000000000000 typedef struct _UnityWebappsContextPrivate UnityWebappsContextPrivate; typedef struct _UnityWebappsContext UnityWebappsContext; struct _UnityWebappsContext { GObject object; UnityWebappsContextPrivate *priv; }; typedef struct _UnityWebappsContextClass UnityWebappsContextClass; struct _UnityWebappsContextClass { GObjectClass parent_class; }; typedef void (*UnityWebappsContextReadyCallback) (UnityWebappsContext *, gpointer user_data); typedef void (*UnityWebappsContextRaiseCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextNotifyCallback) (UnityWebappsContext *, gint, gpointer); typedef void (*UnityWebappsContextViewNotifyCallback) (UnityWebappsContext *, gint, gboolean, gpointer); typedef void (*UnityWebappsContextLocationNotifyCallback) (UnityWebappsContext *, gint, const gchar *, gpointer); typedef void (*UnityWebappsContextWindowNotifyCallback) (UnityWebappsContext *, gint, guint64, gpointer); typedef const gchar * (*UnityWebappsContextPreviewCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextPreviewReadyCallback) (UnityWebappsContext *context, gint interest_id, const gchar *preview_data, gpointer user_data); typedef void (*UnityWebappsContextActionCallback) (UnityWebappsContext *context, gpointer user_data); typedef struct { const gchar *path; UnityWebappsContextActionCallback callback; gpointer user_data; } UnityWebappsApplicationActionDesc; GType unity_webapps_context_get_type (void) G_GNUC_CONST; void unity_webapps_context_new (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url, UnityWebappsContextReadyCallback callback, gpointer user_data); UnityWebappsContext *unity_webapps_context_new_sync (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_destroy (UnityWebappsContext *context, gboolean user_abandoned); const gchar *unity_webapps_context_get_context_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_domain (UnityWebappsContext *context); const gchar *unity_webapps_context_get_desktop_name (UnityWebappsContext *context); gchar *unity_webapps_context_get_icon_name (UnityWebappsContext *context); void unity_webapps_context_add_icon (UnityWebappsContext *context, const gchar *url, gint size); void unity_webapps_context_on_raise_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); void unity_webapps_context_on_close_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); gboolean unity_webapps_context_get_view_is_active (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_is_active (UnityWebappsContext *context, gboolean active); void unity_webapps_context_on_view_is_active_changed (UnityWebappsContext *context, UnityWebappsContextViewNotifyCallback callback, gpointer user_data); UnityWebappsContext * unity_webapps_context_new_for_context_name (UnityWebappsService *service, const gchar *context_name); GVariant *unity_webapps_context_list_interests (UnityWebappsContext *context); void unity_webapps_context_on_interest_appeared (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_on_interest_vanished (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_raise (UnityWebappsContext *context); void unity_webapps_context_raise_interest (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_close (UnityWebappsContext *context); void unity_webapps_context_close_interest (UnityWebappsContext *context, gint interest_id); gchar *unity_webapps_context_get_interest_owner (UnityWebappsContext *context, gint interest_id); gchar * unity_webapps_context_get_view_location (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_location (UnityWebappsContext *context, const gchar *location); void unity_webapps_context_on_view_location_changed (UnityWebappsContext *context, UnityWebappsContextLocationNotifyCallback callback, gpointer user_data); guint64 unity_webapps_context_get_view_window (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_window (UnityWebappsContext *context, guint64 window); void unity_webapps_context_on_view_window_changed (UnityWebappsContext *context, UnityWebappsContextWindowNotifyCallback callback, gpointer user_data); void unity_webapps_context_set_preview_requested_callback (UnityWebappsContext *context, UnityWebappsContextPreviewCallback callback, gpointer user_data); void unity_webapps_context_request_preview (UnityWebappsContext *context, gint interest_id, UnityWebappsContextPreviewReadyCallback callback, gpointer user_data); void unity_webapps_context_add_application_actions (UnityWebappsContext *context, UnityWebappsApplicationActionDesc *actions, gint len); void unity_webapps_context_remove_application_action (UnityWebappsContext *context, const gchar *label); void unity_webapps_context_remove_application_actions (UnityWebappsContext *context); UnityWebappsService *unity_webapps_context_get_service (UnityWebappsContext *context); void unity_webapps_context_set_homepage (UnityWebappsContext *context, const gchar *homepage); void unity_webapps_service_set_xid_for_browser_window_id (UnityWebappsService *service, UnityWebappsContext *context, int window_id); UnityWebappsContext * unity_webapps_context_new_lazy (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_prepare (UnityWebappsContext *context, UnityWebappsContextReadyCallback callback, gpointer user_data); gint unity_webapps_context_get_focus_interest (UnityWebappsContext *context); unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/pre-pass-cleanup-data-10000644000015201777760000000514312312131641032621 0ustar pbusernogroup00000000000000/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * unity-webapps-context.h * Copyright (C) Canonical LTD 2011 * * Author: Robert Carr * unity-webapps is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * unity-webapps is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see ."; */ typedef struct _UnityWebappsContextPrivate UnityWebappsContextPrivate; // blabla typedef struct _UnityWebappsContext UnityWebappsContext; struct _UnityWebappsContext { GObject object; UnityWebappsContextPrivate *priv; }; typedef struct _UnityWebappsContextClass UnityWebappsContextClass; struct _UnityWebappsContextClass { GObjectClass parent_class; }; typedef void (*UnityWebappsContextReadyCallback) (UnityWebappsContext *, gpointer user_data); typedef void (*UnityWebappsContextRaiseCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextNotifyCallback) (UnityWebappsContext *, gint, gpointer); typedef void (*UnityWebappsContextViewNotifyCallback) (UnityWebappsContext *, gint, gboolean, gpointer); typedef void (*UnityWebappsContextLocationNotifyCallback) (UnityWebappsContext *, gint, const gchar *, gpointer); typedef void (*UnityWebappsContextWindowNotifyCallback) (UnityWebappsContext *, gint, guint64, gpointer); typedef const gchar * (*UnityWebappsContextPreviewCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextPreviewReadyCallback) (UnityWebappsContext *context, gint interest_id, const gchar *preview_data, gpointer user_data); typedef void (*UnityWebappsContextActionCallback) (UnityWebappsContext *context, gpointer user_data); typedef struct { const gchar *path; UnityWebappsContextActionCallback callback; gpointer user_data; } UnityWebappsApplicationActionDesc; // blabla // blabla GType unity_webapps_context_get_type (void) G_GNUC_CONST; // blabla /* blabla */ void unity_webapps_context_new (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url, UnityWebappsContextReadyCallback callback, gpointer user_data); /* blabla */ unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/tests/data/source-gen-data-10000644000015201777760000001440112312131641031506 0ustar pbusernogroup00000000000000 typedef struct _UnityWebappsContextPrivate UnityWebappsContextPrivate; typedef struct _UnityWebappsContext UnityWebappsContext; struct _UnityWebappsContext { GObject object; UnityWebappsContextPrivate *priv; }; typedef struct _UnityWebappsContextClass UnityWebappsContextClass; struct _UnityWebappsContextClass { GObjectClass parent_class; }; typedef void (*UnityWebappsContextReadyCallback) (UnityWebappsContext *, gpointer user_data); typedef void (*UnityWebappsContextRaiseCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextNotifyCallback) (UnityWebappsContext *, gint, gpointer); typedef void (*UnityWebappsContextViewNotifyCallback) (UnityWebappsContext *, gint, gboolean, gpointer); typedef void (*UnityWebappsContextLocationNotifyCallback) (UnityWebappsContext *, gint, const gchar *, gpointer); typedef void (*UnityWebappsContextWindowNotifyCallback) (UnityWebappsContext *, gint, guint64, gpointer); typedef const gchar * (*UnityWebappsContextPreviewCallback) (UnityWebappsContext *context, gpointer user_data); typedef void (*UnityWebappsContextPreviewReadyCallback) (UnityWebappsContext *context, gint interest_id, const gchar *preview_data, gpointer user_data); typedef void (*UnityWebappsContextActionCallback) (UnityWebappsContext *context, gpointer user_data); typedef struct { const gchar *path; UnityWebappsContextActionCallback callback; gpointer user_data; } UnityWebappsApplicationActionDesc; GType unity_webapps_context_get_type (void) G_GNUC_CONST; void unity_webapps_context_new (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url, UnityWebappsContextReadyCallback callback, gpointer user_data); UnityWebappsContext *unity_webapps_context_new_sync (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_destroy (UnityWebappsContext *context, gboolean user_abandoned); const gchar *unity_webapps_context_get_context_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_name (UnityWebappsContext *context); const gchar *unity_webapps_context_get_domain (UnityWebappsContext *context); const gchar *unity_webapps_context_get_desktop_name (UnityWebappsContext *context); gchar *unity_webapps_context_get_icon_name (UnityWebappsContext *context); void unity_webapps_context_add_icon (UnityWebappsContext *context, const gchar *url, gint size); void unity_webapps_context_on_raise_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); void unity_webapps_context_on_close_callback (UnityWebappsContext *context, UnityWebappsContextRaiseCallback callback, gpointer user_data); gboolean unity_webapps_context_get_view_is_active (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_is_active (UnityWebappsContext *context, gboolean active); void unity_webapps_context_on_view_is_active_changed (UnityWebappsContext *context, UnityWebappsContextViewNotifyCallback callback, gpointer user_data); UnityWebappsContext * unity_webapps_context_new_for_context_name (UnityWebappsService *service, const gchar *context_name); GVariant *unity_webapps_context_list_interests (UnityWebappsContext *context); void unity_webapps_context_on_interest_appeared (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_on_interest_vanished (UnityWebappsContext *context, UnityWebappsContextNotifyCallback callback, gpointer user_data); void unity_webapps_context_raise (UnityWebappsContext *context); void unity_webapps_context_raise_interest (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_close (UnityWebappsContext *context); void unity_webapps_context_close_interest (UnityWebappsContext *context, gint interest_id); gchar *unity_webapps_context_get_interest_owner (UnityWebappsContext *context, gint interest_id); gchar * unity_webapps_context_get_view_location (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_location (UnityWebappsContext *context, const gchar *location); void unity_webapps_context_on_view_location_changed (UnityWebappsContext *context, UnityWebappsContextLocationNotifyCallback callback, gpointer user_data); guint64 unity_webapps_context_get_view_window (UnityWebappsContext *context, gint interest_id); void unity_webapps_context_set_view_window (UnityWebappsContext *context, guint64 window); void unity_webapps_context_on_view_window_changed (UnityWebappsContext *context, UnityWebappsContextWindowNotifyCallback callback, gpointer user_data); void unity_webapps_context_set_preview_requested_callback (UnityWebappsContext *context, UnityWebappsContextPreviewCallback callback, gpointer user_data); void unity_webapps_context_request_preview (UnityWebappsContext *context, gint interest_id, UnityWebappsContextPreviewReadyCallback callback, gpointer user_data); void unity_webapps_context_add_application_actions (UnityWebappsContext *context, UnityWebappsApplicationActionDesc *actions, gint len); void unity_webapps_context_remove_application_action (UnityWebappsContext *context, const gchar *label); void unity_webapps_context_remove_application_actions (UnityWebappsContext *context); UnityWebappsService *unity_webapps_context_get_service (UnityWebappsContext *context); void unity_webapps_context_set_homepage (UnityWebappsContext *context, const gchar *homepage); void unity_webapps_service_set_xid_for_browser_window_id (UnityWebappsService *service, UnityWebappsContext *context, int window_id); UnityWebappsContext * unity_webapps_context_new_lazy (UnityWebappsService *service, const gchar *name, const gchar *domain, const gchar *icon_url); void unity_webapps_context_prepare (UnityWebappsContext *context, UnityWebappsContextReadyCallback callback, gpointer user_data); gint unity_webapps_context_get_focus_interest (UnityWebappsContext *context); unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/sources_gen_test.py0000644000015201777760000000140412312131641030320 0ustar pbusernogroup00000000000000import parser import os _TEST_DATA_FILES = [ "./tests/data/source-gen-data-1" ] def _get_callback_typedefs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_typedef' and parsed_datum['name'][1].endswith('Callback')] def _get_function_defs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_decl'] import source_generator for testdata in _TEST_DATA_FILES: parsed_data = parser.parse (open(testdata).read()) callback_decls = _get_callback_typedefs (parsed_data) func_decls = _get_function_defs (parsed_data) result = source_generator.generate_sources_for (func_decls, callback_decls) open(testdata + ".result", "w+").write (result) unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/get_functions_to_generate.sh0000755000015201777760000000026212312131641032156 0ustar pbusernogroup00000000000000#!/bin/bash set -e find ../chromium-extension -name *.js | xargs grep -Po "(uwa\.[\w_]*)" | awk -F":" '{ print $2 }' | awk -F"." '{print $2}' | tee functions_to_generate | cat unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/bindinggen.py0000644000015201777760000001575712312131641027071 0ustar pbusernogroup00000000000000import sys import os try: import headers import parser except Exception, e: print e sys.exit(1) def _get_candidates_for_header_file_gen (files): """ Takes a list of files (header files) and returns a list of files that should be considered for "webapps binding" generation """ candidates = [file for file in files if file.endswith('-context.h') and -1 == file.find('-gen-') or file.endswith('webapps-service.h') or file.endswith('script-repo.h')] return candidates def _get_source_file_body_template (): return """ /* * unity-webapps-binding.c * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/npfunctions.h" #include "npapi-headers/headers/npruntime.h" #include "wrapped-ptr-type.h" #include "wrapped-callback-type.h" #include "unity-webapps-binding-test.h" #include "unity-npapi-binding-utils.h" #include "unity-webapps-scriptable-object.h" #include "unity-webapps-repo-userscript-wrapper.h" #include "unity-npapi-plugin.h" #define REACHED_UNITY_WEBAPPS_FUNC_CALL() \ if (unity_webapps_binding_test_is_test_mode_on()) \ { \ g_message("reached func call"); \ unity_webapps_binding_test_reached_func_call (); \ return result; \ } \ do {} while (false) #define ADD_NPOBJECT_RETAIN_FOR_CONTEXT(npp,context,object) \ if (! unity_webapps_binding_test_is_test_mode_on()) \ { \ unity_npapi_plugin_t * pPlugin = (unity_npapi_plugin_t *) npp->pdata; \ if (NULL != pPlugin) \ { \ unity_npapi_add_retained_objects_for_context (pPlugin,context,object); \ } \ } """ def _get_header_body_template (): return """ /* * Copyright (C) Canonical LTD 2012 * * Author: Alexandre Abreu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #if ! defined (UNITY_WEBAPPS_BINDING_H) #define UNITY_WEBAPPS_BINDING_H #include "npapi-headers/headers/npapi.h" #include "npapi-headers/headers/nptypes.h" %s #endif // UNITY_WEBAPPS_BINDING_H """ def _get_unittest_func_header_template(): return """ #ifndef %s_TEST_H #define %s_TEST_H int %s_test(void); #endif """ def _get_function_defs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_decl'] def _get_callback_typedefs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_typedef' and parsed_datum['name'][1].endswith('Callback')] if __name__ == "__main__": import sys import argparse parser = argparse.ArgumentParser(description='Generate NPAPI binding from header files.') parser.add_argument ('--outf', default='unity-webapps-npapi-binding') parser.add_argument ('--inf') args = parser.parse_args() outfilename = args.outf infilename = args.inf header_content = "// this file has been generated\n\n" source_content = "// this file has been generated\n\n" + _get_source_file_body_template() binding_headers = [] if infilename is not None: import os if not os.path.exists(infilename): print "Invalid filename (does not exist):", infilename sys.exit(1) infilename = os.path.normpath (infilename) binding_headers = [infilename] else: header_file_path = headers.getLibHeaderFilesPath() if not os.path.exists(header_file_path): print "libunity-webapps not installed or found" sys.exit(1) binding_headers = _get_candidates_for_header_file_gen (headers.getHeaderFilesFrom (header_file_path)) if len(binding_headers) == 0: print "nothing to do, no header found" sys.exit(1) # 'fix' the paths binding_headers = [os.path.join (header_file_path, binding_header) for binding_header in binding_headers] import common_gen import subprocess functions_to_generate = [common_gen.get_unity_webapps_function_prefix() + function_to_generate for function_to_generate in subprocess.check_output('./get_functions_to_generate.sh', shell=True).split()] import header_generator import source_generator import unittest_gen import prepasses import parser for binding_header in binding_headers: print "--- processing", binding_header parsed_data = parser.parse (prepasses.run_prepasses(open(binding_header).read())) callback_decls = _get_callback_typedefs (parsed_data) func_decls = _get_function_defs (parsed_data) # filter func defs func_decls = [func_decl for func_decl in func_decls if func_decl['name'][1] in functions_to_generate] # generate header_content += header_generator.generate_headers_for(func_decls) source_content += source_generator.generate_sources_for(func_decls, callback_decls) for func_decl in func_decls: unittest_content = unittest_gen.generate_unittest_for(func_decl) func_name = func_decl['name'][1] func_name_filename = func_name.replace('_', '-') open(func_name_filename + "-test.c", "w+").write(unittest_content) open(func_name_filename + "-test.h", "w+").write(_get_unittest_func_header_template() % (func_name.upper(), func_name.upper(), func_name)) open(outfilename + '.h', 'w+').write (_get_header_body_template() % header_content) open(outfilename + '.c', 'w+').write (source_content) unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/headers.py0000644000015201777760000000101112312131641026352 0ustar pbusernogroup00000000000000_LIBUNITY_WEBAPPS_NAME = 'libunity_webapps-0.2' def getLibHeaderFilesPath (): """ """ path = '' try: import subprocess path = subprocess.check_output (['pkg-config', '--cflags-only-I', _LIBUNITY_WEBAPPS_NAME]).strip() except: pass if len(path) != 0 and path.startswith ('-I'): path = path.strip().strip('-I') return path def getHeaderFilesFrom (path): """ """ import os return [file for file in os.listdir (path) if file.endswith ('.h')] unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/header_generator.py0000644000015201777760000000121512312131641030243 0ustar pbusernogroup00000000000000""" """ import common_gen def generate_headers_for(func_descriptions): func_decls = [] for func_description in [func_description for func_description in func_descriptions if func_description['type'] == 'func_decl']: func_decls.append(_generate_header_for(func_description)) return '\n'.join (func_decls) def _generate_header_for(func_description): return """ NPVariant %s%s (NPP instance , NPObject * npobject , const NPVariant *args , uint32_t argCount); """ % (common_gen.get_binding_function_prefix (), func_description['name'][1].replace(common_gen.get_unity_webapps_function_prefix(), '')) unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/common_gen.py0000644000015201777760000000023112312131641027063 0ustar pbusernogroup00000000000000""" """ def get_binding_function_prefix (): return "unity_webapps_binding_" def get_unity_webapps_function_prefix (): return "unity_webapps_" unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/header_generator_test.py0000644000015201777760000000110212312131641031275 0ustar pbusernogroup00000000000000import parser import os _TEST_DATA_FILES = [ "./tests/data/header-gen-data-1" ] def get_callback_typedefs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_typedef' and parsed_datum['name'][1].endswith('Callback')] def get_function_defs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_decl'] import header_generator for testdata in _TEST_DATA_FILES: result = header_generator.generate_headers_for (parser.parse (open(testdata).read())) print result unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/unittest_gen.py0000644000015201777760000000651712312131641027467 0ustar pbusernogroup00000000000000import os import common_gen def generate_unittest_for(func_decl): func_name = func_decl['name'][1] func_binding_name = func_name.replace(common_gen.get_unity_webapps_function_prefix(), common_gen.get_binding_function_prefix()) func_argcnt_chunks = _generate_argument_count_test_chunks_for(func_decl, func_binding_name) func_call_reached_chunk = _generate_function_reached_call(func_decl, func_binding_name) return _get_unittest_template() % (func_name, func_argcnt_chunks, func_call_reached_chunk, func_name) def _generate_argument_count_test_chunks_for(func_decl, func_binding_name): arg_count = len(func_decl['parameters']) arg_count_set = set(range(arg_count + 2)) arg_count_set.remove(arg_count) arg_count_chunks = [] for test_arg_count in arg_count_set: arg_nullation = '\n'.join([_generate_nullation_for(idx) for idx in range(test_arg_count)]) arg_count_chunks.append (_get_argument_count_check_template () % (test_arg_count, arg_nullation, func_binding_name)) return '\n'.join (arg_count_chunks) def _generate_nullation_for(idx): return "NULL_TO_NPVARIANT(args[%d]);" % idx def _get_argument_count_check_template(): return """ { NPTestObject tobject = {0}; NPVariant args[%d]; %s NPVariant result = %s (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (!tobject.exceptioncalled || func_reached) { return 1; } func_reached = 0; } """ def _generate_argument_creation_for(func_decl): import npapi_meta params = func_decl['parameters'] content = [] for idx, param in enumerate(params): info = npapi_meta.get_meta_info_for_type(param['type']) # big hack to highjack some types if info['to_variant'] == 'OBJECT_TO_NPVARIANT': info['null'] = '(NPObject*) &tobject' content.append ("%s(%s,%s);" % (info['to_variant'], info['null'], "args[%d]" % idx)) return '\n'.join (content) def _generate_function_reached_call(func_decl, func_binding_name): import common_gen arg_count = len(func_decl['parameters']) return """ { wrapped_void_ptr_t tobject = {0}; NPVariant args[%d]; %s NPVariant result = %s (NULL , (NPObject *) &tobject , &args[0] , sizeof(args)/sizeof(args[0])); if (! func_reached) { return 1; } func_reached = 0; } """ % (arg_count, _generate_argument_creation_for(func_decl), func_binding_name) def _get_unittest_template(): return """ #include #include "unity-webapps-binding.h" #include "unity-webapps-binding-test.h" #include "test_common.h" #include "wrapped-ptr-type.h" static bool func_reached = false; static void on_func_reached(void) { func_reached = true; } int %s_test(void) { unity_webapps_binding_test_set_test_mode_on (on_func_reached); // handle argument count %s // check arg types // check that function is reached w/ proper args %s return 0; } int main (int argc, char **argv) { if (%s_test()) { return 1; } return 0; } """ unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/npapi_meta.py0000644000015201777760000000734212312131641027071 0ustar pbusernogroup00000000000000""" Meta information for npapi <-> "native" types """ def get_meta_info_for_type (t): baseTypes = {"gchar*": {"validator": "NPVARIANT_IS_STRING" , "can_free": True , 'create_var': True , 'creator': 'create_safe_string_for (&args[%d])' , 'null': '""' , 'nullable': True , 'to_variant': 'STRINGZ_TO_NPVARIANT'} , "gint": {"validator": "NPVARIANT_IS_INT32" , "can_free": False , 'create_var': True , 'creator': 'NPVARIANT_TO_INT32 (args[%d])' , 'null': '0' , 'nullable': False , 'to_variant': 'INT32_TO_NPVARIANT'} , "guint64": {"validator": "NPVARIANT_IS_DOUBLE" , "can_free": False , 'create_var': True , 'creator': 'NPVARIANT_TO_DOUBLE (args[%d])' , 'null': '0' , 'nullable': False , 'to_variant': 'INT32_TO_NPVARIANT'} , "guint": {"validator": "NPVARIANT_IS_INT32" , "can_free": False , 'create_var': True , 'creator': 'NPVARIANT_TO_INT32 (args[%d])' , 'null': '0' , 'nullable': False , 'to_variant': 'INT32_TO_NPVARIANT'} , "gboolean": {"validator": "NPVARIANT_IS_BOOLEAN" , "can_free": False , 'create_var': True , 'creator': 'NPVARIANT_TO_BOOLEAN (args[%d])' , 'null': 'false' , 'nullable': False , 'to_variant': 'BOOLEAN_TO_NPVARIANT'} , "gsize": {"validator": "NPVARIANT_IS_INT32" , "can_free": False , 'create_var': True , 'creator': 'NPVARIANT_TO_INT32 (args[%d])' , 'null': '0' , 'nullable': False , 'to_variant': 'INT32_TO_NPVARIANT'} , "gdouble": {"validator": "NPVARIANT_IS_DOUBLE" , "can_free": False , 'create_var': True , 'creator': 'NPVARIANT_TO_BOOLEAN (args[%d])' , 'null': '0.0' , 'nullable': False , 'to_variant': 'DOUBLE_TO_NPVARIANT'} , "void": {"validator": "NPVARIANT_IS_VOID" , "can_free": False , 'create_var': False , 'creator': None , 'null': None , 'nullable': False , 'to_variant': 'VOID_TO_NPVARIANT'} , "gpointer": {"validator": "NPVARIANT_IS_OBJECT" , "can_free": False , 'create_var': True , 'creator': None , 'null': 'NULL' , 'nullable': True , 'to_variant': 'OBJECT_TO_NPVARIANT'} } # defaults to object other = {'validator': 'NPVARIANT_IS_OBJECT' , 'can_free': False , 'create_var': True , 'creator': '(void*) ((wrapped_void_ptr_t *) args[%d].value.objectValue)->pWrapped' , 'null': 'NULL' , 'nullable': True , 'to_variant': 'OBJECT_TO_NPVARIANT'} t = _strip_type_qualifiers(t).strip() info = baseTypes.has_key (t) and baseTypes[t] or other return info def _strip_type_qualifiers (t): qualifiers = "const" return t.strip ().replace (qualifiers, "").replace (" ", "") unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/parser_test.py0000644000015201777760000000162112312131641027301 0ustar pbusernogroup00000000000000import parser import os _TEST_DATA_FILES = [ "./tests/data/parser-data-1" ] def get_callback_typedefs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_typedef' and parsed_datum['name'][1].endswith('Callback')] def get_function_defs (parsed_data): return [parsed_datum for parsed_datum in parsed_data if parsed_datum['type'] == 'func_decl'] for testdata in _TEST_DATA_FILES: result = parser.parse (open(testdata).read()) test_result = [] func_defs = get_function_defs(result) for func_def in func_defs: test_result.append(func_def['name'][1]) cb_defs = get_callback_typedefs(result) for cb_def in cb_defs: test_result.append(cb_def['name'][1]) if not "\n".join(test_result).strip() == open(testdata + ".result").read().strip(): print "failed test:", testdata,", got: ", "\n".join(test_result) unity-chromium-extension-3.0.0+14.04.20140318/npapi-binding-gen/prepasses_test.py0000644000015201777760000000053512312131641030015 0ustar pbusernogroup00000000000000import prepasses import os _TEST_DATA_FILES = [ "./tests/data/pre-pass-cleanup-data-1" , "./tests/data/pre-pass-cleanup-data-2" ] for testdata in _TEST_DATA_FILES: result = prepasses.run_prepasses (open(testdata).read()) if not result == open(testdata + ".result").read(): print "failed test:", testdata,", got: ", result unity-chromium-extension-3.0.0+14.04.20140318/README0000644000015201777760000000000112312131641021755 0ustar pbusernogroup00000000000000+unity-chromium-extension-3.0.0+14.04.20140318/m4/0000755000015201777760000000000012312132125021424 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/m4/gcov.m40000644000015201777760000000455012312131641022632 0ustar pbusernogroup00000000000000# Checks for existence of coverage tools: # * gcov # * lcov # * genhtml # * gcovr # # Sets ac_cv_check_gcov to yes if tooling is present # and reports the executables to the variables LCOV, GCOVR and GENHTML. AC_DEFUN([AC_TDD_GCOV], [ AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [enable coverage testing with gcov]), [use_gcov=yes], [use_gcov=no]) AM_CONDITIONAL(HAVE_GCOV, test "x$use_gcov" = "xyes") if test "x$use_gcov" = "xyes"; then # we need gcc: if test "$GCC" != "yes"; then AC_MSG_ERROR([GCC is required for --enable-gcov]) fi # Check if ccache is being used AC_CHECK_PROG(SHTOOL, shtool, shtool) if test "$SHTOOL"; then AS_CASE([`$SHTOOL path $CC`], [*ccache*], [gcc_ccache=yes], [gcc_ccache=no]) fi if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) fi lcov_version_list="1.6 1.7 1.8 1.9 1.10" AC_CHECK_PROG(LCOV, lcov, lcov) AC_CHECK_PROG(GENHTML, genhtml, genhtml) if test "$LCOV"; then AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ glib_cv_lcov_version=invalid lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` for lcov_check_version in $lcov_version_list; do if test "$lcov_version" = "$lcov_check_version"; then glib_cv_lcov_version="$lcov_check_version (ok)" fi done ]) else lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" AC_MSG_ERROR([$lcov_msg]) fi case $glib_cv_lcov_version in ""|invalid[)] lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." AC_MSG_ERROR([$lcov_msg]) LCOV="exit 0;" ;; esac if test -z "$GENHTML"; then AC_MSG_ERROR([Could not find genhtml from the lcov package]) fi # Remove all optimization flags from CFLAGS changequote({,}) CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` changequote([,]) # Add the special gcc flags UNITY_NPAPI_PLUGIN_COVERAGE_CFLAGS="--coverage" UNITY_NPAPI_PLUGIN_COVERAGE_CXXFLAGS="--coverage" UNITY_NPAPI_PLUGIN_COVERAGE_LDFLAGS="-lgcov" fi ]) # AC_TDD_GCOV unity-chromium-extension-3.0.0+14.04.20140318/autogen.sh0000755000015201777760000001051412312131641023110 0ustar pbusernogroup00000000000000#!/bin/sh # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. DIE=0 if [ -n "$GNOME2_DIR" ]; then ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS" LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH" PATH="$GNOME2_DIR/bin:$PATH" export PATH export LD_LIBRARY_PATH fi (test -f $srcdir/configure.ac) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level package directory" exit 1 } (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`autoconf' installed." echo "Download the appropriate package for your distribution," echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 } (grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && { (intltoolize --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`intltool' installed." echo "You can get it from:" echo " ftp://ftp.gnome.org/pub/GNOME/" DIE=1 } } (grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && { (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`xml-i18n-toolize' installed." echo "You can get it from:" echo " ftp://ftp.gnome.org/pub/GNOME/" DIE=1 } } (grep "^LT_INIT" $srcdir/configure.ac >/dev/null) && { (libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`libtool' installed." echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" DIE=1 } } (grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && { (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \ (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`glib' installed." echo "You can get it from: ftp://ftp.gtk.org/pub/gtk" DIE=1 } } (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`automake' installed." echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" DIE=1 NO_AUTOMAKE=yes } # if no automake, don't bother testing for aclocal test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: Missing \`aclocal'. The version of \`automake'" echo "installed doesn't appear recent enough." echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/" DIE=1 } if test "$DIE" -eq 1; then exit 1 fi if test -z "$*"; then echo "**Warning**: I am going to run \`configure' with no arguments." echo "If you wish to pass any to it, please specify them on the" echo \`$0\'" command line." echo fi case $CC in xlc ) am_opt=--include-deps;; esac for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print` do dr=`dirname $coin` if test -f $dr/NO-AUTO-GEN; then echo skipping $dr -- flagged as no auto-gen else echo processing $dr ( cd $dr aclocalinclude="$ACLOCAL_FLAGS" if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then echo "Creating $dr/aclocal.m4 ..." test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 echo "Running glib-gettextize... Ignore non-fatal messages." echo "no" | glib-gettextize --force --copy echo "Making $dr/aclocal.m4 writable ..." test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 fi if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then echo "Running intltoolize..." intltoolize --copy --force --automake fi if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then echo "Running xml-i18n-toolize..." xml-i18n-toolize --copy --force --automake fi if grep "^LT_INIT" configure.ac >/dev/null; then if test -z "$NO_LIBTOOLIZE" ; then echo "Running libtoolize..." libtoolize --force --copy fi fi echo "Running aclocal $aclocalinclude ..." aclocal $aclocalinclude if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then echo "Running autoheader..." autoheader fi echo "Running automake --gnu $am_opt ..." automake --add-missing --gnu $am_opt echo "Running autoconf ..." autoconf ) fi done if test x$NOCONFIGURE = x; then echo Running $srcdir/configure "$@" ... $srcdir/configure "$@" \ && echo Now type \`make\' to compile. || exit 1 else echo Skipping configure process. fi unity-chromium-extension-3.0.0+14.04.20140318/Makefile.am.coverage0000644000015201777760000000203212312131641024731 0ustar pbusernogroup00000000000000 # Coverage targets if HAVE_GCOV .PHONY: clean-gcda clean-gcda: @echo Removing old coverage results -find -name '*.gcda' -print | xargs -r rm .PHONY: coverage-html generate-coverage-html clean-coverage-html coverage-html: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html coverage-xml: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check gcovr --xml -r $(top_builddir) -o "$(top_builddir)/coverage.xml" --exclude='.*tests.*' generate-coverage-html: @echo Collecting coverage data $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool $(LCOV) --extract coverage.info "`pwd`/npapi-plugin/src/*" --output-file coverage-src.info LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coverage-html --title "Code Coverage" --legend --show-details coverage-src.info clean-coverage-html: clean-gcda -$(LCOV) --directory $(top_builddir) -z -rm -rf coverage.info coverage-src.info coverage-html clean-local: clean-coverage-html endif # HAVE_GCOV unity-chromium-extension-3.0.0+14.04.20140318/AUTHORS0000644000015201777760000000000012312131641022144 0ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/Makefile.am0000644000015201777760000000030612312131641023141 0ustar pbusernogroup00000000000000SUBDIRS = npapi-plugin chromium-extension tests po CLEANFILES = unity-webapps.pem DISTCHECK_CONFIGURE_FLAGS=--enable-tests=yes EXTRA_DIST = autogen.sh include $(top_srcdir)/Makefile.am.coverage unity-chromium-extension-3.0.0+14.04.20140318/INSTALL0000644000015201777760000003660012312131641022144 0ustar pbusernogroup00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. unity-chromium-extension-3.0.0+14.04.20140318/po/0000755000015201777760000000000012312132125021522 5ustar pbusernogroup00000000000000unity-chromium-extension-3.0.0+14.04.20140318/po/export_translations_to_chromium.py0000755000015201777760000000747412312131641030644 0ustar pbusernogroup00000000000000#!/usr/bin/python ## Export the current translations to chromium's extension ## Expects to be called w/ .po folder and chromium locale folder, e.g.: import sys import argparse def exit_with_error(msg): sys.stderr.write("*** Error: " + msg + "\n") sys.exit(1) parser = argparse.ArgumentParser() parser.add_argument("po-folder", help="location of the .po files") parser.add_argument("chrome-locals-folder", help="location of the chromium locale folder") args = vars (parser.parse_args(sys.argv[1:])) po_folder = args['po-folder'] chrome_locale_folder = args['chrome-locals-folder'] # validation import os if not os.path.exists(po_folder) or not os.path.exists(chrome_locale_folder): exit_with_error("Invalid paths") import os thispath = os.path.dirname(os.path.realpath(__file__)) def complete_path(p): if not os.path.isabs(p): p = os.path.join (thispath, p) return p po_folder = complete_path(po_folder) chrome_locale_folder = complete_path(chrome_locale_folder) messages_json_reference_filename = os.path.join(chrome_locale_folder, "en/messages.json") if not os.path.exists(messages_json_reference_filename): exit_with_error("Invalid chromium locale folder structure: no messages.json found for 'en' reference") def collect_po_files(po_folder): po_folder = complete_path(po_folder) return [entry for entry in os.listdir(po_folder) if os.path.isfile(os.path.join(po_folder, entry)) and entry.endswith('.po')] def save_message_json_file(): pass def parse_chromium_reference_locale(chromium_locale_folder): import json messages = {} try: content = json.loads(open(messages_json_reference_filename).read()) for k, v in content.iteritems(): if v.__class__ is type({}) and v.has_key('message'): # assume that messages are identical if messages.has_key(v['message']): print "Something is wrong, duplicated message strings found '", v['message'], "'" else: messages[v['message']] = (k, v) except Exception, e: exit_with_error("Cannot read & import messages.json file, " + str(e)) return messages def parse_po_files(po_folder): import polib po_files = collect_po_files(po_folder) if len(po_files) == 0: return {} r = [] for po_file in po_files: cur = {} filepath = os.path.join(po_folder, po_file) lang = os.path.splitext(os.path.basename(po_file))[0] cur['lang'] = lang po = polib.pofile(filepath) for entry in po: if entry.obsolete or entry.msgstr == '': continue cur.setdefault('translations', {})[entry.msgid] = entry.msgstr r.append(cur) return r def generate_chromium_json_files(po_folder, chromium_locale_folder): po_data = parse_po_files(po_folder) if len(po_data) == 0: print "No .po files found, or data not parsable" return en_reference_data = parse_chromium_reference_locale(chromium_locale_folder) import copy for po_datum in po_data: lang = po_datum['lang'] chromium_cur_lang_folder = os.path.join(chromium_locale_folder, lang) if not os.path.exists(chromium_cur_lang_folder): os.mkdir(chromium_cur_lang_folder) message_filename = os.path.join(chromium_cur_lang_folder, "messages.json") lang_translations = po_datum['translations'] messages = {} for k, v in en_reference_data.iteritems(): message = copy.deepcopy(v[1]) message['message'] = lang_translations[k] messages[v[0]] = message import json import codecs out = codecs.open(message_filename, "w+", "utf-8") out.write(json.dumps(messages)) if __name__ == "__main__": generate_chromium_json_files(po_folder, chrome_locale_folder) unity-chromium-extension-3.0.0+14.04.20140318/po/unity_chromium_extension.pot0000644000015201777760000000102212312131641027412 0ustar pbusernogroup00000000000000# msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: you@example.com\n" "POT-Creation-Date: 2007-10-18 14:00+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: \n" #: messages.json:0 msgid "" "Would you like to install $NAME$ (from $DOMAIN$), for extra features and " "quicker access?" msgstr "" unity-chromium-extension-3.0.0+14.04.20140318/po/generate_reference_pot_file.py0000755000015201777760000000446212312131641027600 0ustar pbusernogroup00000000000000#!/usr/bin/python ## Generates the reference pot file based on the chromium's extension locale content ## Expects to be called w/ locale folder, e.g.: ## ## ./generate_reference_pot_file.py ./chromium-extension/_locales import sys def exit_with_error(msg): sys.stderr.write("*** Error: " + msg + "\n") sys.exit(1) if len(sys.argv) != 2: exit_with_error("Invalid usage") locales_folder = sys.argv[1] import os thispath = os.path.dirname(os.path.realpath(__file__)) # validation if not os.path.exists(locales_folder): exit_with_error("Invalid locale folder, does not exist") if not os.path.isabs(locales_folder): locales_folder = os.path.join (thispath, locales_folder) messages_json_reference_filename = os.path.join(locales_folder, "en/messages.json") if not os.path.exists(messages_json_reference_filename): exit_with_error("Invalid locale folder structure: no messages.json found for 'en' reference") # go def save_pot_file_for(filename, messages): import polib po = polib.POFile() po.metadata = { 'Project-Id-Version': 'PACKAGE VERSION', 'Report-Msgid-Bugs-To': 'you@example.com', 'POT-Creation-Date': '2007-10-18 14:00+0100', 'PO-Revision-Date': 'YEAR-MO-DA HO:MI+ZONE', 'Last-Translator': 'FULL NAME ', 'Language-Team': 'LANGUAGE ', 'Language': '', 'MIME-Version': '1.0', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Transfer-Encoding': '8bit', } for i, message in enumerate(messages): entry = polib.POEntry(msgid=message, msgstr=u'', occurrences=[('messages.json', str(i))] ) po.append(entry) po.save(filename) def generate_pot(json_filename): import json pot_messages = [] try: content = json.loads(open(json_filename).read()) for k, v in content.iteritems(): if v.__class__ is type({}) and v.has_key('message'): pot_messages.append(v['message']) save_pot_file_for('unity_chromium_extension.pot', pot_messages) except Exception, e: exit_with_error("Cannot read & import messages.json file, " + str(e)) if __name__ == "__main__": generate_pot(messages_json_reference_filename) unity-chromium-extension-3.0.0+14.04.20140318/po/Makefile.am0000644000015201777760000000016612312131641023563 0ustar pbusernogroup00000000000000po_files = $(shell ls *.py) $(shell ls *.po) $(shell ls *.pot) EXTRA_DIST = $(po_files) noinst_DATA = $(po_files) unity-chromium-extension-3.0.0+14.04.20140318/po/fr.po0000644000015201777760000000172512312131641022500 0ustar pbusernogroup00000000000000# French translation for unity-chromium-extension # Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 # This file is distributed under the same license as the unity-firefox-extension package. # FIRST AUTHOR , 2012. # msgid "" msgstr "" "Project-Id-Version: unity-chromium-extension\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2007-10-18 14:00+0100\n" "PO-Revision-Date: 2012-09-25 08:41+0000\n" "Last-Translator: Alexandre Abreu \n" "Language-Team: French \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2012-09-21 08:40+0000\n" "X-Generator: Launchpad (build 15985)\n" #: messages.json:0 msgid "" "Would you like to install $NAME$ (from $DOMAIN$), for extra features and " "quicker access?" msgstr "" "Voulez vous installer $NAME$ (depuis $DOMAIN$), pour des fonctionnalités étendues " "et un accès plus rapide?" unity-chromium-extension-3.0.0+14.04.20140318/po/pt.po0000644000015201777760000000173012312131641022510 0ustar pbusernogroup00000000000000# Portuguese translation for unity-chromium-extension # Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 # This file is distributed under the same license as the unity-firefox-extension package. # FIRST AUTHOR , 2012. # msgid "" msgstr "" "Project-Id-Version: unity-chromium-extension\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2007-10-18 14:00+0100\n" "PO-Revision-Date: 2012-09-25 08:41+0000\n" "Last-Translator: Alexandre Abreu \n" "Language-Team: Portuguese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2012-09-21 08:40+0000\n" "X-Generator: Launchpad (build 15985)\n" #: messages.json:0 msgid "" "Would you like to install $NAME$ (from $DOMAIN$), for extra features and " "quicker access?" msgstr "" "Gostaria de instalar $NAME$ (a partir de $DOMAIN$), para funções estendidas e um " "acceso máis rápido?" unity-chromium-extension-3.0.0+14.04.20140318/COPYING0000644000015201777760000010451312312131641022145 0ustar pbusernogroup00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .