Skip to content

Commit

Permalink
merged npapi branch into next and cleaned up merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Silivestru committed Jul 11, 2012
2 parents 1a16d8f + dc80540 commit 8778781
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 9 deletions.
3 changes: 2 additions & 1 deletion build/build/chromestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module.exports = function (src, baton) {
'cp -r ' + _c.ASSETS + "images " + _c.DEPLOY + "chromestore/ &&" +
'cp -r ' + _c.ASSETS + "themes " + _c.DEPLOY + "chromestore/ &&" +
'cp ' + _c.EXT + "chromestore/manifest.json " + _c.DEPLOY + "chromestore/manifest.json &&" +
'cp ' + _c.EXT + "chromestore/controllers/Background.js " + _c.DEPLOY + "chromestore/controllers/Background.js";
'cp ' + _c.EXT + "chromestore/controllers/Background.js " + _c.DEPLOY + "chromestore/controllers/Background.js" +
'cp ' + _c.EXT + "chromestore/views/background.html " + _c.DEPLOY + "chromestore/views/background.html";

childProcess.exec(copy, function () {
var css = _c.ASSETS + "ripple.css",
Expand Down
3 changes: 2 additions & 1 deletion build/build/chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = function (src, baton) {

var copy = 'cp -r ' + _c.EXT + "chromium " + _c.DEPLOY + " && " +
'cp -r ' + _c.ASSETS + "images " + _c.DEPLOY + "chromium/ &&" +
'cp -r ' + _c.ASSETS + "themes " + _c.DEPLOY + "chromium/";
'cp -r ' + _c.ASSETS + "themes " + _c.DEPLOY + "chromium/" +
'cp -r ' + _c.ROOT + "plugins " + _c.DEPLOY + "chromium/";

childProcess.exec(copy, function () {
var css = _c.ASSETS + "ripple.css",
Expand Down
23 changes: 23 additions & 0 deletions ext/chromestore/views/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
* Copyright 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<html>
<head>
<script type="text/javascript" src="../controllers/jquery.js"></script>
<script type="text/javascript" src="../controllers/Background.js"></script>
</head>
<body>
</body>
</html>
33 changes: 28 additions & 5 deletions ext/chromium/controllers/Background.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ tinyHippos.Background = (function () {
xhr.send();

chrome.extension.onRequest.addListener(function (request, sender, sendResponse) {
var xhr, postData, data, plugin;
console.log(request);
switch (request.action) {
case "isEnabled":
console.log("isEnabled? ==> " + request.tabURL);
Expand All @@ -67,16 +69,16 @@ tinyHippos.Background = (function () {
sendResponse();
break;
case "userAgent":
console.log("user agent ==> " + userAgent);
console.log("user agent ==> " + request.data);
userAgent = request.data;
break;
case "version":
sendResponse(version);
break;
case "xhr":
var xhr = new XMLHttpRequest(),
postData = new FormData(),
data = JSON.parse(request.data);
xhr = new XMLHttpRequest();
postData = new FormData();
data = JSON.parse(request.data);

console.log("xhr ==> " + data.url);

Expand All @@ -99,8 +101,29 @@ tinyHippos.Background = (function () {
}
});
break;
case "services":
console.log("services", request.data);
if (request.data === '"start"') {
plugin = document.getElementById("pluginRippleBD");
console.log("plugin", plugin);
if (plugin) {
console.log("return from startBD", plugin.startBD(9910));
sendResponse();
}
}
else if (request.data === '"stop"') {
xhr = new XMLHTTPRequest();
try {
xhr.open("GET", "http://127.0.0.1:9910/ripple/shutdown", false);
xhr.send();
}
catch (e) {
console.log(e);
}
}
break;
default:
throw {name: "MethodNotImplemented", message: "Requested action is not supported!"};
throw {name: "MethodNotImplemented", message: "Requested action is not supported! "};
break;
};
});
Expand Down
15 changes: 15 additions & 0 deletions ext/chromium/controllers/frame.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
if (!document.getElementById("emulator-booting") && !document.getElementById("tinyhippos-injected")) {
var script = document.createElement("script");
script.id = "tinyhippos-injected";
Expand Down
4 changes: 4 additions & 0 deletions ext/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"version": "",
"name": "Ripple Emulator (Beta)",
"background_page":"views/background.html",
"plugins": [
{ "path": "plugins/npRippleBD.dll" },
{ "path": "plugins/RippleBD.plugin" }
],
"icons":{
"16":"images/Icon_16x16.png",
"128":"images/Icon_128x128.png",
Expand Down
1 change: 1 addition & 0 deletions ext/chromium/views/background.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<script type="text/javascript" src="../controllers/Background.js"></script>
</head>
<body>
<embed type="application/x-ripplebd" id="pluginRippleBD" hidden="true" width="0" height="0" />
</body>
</html>
13 changes: 13 additions & 0 deletions lib/ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ var omgwtf = require('ripple/omgwtf'),
}
};

//HACK: need to find a better way to do this since it's
//WebWorks specific!!!
window.onunload = function () {
var bus = require('ripple/bus');
bus.ajax(
"GET",
"http://127.0.0.1:9910/ripple/shutdown",
null,
null,
null
);
};

jWorkflow.order(omgwtf.initialize, omgwtf)
.andThen(appcache.initialize, appcache)
.andThen(db.initialize, db)
Expand Down
34 changes: 33 additions & 1 deletion lib/ripple/ui/plugins/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,29 @@
* limitations under the License.
*/
var tooltip = require('ripple/ui/plugins/tooltip'),
settings = require('ripple/ui/plugins/settings-dialog');
settings = require('ripple/ui/plugins/settings-dialog'),
bus = require('ripple/bus');

function handleBuild() {
bus.ajax(
"GET",
"http://127.0.0.1:9910/ripple/about",
null,
function () {
doBuild();
},
function (error) {
if (error.code === 0 || error.code === 404) {
startServices(function () {
doBuild();
});
}
}
);

}

function doBuild() {
var node = $(this),
action = node.attr('id').split("-")[2];

Expand All @@ -32,6 +52,16 @@ function handleBuild() {
}
}

function startServices(callBack) {
var action = "start";
bus.send("services", action, function () {
if (typeof callBack === "function") {
callBack();
}
$("#options-menu-services").show();
});
}

module.exports = {
panel: {
domId: "build-container",
Expand All @@ -52,5 +82,7 @@ module.exports = {
$("#options-menu-build-warning").show();
tooltip.create("#options-menu-build-warning", "Remote Web Inspector should be disabled when packaging for App World release");
}

startServices();
}
};
3 changes: 3 additions & 0 deletions lib/ripple/ui/plugins/build/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
</section>
</section>
<section class="info ui-widget-content ui-corner-all" style="display: none;">
<section id="options-menu-services" class="ui-text-fail irrelevant">
The Build and Deploy services are currently running at: http://127.0.0.1:9910
</section>
<button id="options-menu-build" class="not-ready ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
<span class="ui-button-text">Package</span>
</button>
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/jasmine

0 comments on commit 8778781

Please sign in to comment.