Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
5
gaia/tools/extensions/activities/chrome.manifest
Executable file
5
gaia/tools/extensions/activities/chrome.manifest
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
# Activities
|
||||
component {70a83123-7467-4389-a309-3e81c74ad002} components/ActivitiesGlue.js
|
||||
contract @mozilla.org/dom/activities/ui-glue;1 {70a83123-7467-4389-a309-3e81c74ad002}
|
||||
|
||||
interfaces components/activity_glue.xpt
|
||||
76
gaia/tools/extensions/activities/components/ActivitiesGlue.js
Executable file
76
gaia/tools/extensions/activities/components/ActivitiesGlue.js
Executable file
|
|
@ -0,0 +1,76 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict"
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function ActivitiesDialog() {
|
||||
this._id = 0;
|
||||
|
||||
this.activities = [];
|
||||
}
|
||||
|
||||
ActivitiesDialog.prototype = {
|
||||
run: function ap_run() {
|
||||
let id = "activity-choice" + this._id++;
|
||||
let activity = this.activities.shift();
|
||||
|
||||
let choices = [];
|
||||
activity.list.forEach(function(item) {
|
||||
choices.push({ manifest: item.manifest, icon: item.icon });
|
||||
});
|
||||
|
||||
|
||||
// Keep up the frond-end of an activity choice. The messages contains
|
||||
// a list of {names, icons} for applications able to handle this particular
|
||||
// activity. The front-end should display a UI to pick one.
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let content = browser.gBrowser.selectedBrowser.contentWindow;
|
||||
let detail = {
|
||||
type: "activity-choice",
|
||||
id: id,
|
||||
name: activity.name,
|
||||
choices: choices
|
||||
};
|
||||
|
||||
// Listen the resulting choice from the front-end. If there is no choice,
|
||||
// let's return -1, which means the user has cancelled the dialog.
|
||||
content.addEventListener("mozContentEvent", function act_getChoice(evt) {
|
||||
if (evt.detail.id != id)
|
||||
return;
|
||||
|
||||
content.removeEventListener("mozContentEvent", act_getChoice);
|
||||
activity.callback.handleEvent(evt.detail.value !== undefined
|
||||
? evt.detail.value
|
||||
: -1);
|
||||
});
|
||||
|
||||
let event = content.document.createEvent('CustomEvent');
|
||||
event.initCustomEvent('mozChromeEvent', true, true,
|
||||
Cu.cloneInto(detail, content));
|
||||
content.dispatchEvent(event);
|
||||
},
|
||||
|
||||
chooseActivity: function ap_chooseActivity(aName, aActivities, aCallback) {
|
||||
this.activities.push({
|
||||
name: aName,
|
||||
list: aActivities,
|
||||
callback: aCallback
|
||||
});
|
||||
Services.tm.currentThread.dispatch(this, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
||||
},
|
||||
|
||||
classID: Components.ID("{70a83123-7467-4389-a309-3e81c74ad002}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIActivityUIGlue, Ci.nsIRunnable])
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivitiesDialog]);
|
||||
|
||||
BIN
gaia/tools/extensions/activities/components/activity_glue.xpt
Executable file
BIN
gaia/tools/extensions/activities/components/activity_glue.xpt
Executable file
Binary file not shown.
25
gaia/tools/extensions/activities/components/nsIActivityUIGlue.idl
Executable file
25
gaia/tools/extensions/activities/components/nsIActivityUIGlue.idl
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, function, uuid(7a16feb4-5a78-4589-9174-b728f26942e2)]
|
||||
interface nsIActivityUIGlueCallback : nsISupports
|
||||
{
|
||||
void handleEvent(in long choice);
|
||||
};
|
||||
|
||||
/**
|
||||
* To be implemented by @mozilla.org/dom/activities/ui-glue;1
|
||||
*/
|
||||
[scriptable, uuid(8624ad73-937a-400f-9d93-39ab5449b867)]
|
||||
interface nsIActivityUIGlue : nsISupports
|
||||
{
|
||||
/**
|
||||
* @param name The name of the activity to handle (eg. "share", "pick").
|
||||
* @param activities A json blob which is an array of { "title":"...", "icon":"..." }.
|
||||
* @param onresult The callback to send the index of the choosen activity. Send -1 if no choice is made.
|
||||
*/
|
||||
void chooseActivity(in DOMString title, in jsval activities, in nsIActivityUIGlueCallback onresult);
|
||||
};
|
||||
24
gaia/tools/extensions/activities/install.rdf
Executable file
24
gaia/tools/extensions/activities/install.rdf
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>activities@gaiamobile.org</em:id>
|
||||
<em:name>activities.js</em:name>
|
||||
<em:version>0.2</em:version>
|
||||
<em:iconURL>chrome://activities.js/skin/logo.png</em:iconURL>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
|
||||
<em:minVersion>6.0</em:minVersion>
|
||||
<em:maxVersion>25.*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
<em:unpack>true</em:unpack>
|
||||
<em:bootstrap>false</em:bootstrap>
|
||||
<em:creator>Vivien Nicolas</em:creator>
|
||||
<em:description>activities.js</em:description>
|
||||
<em:homepageURL>https://github.com/mozilla-b2g/gaia/</em:homepageURL>
|
||||
</Description>
|
||||
</RDF>
|
||||
Loading…
Reference in a new issue