2012-07-20 15:41:30 +00:00
|
|
|
/* 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";
|
2012-08-23 18:56:36 +00:00
|
|
|
|
2012-07-20 15:41:30 +00:00
|
|
|
const Cc = Components.classes;
|
|
|
|
const Ci = Components.interfaces;
|
|
|
|
const Cu = Components.utils;
|
2012-08-23 18:56:36 +00:00
|
|
|
|
2012-07-20 15:41:30 +00:00
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
2012-08-25 04:07:58 +00:00
|
|
|
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
2012-07-20 15:41:30 +00:00
|
|
|
|
|
|
|
function debug(aMsg) {
|
|
|
|
//dump("-- ActivityWrapper.js " + Date.now() + " : " + aMsg + "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-08-23 18:56:36 +00:00
|
|
|
* nsISystemMessagesWrapper implementation. Will return a
|
2012-07-20 15:41:30 +00:00
|
|
|
* nsIDOMMozActivityRequestHandler
|
|
|
|
*/
|
|
|
|
function ActivityWrapper() {
|
|
|
|
debug("ActivityWrapper");
|
|
|
|
}
|
|
|
|
|
|
|
|
ActivityWrapper.prototype = {
|
2012-08-25 04:07:58 +00:00
|
|
|
wrapMessage: function wrapMessage(aMessage, aWindow) {
|
2012-07-20 15:41:30 +00:00
|
|
|
debug("Wrapping " + JSON.stringify(aMessage));
|
|
|
|
let handler = Cc["@mozilla.org/dom/activities/request-handler;1"]
|
|
|
|
.createInstance(Ci.nsIDOMMozActivityRequestHandler);
|
|
|
|
handler.wrappedJSObject._id = aMessage.id;
|
|
|
|
|
|
|
|
// options is an nsIDOMActivityOptions object.
|
|
|
|
var options = handler.wrappedJSObject._options;
|
|
|
|
options.wrappedJSObject._name = aMessage.payload.name;
|
2012-08-25 04:07:58 +00:00
|
|
|
options.wrappedJSObject._data = ObjectWrapper.wrap(aMessage.payload.data, aWindow);
|
2012-07-20 15:41:30 +00:00
|
|
|
|
|
|
|
return handler;
|
|
|
|
},
|
|
|
|
|
|
|
|
classID: Components.ID("{5430d6f9-32d6-4924-ba39-6b6d1b093cd6}"),
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesWrapper])
|
|
|
|
}
|
|
|
|
|
2012-10-31 16:13:28 +00:00
|
|
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityWrapper]);
|
2012-07-20 15:41:30 +00:00
|
|
|
|