Bug 938635 - Implement forceAuthentication for firefox accounts. Part 3: UI glue. r=fabrice

This commit is contained in:
Fernando Jiménez 2014-02-19 11:47:11 +01:00
parent c5f76c663d
commit fb628dd7a0
3 changed files with 19 additions and 4 deletions

View File

@ -129,6 +129,7 @@ this.FxAccountsMgmtService = {
break;
case "signIn":
case "signUp":
case "refreshAuthentication":
FxAccountsManager[data.method](data.accountId, data.password).then(
user => {
self._onFullfill(msg.id, user);

View File

@ -22,7 +22,7 @@ FxAccountsUIGlue.prototype = {
_browser: Services.wm.getMostRecentWindow("navigator:browser"),
signInFlow: function() {
_contentRequest: function(aEventName, aData) {
let deferred = Promise.defer();
let content = this._browser.getContentWindow();
@ -55,8 +55,9 @@ FxAccountsUIGlue.prototype = {
});
let detail = {
eventName: "openFlow",
id: id
eventName: aEventName,
id: id,
data: aData
};
log.debug("Send chrome event " + JSON.stringify(detail));
this._browser.shell.sendCustomEvent("mozFxAccountsUnsolChromeEvent", detail);
@ -64,6 +65,16 @@ FxAccountsUIGlue.prototype = {
return deferred.promise;
},
signInFlow: function() {
return this._contentRequest("openFlow");
},
refreshAuthentication: function(aAccountId) {
return this._contentRequest("refreshAuthentication", {
accountId: aAccountId
});
},
classID: Components.ID("{51875c14-91d7-4b8c-b65d-3549e101228c}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFxAccountsUIGlue])

View File

@ -4,9 +4,12 @@
#include "nsISupports.idl"
[scriptable, uuid(5805ac8b-7cbe-4fbd-97ad-d3ae8cd29f79)]
[scriptable, uuid(ab8d0700-9577-11e3-a5e2-0800200c9a66)]
interface nsIFxAccountsUIGlue : nsISupports
{
// Returns a Promise.
jsval signInFlow();
// Returns a Promise.
jsval refreshAuthentication(in DOMString accountId);
};