Skip to content

Instantly share code, notes, and snippets.

@lloyd
Created November 14, 2013 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloyd/7469644 to your computer and use it in GitHub Desktop.
Save lloyd/7469644 to your computer and use it in GitHub Desktop.
diff --git a/b2g/components/B2GComponents.manifest b/b2g/components/B2GComponents.manifest
index 50503cf..44f9676 100644
--- a/b2g/components/B2GComponents.manifest
+++ b/b2g/components/B2GComponents.manifest
@@ -72,6 +72,10 @@ component {637b0f77-2429-49a0-915f-abf5d0db8b9a} WebappsUpdateTimer.js
contract @mozilla.org/b2g/webapps-update-timer;1 {637b0f77-2429-49a0-915f-abf5d0db8b9a}
category update-timer WebappsUpdateTimer @mozilla.org/b2g/webapps-update-timer;1,getService,background-update-timer,webapps.update.interval,86400
+# FxAccountsUIGlue.js
+component {51875c14-91d7-4b8c-b65d-3549e101228c} FxAccountsUIGlue.js
+contract @mozilla.org/fxaccounts/fxaccounts-ui-glue;1 {51875c14-91d7-4b8c-b65d-3549e101228c}
+
# HelperAppDialog.js
component {710322af-e6ae-4b0c-b2c9-1474a87b077e} HelperAppDialog.js
contract @mozilla.org/helperapplauncherdialog;1 {710322af-e6ae-4b0c-b2c9-1474a87b077e}
diff --git a/b2g/components/FxAccountsUIGlue.js b/b2g/components/FxAccountsUIGlue.js
new file mode 100644
index 0000000..380b60a
--- /dev/null
+++ b/b2g/components/FxAccountsUIGlue.js
@@ -0,0 +1,31 @@
+/* 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"
+
+const { interfaces: Ci, utils: Cu } = Components;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+
+function FxAccountsUIGlue() {
+}
+
+FxAccountsUIGlue.prototype = {
+
+ getUserPermission: function(aRpInfo, aAllowCb, aDontAllowCb) {
+ },
+
+ signIn: function(aAccountId, aSuccessCb, aErrorCb) {
+ },
+
+ signUp: function(aSuccessCb, aErrorCb) {
+ },
+
+ classID: Components.ID("{51875c14-91d7-4b8c-b65d-3549e101228c}"),
+
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFxAccountsUIGlue])
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FxAccountsUIGlue]);
diff --git a/b2g/components/moz.build b/b2g/components/moz.build
index dc4c481..3fe8d5e 100644
--- a/b2g/components/moz.build
+++ b/b2g/components/moz.build
@@ -15,6 +15,7 @@ EXTRA_COMPONENTS += [
'ContentHandler.js',
'ContentPermissionPrompt.js',
'FilePicker.js',
+ 'FxAccountsUIGlue.js',
'HelperAppDialog.js',
'MailtoProtocolHandler.js',
'PaymentGlue.js',
diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in
index ed37ac9..ae5102d 100644
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -778,6 +778,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/components/B2GAboutRedirector.js
@BINPATH@/components/FilePicker.js
@BINPATH@/components/HelperAppDialog.js
+@BINPATH@/components/FxAccountsUIGlue.js
@BINPATH@/components/DataStore.manifest
@BINPATH@/components/DataStoreService.js
diff --git a/services/fxaccounts/interfaces/moz.build b/services/fxaccounts/interfaces/moz.build
index 4244350..be871f9 100644
--- a/services/fxaccounts/interfaces/moz.build
+++ b/services/fxaccounts/interfaces/moz.build
@@ -5,7 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
- 'nsIFxAccountsClient.idl'
+ 'nsIFxAccountsClient.idl',
+ 'nsIFxAccountsUIGlue.idl'
]
XPIDL_MODULE = 'services_fxaccounts'
diff --git a/services/fxaccounts/interfaces/nsIFxAccountsUIGlue.idl b/services/fxaccounts/interfaces/nsIFxAccountsUIGlue.idl
new file mode 100644
index 0000000..186c1f3
--- /dev/null
+++ b/services/fxaccounts/interfaces/nsIFxAccountsUIGlue.idl
@@ -0,0 +1,28 @@
+/* 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/. */
+
+#include "nsISupports.idl"
+
+[scriptable, function, uuid(70db91cb-0910-421f-ae55-00ca372e9d9a)]
+interface nsIFxAccountsUIGlueCallback : nsISupports
+{
+ void onresult(in DOMString requestId, in DOMString result);
+};
+
+[scriptable, uuid(cd66d0e2-9771-4b5a-b7a2-7515bd72d315)]
+interface nsIFxAccountsUIGlue : nsISupports
+{
+ // TODO: we will probably need more than a string for showing RP
+ // information.
+ void getUserPermission(in DOMString rpInfo,
+ in nsIFxAccountsUIGlueCallback allowCb,
+ in nsIFxAccountsUIGlueCallback dontAllowCb);
+
+ void signIn(in DOMString accountId,
+ in nsIFxAccountsUIGlueCallback successCb,
+ in nsIFxAccountsUIGlueCallback errorCb);
+
+ void signUp(in nsIFxAccountsUIGlueCallback successCb,
+ in nsIFxAccountsUIGlueCallback errorCb);
+};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment