ClientData fixes; export to chrome as well

This commit is contained in:
Dan Mills 2008-07-29 18:15:13 -07:00
parent 34c0adde08
commit 6965a649ec
2 changed files with 26 additions and 27 deletions

View File

@ -42,10 +42,10 @@ const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
Cu.import("resource://weave/crypto.js");
Cu.import("resource://weave/log4moz.js");
Cu.import("resource://weave/util.js");
Cu.import("resource://weave/dav.js");
Cu.import("resource://weave/remote.js");
Cu.import("resource://weave/identity.js");
Cu.import("resource://weave/async.js");
Function.prototype.async = Async.sugar;
@ -56,6 +56,27 @@ function ClientDataSvc() {
this._init();
}
ClientDataSvc.prototype = {
get GUID() {
return this._getCharPref("client.GUID", function() Utils.makeGUID());
},
set GUID(value) {
Utils.prefs.setCharPref("client.GUID", value);
},
get name() {
return this._getCharPref("client.name", function() "cheese");
},
set GUID(value) {
Utils.prefs.setCharPref("client.name", value);
},
get type() {
return this._getCharPref("client.type", function() "gruyere");
},
set GUID(value) {
Utils.prefs.setCharPref("client.type", value);
},
_getCharPref: function ClientData__getCharPref(pref, defaultCb) {
let value;
try {
@ -67,33 +88,9 @@ ClientDataSvc.prototype = {
return value;
},
get GUID() {
return this._getCharPref("client.GUID",
function() { return Utils.makeGUID(); });
},
set GUID(value) {
Utils.prefs.setCharPref("client.GUID", value);
},
get name() {
return this._getCharPref("client.name",
function() { return "cheese"; });
},
set GUID(value) {
Utils.prefs.setCharPref("client.name", value);
},
get type() {
return this._getCharPref("client.type",
function() { return "gruyere"; });
},
set GUID(value) {
Utils.prefs.setCharPref("client.type", value);
},
_init: function ClientData__init() {
this._log = Log4Moz.Service.getLogger("Service.ClientData");
this._remoteFile = new Resource("meta/clients");
this._remote = new Resource("meta/clients");
this._remote.pushFilter(new JsonFilter());
},

View File

@ -75,6 +75,7 @@ Cu.import("resource://weave/engines.js");
Cu.import("resource://weave/dav.js");
Cu.import("resource://weave/identity.js");
Cu.import("resource://weave/async.js");
Cu.import("resource://weave/clientData.js");
Cu.import("resource://weave/engines/cookies.js");
Cu.import("resource://weave/engines/bookmarks.js");
Cu.import("resource://weave/engines/history.js");
@ -93,6 +94,7 @@ Cu.import("resource://weave/faultTolerance.js", Weave);
Cu.import("resource://weave/crypto.js", Weave);
Cu.import("resource://weave/notifications.js", Weave);
Cu.import("resource://weave/identity.js", Weave);
Cu.import("resource://weave/clientData.js", Weave);
Cu.import("resource://weave/dav.js", Weave);
Cu.import("resource://weave/stores.js", Weave);
Cu.import("resource://weave/syncCores.js", Weave);