30 Components.utils.import(
"resource://app/jsmodules/StringUtils.jsm");
58 .getService(Components.interfaces.nsIObserverService);
63 return parseInt(gAppPrefs.getValue(
name,
value || 0).toString(), 10);
77 _mAppStartTimespec: 0,
78 _mSavedTotalRuntime: 0,
79 _mHasSessionRequirements:
false,
80 _mHasRuntimeRequirements:
false,
86 if (disablePrefs !=
null && disablePrefs.value) {
100 var curDate =
new Date();
101 this._mAppStartTimespec = curDate.getTime();
102 var hasDateRequirements =
true;
107 var surveyTakenTime =
110 var surveyTakenDate =
new Date();
111 surveyTakenDate.setTime(surveyTakenTime);
113 var futureDate =
new Date();
114 futureDate =
new Date();
115 futureDate.setTime(surveyTakenTime);
118 var futureMonthLag = surveyTakenDate.getUTCMonth() +
121 if (futureMonthLag >= 12) {
122 futureMonthLag -= 12;
124 futureDate.setUTCFullYear(futureDate.getUTCFullYear() + 1);
126 futureDate.setUTCMonth(futureMonthLag);
129 if (curDate.getTime() <= futureDate.getTime()) {
136 var firstSessionTime =
139 var firstSessionDate =
new Date();
140 firstSessionDate.setTime(firstSessionTime);
142 if (curDate.getUTCDate() == firstSessionDate.getUTCDate() &&
143 curDate.getUTCMonth() == firstSessionDate.getUTCMonth() &&
144 curDate.getUTCFullYear() == firstSessionDate.getUTCFullYear())
146 hasDateRequirements =
false;
157 this._mHasSessionRequirements =
true;
164 this._mHasRuntimeRequirements =
true;
167 if (this._mHasSessionRequirements &&
168 this._mHasRuntimeRequirements)
176 if (hasDateRequirements) {
178 setTimeout(
function() {
self._showSurvey(); }, 10000);
182 gObserverService.addObserver(
this,
"quit-application-granted",
false);
186 _showSurvey:
function()
188 var retVal = { shouldLoadSurvey:
false};
191 Components.classes[
"@mozilla.org/appshell/window-mediator;1"]
192 .getService(Components.interfaces.nsIWindowMediator);
194 var mainWin = winMediator.getMostRecentWindow(
"Songbird:Main");
195 if (mainWin && mainWin.window && mainWin.window.gBrowser) {
196 mainWin.openDialog(
"chrome://songbird/content/xul/feedbackDialog.xul",
198 "chrome,modal=yes,centerscreen,resizable=false",
204 if (retVal.shouldLoadSurvey) {
206 mainWin.window.gBrowser.loadURI(surveyURL,
null,
null,
null,
"_blank");
215 Components.classes[
"@mozilla.org/preferences-service;1"]
216 .getService(Components.interfaces.nsIPrefService);
220 prefService.savePrefFile(
null);
228 if (aTopic !=
"quit-application-granted")
235 if (!this._mHasRuntimeRequirements) {
236 var curTimespec =
new Date().getTime();
237 var elapsedTime = curTimespec - this._mAppStartTimespec;
240 "" + (this._mSavedTotalRuntime + elapsedTime));
243 if (!this._mHasSessionRequirements) {
248 gObserverService.removeObserver(
this,
"quit-application-granted");
253 if (!iid.equals(Components.interfaces.nsIObserver) &&
254 !iid.equals(Components.interfaces.nsISupports))
256 throw Components.results.NS_ERROR_NO_INTERFACE;
const PREF_DISABLE_FEEDBACK
const PREF_NEXT_FEEDBACK_MONTH_LAG
function getIntPrefValue(name, value)
function FeedbackDelegate()
sbOSDControlService prototype QueryInterface
function SBStringGetBrandBundle()
function SBString(aKey, aDefault, aStringBundle)
const PREF_MIN_TOTAL_RUNTIME
const PREF_DENIED_FEEDBACK
const PREF_MIN_APP_SESSIONS
const NEXT_FEEDBACK_MONTH_LAG
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
const PREF_FIRST_OPENED_DATE
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe