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
102
gaia/tools/extensions/browser-helper@gaiamobile.org/content/browser.css
Executable file
102
gaia/tools/extensions/browser-helper@gaiamobile.org/content/browser.css
Executable file
|
|
@ -0,0 +1,102 @@
|
|||
|
||||
|
||||
/* Ignore devtools usual resizer */
|
||||
stack.browserStack.os-mode box.devtools-responsiveui-resizehandle,
|
||||
stack.browserStack.os-mode box.devtools-responsiveui-resizebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Gives responsive mode a phone look'n feel */
|
||||
stack.browserStack.os-mode {
|
||||
padding: 60px 15px 0;
|
||||
|
||||
border-radius: 25px / 20px;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
border: 1px solid #FFFFFF;
|
||||
border-bottom-width: 0;
|
||||
|
||||
background-color: #353535;
|
||||
|
||||
box-shadow: 0 3px 0.7px 1px #777777, 0 5px rgba(0, 0, 0, 0.4) inset !important;
|
||||
|
||||
background-image: -moz-linear-gradient(right, #111 11%, #333 56%);
|
||||
min-width: 320px;
|
||||
}
|
||||
|
||||
#os-hardware-buttons {
|
||||
-moz-appearance: none;
|
||||
padding: 20px;
|
||||
|
||||
border: 1px solid #FFFFFF;
|
||||
border-bottom-left-radius: 25px;
|
||||
border-bottom-right-radius: 25px;
|
||||
border-top-width: 0;
|
||||
|
||||
box-shadow: 0 3px 0.7px 1px #777777, 0 -7px rgba(0, 0, 0, 0.4) inset;
|
||||
|
||||
background-image: -moz-linear-gradient(right, #111 11%, #333 56%);
|
||||
}
|
||||
|
||||
#os-home-button {
|
||||
width: 40px;
|
||||
height: 30px;
|
||||
list-style-image: url("chrome://browser-helper.js/content/icons/home.png");
|
||||
-moz-image-region: rect(0, 12px, 12px, 0);
|
||||
}
|
||||
|
||||
#os-home-button:hover:active {
|
||||
-moz-image-region: rect(0, 24px, 12px, 12px);
|
||||
}
|
||||
|
||||
#os-sleep-button {
|
||||
-moz-appearance: none;
|
||||
/* compensate browserStack top padding */
|
||||
margin-top: -67px;
|
||||
margin-right: 10px;
|
||||
|
||||
min-width: 10px;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
|
||||
border: 1px solid #444;
|
||||
border-top-right-radius: 12px;
|
||||
border-top-left-radius: 12px;
|
||||
border-bottom-color: transparent;
|
||||
|
||||
background-image: -moz-linear-gradient(top, #111 11%, #333 56%);
|
||||
}
|
||||
|
||||
#os-sleep-button:hover:active {
|
||||
background-image: -moz-linear-gradient(top, #aaa 11%, #ddd 56%);
|
||||
}
|
||||
|
||||
#os-volume-buttons {
|
||||
margin-left: -29px;
|
||||
}
|
||||
|
||||
#os-volume-up-button,
|
||||
#os-volume-down-button {
|
||||
-moz-appearance: none;
|
||||
border: 1px solid red;
|
||||
min-width: 8px;
|
||||
height: 40px;
|
||||
|
||||
border: 1px solid #444;
|
||||
border-right-color: transparent;
|
||||
|
||||
background-image: -moz-linear-gradient(right, #111 11%, #333 56%);
|
||||
}
|
||||
|
||||
#os-volume-up-button:hover:active,
|
||||
#os-volume-down-button:hover:active {
|
||||
background-image: -moz-linear-gradient(right, #aaa 11%, #ddd 56%);
|
||||
}
|
||||
|
||||
#os-volume-up-button {
|
||||
border-top-left-radius: 12px;
|
||||
}
|
||||
|
||||
#os-volume-down-button {
|
||||
border-bottom-left-radius: 12px;
|
||||
}
|
||||
BIN
gaia/tools/extensions/browser-helper@gaiamobile.org/content/icons/home.png
Executable file
BIN
gaia/tools/extensions/browser-helper@gaiamobile.org/content/icons/home.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 470 B |
78
gaia/tools/extensions/browser-helper@gaiamobile.org/content/panel/controls.js
vendored
Executable file
78
gaia/tools/extensions/browser-helper@gaiamobile.org/content/panel/controls.js
vendored
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
!function() {
|
||||
|
||||
function sendChromeEvent(detail) {
|
||||
var contentDetail = Components.utils.createObjectIn(tab);
|
||||
for (var i in detail) {
|
||||
contentDetail[i] = detail[i];
|
||||
}
|
||||
Components.utils.makeObjectPropsNormal(contentDetail);
|
||||
|
||||
var customEvt = tab.document.createEvent('CustomEvent');
|
||||
customEvt.initCustomEvent('mozChromeEvent', true, true, contentDetail);
|
||||
tab.dispatchEvent(customEvt);
|
||||
}
|
||||
|
||||
function sendEvent(type, details) {
|
||||
var event = new tab.CustomEvent(type, details);
|
||||
tab.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function takeScreenshot() {
|
||||
var canvas = document.createElementNS('http://www.w3.org/1999/xhtml',
|
||||
'canvas');
|
||||
var width = tab.innerWidth;
|
||||
var height = tab.innerHeight;
|
||||
canvas.setAttribute('width', width);
|
||||
canvas.setAttribute('height', height);
|
||||
|
||||
var context = canvas.getContext('2d');
|
||||
var flags =
|
||||
context.DRAWWINDOW_DRAW_CARET |
|
||||
context.DRAWWINDOW_DRAW_VIEW |
|
||||
context.DRAWWINDOW_USE_WIDGET_LAYERS;
|
||||
context.drawWindow(tab, 0, 0, width, height,
|
||||
'rgb(255,255,255)', flags);
|
||||
|
||||
sendChromeEvent({
|
||||
type: 'take-screenshot-success',
|
||||
file: canvas.mozGetAsFile('screenshot', 'image/png')
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function Emulation() {
|
||||
|
||||
}
|
||||
|
||||
Emulation.prototype = {
|
||||
notification: function() {
|
||||
sendChromeEvent({
|
||||
type: 'desktop-notification',
|
||||
id: 123,
|
||||
title: 'Some Notification',
|
||||
text: 'I love notifications.',
|
||||
manifestURL: 'http://sytem.gaiamobile.org:8080/manifest.webapp'
|
||||
});
|
||||
}
|
||||
};
|
||||
window.emulation = new Emulation();
|
||||
|
||||
function Workflow() {
|
||||
|
||||
}
|
||||
|
||||
Workflow.prototype = {
|
||||
reload: function() {
|
||||
var global = tab.wrappedJSObject;
|
||||
var app = global.System.curentApp;
|
||||
|
||||
app.reload();
|
||||
},
|
||||
|
||||
screenshot: function() {
|
||||
takeScreenshot();
|
||||
}
|
||||
}
|
||||
window.workflow = new Workflow();
|
||||
|
||||
}();
|
||||
BIN
gaia/tools/extensions/browser-helper@gaiamobile.org/content/panel/icon.gif
Executable file
BIN
gaia/tools/extensions/browser-helper@gaiamobile.org/content/panel/icon.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 610 B |
17
gaia/tools/extensions/browser-helper@gaiamobile.org/content/panel/index.html
Executable file
17
gaia/tools/extensions/browser-helper@gaiamobile.org/content/panel/index.html
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
<link rel="stylesheet" href="stylesheet.css">
|
||||
<script defer src="controls.js"></script>
|
||||
<script defer src="workloads.js"></script>
|
||||
|
||||
<h3>Emulation</h3>
|
||||
<section>
|
||||
<button onclick="emulation.notification()">Notification</button>
|
||||
</section>
|
||||
|
||||
<h3>Developer</h3>
|
||||
<section>
|
||||
<button onclick="workflow.reload()">Reload Application</button>
|
||||
<button onclick="workflow.screenshot()">Take a screenshot</button>
|
||||
<select id="reference-workloads">
|
||||
<option value="-1">Import workload:</option>
|
||||
</select>
|
||||
</section>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
* {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
section {
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
!function() {
|
||||
|
||||
var select = document.getElementById('reference-workloads');
|
||||
|
||||
var options = [
|
||||
{
|
||||
name: 'contacts',
|
||||
db: 'contacts',
|
||||
counts: [0, 200, 500, 1000, 2000]
|
||||
},
|
||||
{
|
||||
name: 'messages',
|
||||
db: 'sms',
|
||||
counts: [0, 200, 500, 1000, 2000]
|
||||
},
|
||||
{
|
||||
name: 'dialer recents',
|
||||
db: 'dialer',
|
||||
counts: [0, 50, 100, 200, 500]
|
||||
}
|
||||
];
|
||||
|
||||
var targetFiles = {
|
||||
sms: '226660312ssm.sqlite',
|
||||
contacts: '3406066227csotncta.sqlite',
|
||||
dialer: '2584670174dsitanleecreR.sqlite'
|
||||
};
|
||||
|
||||
for (var i = 0, option; option = options[i]; i++) {
|
||||
for (var j = 0, cLen = option.counts.length; j < cLen; j++) {
|
||||
var count = option.counts[j];
|
||||
var optionEl = document.createElement('option');
|
||||
optionEl.innerHTML = count + ' ' + option.name;
|
||||
optionEl.value = option.db + '-' + count;
|
||||
select.appendChild(optionEl);
|
||||
}
|
||||
}
|
||||
|
||||
select.addEventListener('change', function(e) {
|
||||
var parts = this.value.split('-');
|
||||
var database = parts[0];
|
||||
var count = parts[1];
|
||||
|
||||
importRecords(database, count);
|
||||
|
||||
tab.alert('Imported: ' + count + ' ' + database + ' records.');
|
||||
this.value = '-1';
|
||||
});
|
||||
|
||||
function importRecords(database, count) {
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import('resource://gre/modules/Services.jsm');
|
||||
var currProfD = Services.dirsvc.get('ProfD', Ci.nsIFile);
|
||||
var profileDir = currProfD.path;
|
||||
|
||||
var file = database + 'Db-' + count + '.sqlite';
|
||||
|
||||
var sourceFile = Services.dirsvc.get('ProfD', Ci.nsILocalFile);
|
||||
sourceFile.append('..');
|
||||
sourceFile.append('test_media');
|
||||
sourceFile.append('reference-workload');
|
||||
sourceFile.append(file);
|
||||
|
||||
var targetFolder = Services.dirsvc.get('ProfD', Ci.nsILocalFile);
|
||||
targetFolder.append('storage');
|
||||
targetFolder.append('persistent');
|
||||
targetFolder.append('chrome');
|
||||
targetFolder.append('idb');
|
||||
|
||||
try {
|
||||
sourceFile.copyTo(targetFolder, targetFiles[database]);
|
||||
} catch (e) {
|
||||
tab.alert('Could not import file: ' + e);
|
||||
}
|
||||
}
|
||||
|
||||
}();
|
||||
187
gaia/tools/extensions/browser-helper@gaiamobile.org/content/shell.js
Executable file
187
gaia/tools/extensions/browser-helper@gaiamobile.org/content/shell.js
Executable file
|
|
@ -0,0 +1,187 @@
|
|||
|
||||
dump('======== browser-helper: content.js loaded ========\n')
|
||||
|
||||
function debug(str) {
|
||||
//dump('browser-helper (frame-script): ' + str + '\n');
|
||||
}
|
||||
|
||||
let CC = Components.Constructor;
|
||||
let Cc = Components.classes;
|
||||
let Ci = Components.interfaces;
|
||||
let Cu = Components.utils;
|
||||
let Cr = Components.results;
|
||||
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import('resource://gre/modules/Keyboard.jsm');
|
||||
|
||||
// Various helpers coming from /b2g/chrome/content/shell.js
|
||||
function getContentWindow() {
|
||||
return content;
|
||||
}
|
||||
|
||||
function sendChromeEvent(details, type) {
|
||||
type = type || 'mozChromeEvent';
|
||||
let content = getContentWindow();
|
||||
details = details || {};
|
||||
|
||||
let event = content.document.createEvent('CustomEvent');
|
||||
event.initCustomEvent(type, true, true,
|
||||
Cu.cloneInto(details, content));
|
||||
content.dispatchEvent(event);
|
||||
}
|
||||
|
||||
// Listen for app.launch calls and forward them to the the system app.
|
||||
// Copy of /b2g/chrome/content/shell.js
|
||||
Cu.import('resource://gre/modules/Webapps.jsm');
|
||||
Cu.import('resource://gre/modules/AppsUtils.jsm');
|
||||
|
||||
Services.obs.addObserver(function onLaunch(subject, topic, data) {
|
||||
let json = JSON.parse(data);
|
||||
|
||||
DOMApplicationRegistry.getManifestFor(json.manifestURL).then((aManifest) => {
|
||||
if (!aManifest)
|
||||
return;
|
||||
|
||||
let manifest = new ManifestHelper(aManifest, json.origin,
|
||||
json.manifestURL);
|
||||
let data = {
|
||||
'timestamp': json.timestamp,
|
||||
'url': manifest.fullLaunchPath(json.startPoint),
|
||||
'manifestURL': json.manifestURL
|
||||
};
|
||||
sendChromeEvent(data, 'webapps-launch');
|
||||
});
|
||||
}, 'webapps-launch', false);
|
||||
|
||||
|
||||
// Listen for system messages and relay them to Gaia.
|
||||
// Copy of /b2g/chrome/content/shell.js
|
||||
// XXX This code should be loaded in the activities/ extension
|
||||
Services.obs.addObserver(function onSystemMessage(subject, topic, data) {
|
||||
let msg = JSON.parse(data);
|
||||
|
||||
let origin = Services.io.newURI(msg.manifest, null, null).prePath;
|
||||
sendChromeEvent({
|
||||
url: msg.uri,
|
||||
manifestURL: msg.manifest,
|
||||
isActivity: (msg.type == 'activity'),
|
||||
target: msg.target,
|
||||
expectingSystemMessage: true
|
||||
}, 'open-app');
|
||||
}, 'system-messages-open-app', false);
|
||||
|
||||
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
||||
let data = JSON.parse(aData);
|
||||
sendChromeEvent({
|
||||
type: 'activity-done',
|
||||
success: data.success,
|
||||
manifestURL: data.manifestURL,
|
||||
pageURL: data.pageURL
|
||||
});
|
||||
}, 'activity-done', false);
|
||||
|
||||
|
||||
|
||||
// =================== Settings ====================
|
||||
// Copy of /b2g/chrome/content/settings.js
|
||||
var SettingsListener = {
|
||||
_callbacks: {},
|
||||
|
||||
init: function sl_init() {
|
||||
if ('mozSettings' in content.navigator && content.navigator.mozSettings) {
|
||||
content.navigator.mozSettings.onsettingchange = this.onchange.bind(this);
|
||||
}
|
||||
},
|
||||
|
||||
onchange: function sl_onchange(evt) {
|
||||
var callback = this._callbacks[evt.settingName];
|
||||
if (callback) {
|
||||
callback(evt.settingValue);
|
||||
}
|
||||
},
|
||||
|
||||
observe: function sl_observe(name, defaultValue, callback) {
|
||||
var settings = content.navigator.mozSettings;
|
||||
if (!settings) {
|
||||
content.setTimeout(function() { callback(defaultValue); });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!callback || typeof callback !== 'function') {
|
||||
throw new Error('Callback is not a function');
|
||||
}
|
||||
|
||||
var req = settings.createLock().get(name);
|
||||
req.addEventListener('success', (function onsuccess() {
|
||||
callback(typeof(req.result[name]) != 'undefined' ?
|
||||
req.result[name] : defaultValue);
|
||||
}));
|
||||
|
||||
this._callbacks[name] = callback;
|
||||
}
|
||||
};
|
||||
|
||||
SettingsListener.init();
|
||||
|
||||
// =================== Languages ====================
|
||||
// Modified copy of /b2g/chrome/content/settings.js
|
||||
SettingsListener.observe('language.current', 'en-US', function(value) {
|
||||
Services.prefs.setCharPref('general.useragent.locale', value);
|
||||
|
||||
let prefName = 'intl.accept_languages';
|
||||
if (Services.prefs.prefHasUserValue(prefName)) {
|
||||
Services.prefs.clearUserPref(prefName);
|
||||
}
|
||||
|
||||
let intl = '';
|
||||
try {
|
||||
intl = Services.prefs.getComplexValue(prefName,
|
||||
Ci.nsIPrefLocalizedString).data;
|
||||
} catch(e) {}
|
||||
|
||||
// Bug 830782 - Homescreen is in English instead of selected locale after
|
||||
// the first run experience.
|
||||
// In order to ensure the current intl value is reflected on the child
|
||||
// process let's always write a user value, even if this one match the
|
||||
// current localized pref value.
|
||||
if (!((new RegExp('^' + value + '[^a-z-_] *[,;]?', 'i')).test(intl))) {
|
||||
value = value + ', ' + intl;
|
||||
} else {
|
||||
value = intl;
|
||||
}
|
||||
Services.prefs.setCharPref(prefName, value);
|
||||
|
||||
//XXX: modification of settings.js here:
|
||||
var window = getContentWindow();
|
||||
if (!('hasStarted' in window) && window.hasStarted != true) {
|
||||
window.hasStarted = true;
|
||||
|
||||
window.addEventListener('load', function onload() {
|
||||
window.removeEventListener('load', onload);
|
||||
window.setTimeout(function() {
|
||||
sendChromeEvent({'type': 'webapps-registry-ready'});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* This code comes from b2g/chrome/content/shell.js
|
||||
* For now just the keyboard stuff, should copy everything over at some point
|
||||
*/
|
||||
getContentWindow().addEventListener('mozContentEvent', function(evt) {
|
||||
let detail = evt.detail;
|
||||
debug('XXX FIXME : Got a mozContentEvent: ' + detail.type + "\n");
|
||||
|
||||
switch(detail.type) {
|
||||
case 'inputmethod-update-layouts':
|
||||
KeyboardHelper.handleEvent(detail);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
let KeyboardHelper = {
|
||||
handleEvent: function keyboard_handleEvent(aMessage) {
|
||||
Keyboard.setLayouts(aMessage.layouts);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue