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
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);
|
||||
}
|
||||
}
|
||||
|
||||
}();
|
||||
Loading…
Reference in a new issue