Bug 571897 (Sync UI) - Part 3: General hookup [r=dolske]

This commit is contained in:
Paul O’Shannessy 2010-08-02 16:37:56 -07:00
parent 503347b37b
commit a0f738c0fd
2 changed files with 31 additions and 0 deletions

View File

@ -148,6 +148,14 @@ __defineSetter__("PluralForm", function (val) {
return this.PluralForm = val;
});
#ifdef MOZ_SERVICES_SYNC
XPCOMUtils.defineLazyGetter(this, "Weave", function() {
let tmp = {};
Cu.import("resource://services-sync/service.js", tmp);
return tmp.Weave;
});
#endif
XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
let tmp = {};
Cu.import("resource://gre/modules/PopupNotifications.jsm", tmp);

View File

@ -380,6 +380,29 @@ BrowserGlue.prototype = {
temp.WinTaskbarJumpList.startup();
}
#endif
#endif
#ifdef MOZ_SERVICES_SYNC
// Assume that a non-zero value for services.sync.autoconnectDelay should override
if (Services.prefs.prefHasUserValue("services.sync.autoconnectDelay")) {
let prefDelay = Services.prefs.getIntPref("services.sync.autoconnectDelay");
if (prefDelay > 0)
return;
}
// delays are in seconds
const MAX_DELAY = 300;
let delay = 3;
let enum = Services.wm.getEnumerator("navigator:browser");
while (enum.hasMoreElements()) {
delay += enum.getNext().gBrowser.tabs.length;
}
delay = delay <= MAX_DELAY ? delay : MAX_DELAY;
let syncTemp = {};
Cu.import("resource://services-sync/service.js", syncTemp);
syncTemp.Weave.Service.delayedAutoConnect(delay);
#endif
},