firstRunEula.js
Go to the documentation of this file.
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4 //
5 // BEGIN SONGBIRD GPL
6 //
7 // This file is part of the Songbird web player.
8 //
9 // Copyright(c) 2005-2009 POTI, Inc.
10 // http://songbirdnest.com
11 //
12 // This file may be licensed under the terms of of the
13 // GNU General Public License Version 2 (the "GPL").
14 //
15 // Software distributed under the License is distributed
16 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
17 // express or implied. See the GPL for the specific language
18 // governing rights and limitations.
19 //
20 // You should have received a copy of the GPL along with this
21 // program. If not, go to http://www.gnu.org/licenses/gpl.html
22 // or write to the Free Software Foundation, Inc.,
23 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 // END SONGBIRD GPL
26 //
27  */
28 
34 //------------------------------------------------------------------------------
35 //------------------------------------------------------------------------------
36 //
37 // First-run wizard EULA widget services.
38 //
39 //------------------------------------------------------------------------------
40 //------------------------------------------------------------------------------
41 
42 //------------------------------------------------------------------------------
43 //
44 // First-run wizard EULA widget imported services.
45 //
46 //------------------------------------------------------------------------------
47 
48 // Songbird imports.
49 Components.utils.import("resource://app/jsmodules/DOMUtils.jsm");
50 Components.utils.import("resource://app/jsmodules/StringUtils.jsm");
51 
52 
53 //------------------------------------------------------------------------------
54 //
55 // First-run wizard EULA widget services defs.
56 //
57 //------------------------------------------------------------------------------
58 
59 // Component manager defs.
60 if (typeof(Cc) == "undefined")
61  var Cc = Components.classes;
62 if (typeof(Ci) == "undefined")
63  var Ci = Components.interfaces;
64 if (typeof(Cr) == "undefined")
65  var Cr = Components.results;
66 if (typeof(Cu) == "undefined")
67  var Cu = Components.utils;
68 
69 // DOM defs.
70 if (typeof(XUL_NS) == "undefined")
71  var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
72 
73 
74 //------------------------------------------------------------------------------
75 //
76 // First-run wizard EULA widget services configuration.
77 //
78 //------------------------------------------------------------------------------
79 
80 /*
81  * localeBundleDataLoadTimeout Timeout in milliseconds for loading the locale
82  * bundle data.
83  */
84 
86  languageNamesBundleURL: "chrome://global/locale/languageNames.properties",
87  regionNamesBundleURL: "chrome://global/locale/regionNames.properties",
88  localeBundleDataLoadTimeout: 15000
89 };
90 
91 
92 
93 //------------------------------------------------------------------------------
94 //
95 // First-run wizard EULA widget services.
96 //
97 //------------------------------------------------------------------------------
98 
106 function firstRunEULASvc(aWidget) {
107  this._widget = aWidget;
108 }
109 
110 // Define the object.
111 firstRunEULASvc.prototype = {
112  // Set the constructor.
114 
115  //
116  // Widget services fields.
117  //
118  // _cfg Widget services configuration.
119  // _widget First-run wizard EULA widget.
120  // _domEventListenerSet Set of DOM event listeners.
121  // _wizardElem First-run wizard element.
122  // _wizardPageElem First-run wizard EULA widget wizard page element.
123  // _perfTest We're doing perf testing so don't stop for user input
124  //
125  // _languageNamesBundle Language names string bundle.
126  // _regionNamesBundle Region names string bundle.
127  // _localeInfoTable Table of locale information.
128  // _localeInfoList Ordered list of locale information.
129  // _ignoreLocaleSelectEvents
130  // If true, ignore locale selection events.
131  // _currentLocale Current running application locale.
132  // _systemLocale System locale.
133  // _userSelectedLocale Locale selected by user.
134  // _appRestartRequired True if locale selection requires an application
135  // restart.
136  //
137  // _localeBundleRunning True if the locale bundle services are running.
138  // _localeBundle Locale bundle object.
139  // _localeBundleDataLoadComplete
140  // True if loading of locale bundle data is
141  // complete.
142  // _localeBundleDataLoadSucceeded
143  // True if loading of locale bundle data
144  // succeeded.
145  //
146 
147  _cfg: firstRunEULASvcCfg,
148  _widget: null,
149  _domEventListenerSet: null,
150  _wizardElem: null,
151  _wizardPageElem: null,
152  _perfTest : false,
153 
154  _languageNamesBundle: null,
155  _regionNamesBundle: null,
156  _localeInfoTable: null,
157  _localeInfoList: null,
158  _localeIgnoreSelectEvents: false,
159  _currentLocale: null,
160  _systemLocale: null,
161  _userSelectedLocale: null,
162  _appRestartRequired: false,
163 
164  _localeBundleRunning: false,
165  _localeBundle: null,
166  _localeBundleDataLoadComplete: false,
167  _localeBundleDataLoadSucceeded: false,
168 
169 
170  //----------------------------------------------------------------------------
171  //
172  // Widget services.
173  //
174  //----------------------------------------------------------------------------
175 
180  initialize: function firstRunEULASvc_initialize() {
181  var _this = this;
182  var func;
183 
184  // Create a DOM event listener set.
185  this._domEventListenerSet = new DOMEventListenerSet();
186 
187  // Get the first-run wizard and wizard page elements.
188  this._wizardPageElem = this._widget;
189  this._wizardElem = this._wizardPageElem.ownerDocument.documentElement;
190 
191  // Initialize the locale services.
192  this._localeInitialize();
193 
194  // Listen for page show and advanced events.
195  func = function() { _this._doPageShow(); };
196  this._domEventListenerSet.add(this._wizardPageElem,
197  "pageshow",
198  func,
199  false);
200  func = function(aEvent) { _this._doPageAdvanced(aEvent); };
201  this._domEventListenerSet.add(this._wizardPageElem,
202  "pageadvanced",
203  func,
204  false);
205 
206  // Attach an event listener to the Quit button.
207  func = function(aEvent) { firstRunWizard.doQuit(aEvent); };
208  this._domEventListenerSet.add(this._wizardPageElem,
209  "extra1",
210  func,
211  false);
212 
213  // Attach an event listener to the EULA browser.
214  func = function(aEvent) { _this._onContentClick(aEvent); };
215  this._domEventListenerSet.add(this._widget.eulaBrowser,
216  "click",
217  func,
218  false);
219 
220  // Initialize the perf services.
221  this._perfInitialize();
222  },
223 
224 
229  finalize: function firstRunEULASvc_finalize() {
230  // Finalize the locale services.
231  this._localeFinalize();
232 
233  // Remove DOM event listeners.
234  if (this._domEventListenerSet) {
235  this._domEventListenerSet.removeAll();
236  }
237  this._domEventListenerSet = null;
238 
239  // Clear object fields.
240  this._widget = null;
241  this._wizardElem = null;
242  this._wizardPageElem = null;
243  },
244 
245 
246  //----------------------------------------------------------------------------
247  //
248  // Widget event handling services.
249  //
250  //----------------------------------------------------------------------------
251 
256  doAcceptChanged: function firstRunEULASvc_doAcceptChanged() {
257  // Update the UI.
258  this._update();
259  },
260 
261 
266  _doPageShow: function firstRunEULASvc__doPageShow() {
267  // If the EULA has already been accepted or we're perf testing, skip the
268  // first-run wizard EULA page.
269  var eulaAccepted = Application.prefs.getValue("songbird.eulacheck", false);
270  if (eulaAccepted || this._perfTest) {
271  this._advance();
272  return;
273  }
274 
275  // Dispatch to the locale services.
276  this._localeDoPageShow();
277 
278  // Set the quit button label.
279  this._wizardElem.getButton("extra1").label =
280  SBString("first_run.quit");
281 
282  // Update the UI.
283  this._update();
284  },
285 
286 
293  _doPageAdvanced: function firstRunEULASvc__doPageAdvanced(aEvent) {
294  // Don't advance if EULA not accepted.
295  var eulaAccepted = Application.prefs.getValue("songbird.eulacheck", false);
296  var acceptCheckboxElem = this._getElement("accept_checkbox");
297  if (!eulaAccepted && !acceptCheckboxElem.checked) {
298  aEvent.preventDefault();
299  return;
300  }
301 
302  // Set the EULA accepted preference and flush to disk.
303  Application.prefs.setValue("songbird.eulacheck", true);
304  var prefService = Cc["@mozilla.org/preferences-service;1"]
305  .getService(Ci.nsIPrefService);
306  prefService.savePrefFile(null);
307 
308  // Dispatch event to the locale services.
309  this._localeDoPageAdvanced(aEvent);
310  },
311 
312 
317  _doConnectionReset: function firstRunLocaleSvc__doConnectionReset() {
318  // Re-initialize the locale bundle services.
319  this._localeBundleFinalize();
320  this._localeBundleInitialize();
321 
322  // Load the locale bundle. The loading shouldn't start until after the
323  // first time the first-run EULA page is shown.
324  this._localeBundleLoad();
325  },
326 
327 
331  _onContentClick: function(aEvent) {
332  try {
333  // If the event's target is a URL, pass that off to the external
334  // protocol handler service since our web browser isn't available
335  // during the eula stage$.
336  var targetURI = Cc["@mozilla.org/network/io-service;1"]
337  .getService(Ci.nsIIOService)
338  .newURI(aEvent.target, null, null);
339 
340  var extLoader = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
341  .getService(Ci.nsIExternalProtocolService);
342  extLoader.loadURI(targetURI, null);
343  aEvent.preventDefault();
344  }
345  catch (e) {
346  }
347  },
348 
349 
350  //----------------------------------------------------------------------------
351  //
352  // Widget locale services.
353  //
354  //----------------------------------------------------------------------------
355 
360  _localeInitialize: function firstRunEULASvc__localeInitialize() {
361  // Get the locale names string bundles.
362  var stringBundleService = Cc["@mozilla.org/intl/stringbundle;1"]
363  .getService(Ci.nsIStringBundleService);
364  this._languageNamesBundle =
365  stringBundleService.createBundle(this._cfg.languageNamesBundleURL);
366  this._regionNamesBundle =
367  stringBundleService.createBundle(this._cfg.regionNamesBundleURL);
368 
369  // Get the locale info.
370  this._getLocaleInfo();
371 
372  // Get the current locale.
373  var chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
374  .getService(Ci.nsIXULChromeRegistry);
375  this._currentLocale = chromeRegistry.getSelectedLocale("songbird");
376 
377  // Get the system locale.
378  var localeService = Cc["@mozilla.org/intl/nslocaleservice;1"]
379  .getService(Ci.nsILocaleService);
380  this._systemLocale = localeService.getApplicationLocale()
381  .getCategory("NSILOCALE_CTYPE");
382 
383  // Initialize the locale bundle services.
384  this._localeBundleInitialize();
385 
386  // Listen for first-run wizard connection reset events.
387  var _this = this;
388  var func = function() { return _this._doConnectionReset(); };
389  this._domEventListenerSet.add(firstRunWizard.wizardElem,
390  "firstRunConnectionReset",
391  func,
392  false);
393  },
394 
395 
400  _localeFinalize: function firstRunEULASvc__localeFinalize() {
401  // Finalize the locale bundle services.
402  this._localeBundleFinalize();
403 
404  // Clear object fields.
405  this._languageNamesBundle = null;
406  this._regionNamesBundle = null;
407  this._localeInfoTable = null;
408  this._localeInfoList = null;
409  this._currentLocale = null;
410  this._systemLocale = null;
411  this._userSelectedLocale = null;
412  },
413 
414 
419  _localeDoPageShow: function firstRunEULASvc__localeDoPageShow() {
420  // Start loading the locale bundle.
421  this._localeBundleStart();
422  },
423 
424 
431  _localeDoPageAdvanced:
432  function firstRunEULASvc__localeDoPageAdvanced(aEvent) {
433  // Get the selected locale tag.
434  var localeMenuListElem = this._getElement("locale_menulist");
435  var selectedLocaleTag = localeMenuListElem.value;
436 
437  // Switch to a new locale if necessary.
438  if (selectedLocaleTag != this._currentLocale) {
439  // Install the new locale and switch.
440  if (this._installLocale(selectedLocaleTag)) {
441  // Switch to the new locale.
442  switchLocale(selectedLocaleTag);
443 
444  // Set up to restart application or wizard.
445  if (this._appRestartRequired)
446  firstRunWizard.restartApp = true;
447  else
448  firstRunWizard.restartWizard = true;
449 
450  // Prevent wizard from advancing further.
451  aEvent.preventDefault();
452 
453  // Close the wizard.
454  document.defaultView.close();
455  }
456  }
457  },
458 
459 
464  localeDoSelect: function firstRunEULASvc_localeDoSelect() {
465  // Do nothing if ignoring selection events.
466  if (this._ignoreLocaleSelectEvents)
467  return;
468 
469  // Get the locale selected by the user.
470  var localeMenuListElem = this._getElement("locale_menulist");
471  this._userSelectedLocale = localeMenuListElem.value;
472  },
473 
474 
484  _installLocale: function firstRunEULASvc__installLocale(aLocaleTag) {
485  // Check if locale is already installed.
486  var chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
487  .getService(Ci.nsIToolkitChromeRegistry);
488  var installedLocaleEnum = chromeRegistry.getLocalesForPackage("songbird");
489  while (installedLocaleEnum.hasMore()) {
490  // Get the next installed locale info.
491  var installedLocaleTag = installedLocaleEnum.getNext();
492 
493  // Return if locale is installed.
494  if (aLocaleTag == installedLocaleTag) {
495  return true;
496  }
497  }
498 
499  // Can't install if no locale bundle exists.
500  if (!this._localeBundle)
501  return false;
502 
503  // Get the locale info. Can't install if locale is not in the locale
504  // bundle.
505  if (!(aLocaleTag in this._localeInfoTable))
506  return false;
507  var localeInfo = this._localeInfoTable[aLocaleTag];
508  if (!("bundleIndex" in localeInfo))
509  return false;
510  var bundleIndex = localeInfo.bundleIndex;
511 
512  // Set up to install the locale.
513  var bundleExtensionCount = this._localeBundle.bundleExtensionCount;
514  for (var i = 0; i < bundleExtensionCount; i++) {
515  this._localeBundle.setExtensionInstallFlag(i, false);
516  }
517  this._localeBundle.setExtensionInstallFlag(bundleIndex, true);
518 
519  // Install the locale.
520  var result = this._localeBundle.installFlaggedExtensions(window);
521  if (result == Ci.sbIBundle.BUNDLE_INSTALL_ERROR)
522  return false;
523 
524  // Check if an application restart is required.
525  if (this._localeBundle.restartRequired)
526  this._appRestartRequired = true;
527 
528  return true;
529  },
530 
531 
536  _localeUpdate: function firstRunEULASvc__localeUpdate() {
537  // Handle any connection errors.
538  //XXXeps ideally, we wouldn't handle non-connection errors as connection
539  //XXXeps errors.
540  if (this._localeBundleDataLoadComplete &&
541  !this._localeBundleDataLoadSucceeded) {
542  firstRunWizard.handleConnectionError();
543  }
544 
545  // Clear the locale menu popup.
546  var localeMenuPopupElem = this._getElement("locale_menupopup");
547  while (localeMenuPopupElem.hasChildNodes()) {
548  localeMenuPopupElem.removeChild(localeMenuPopupElem.firstChild);
549  }
550 
551  // Fill the locale menu popup.
552  for (var i = 0; i < this._localeInfoList.length; i++) {
553  // Get the next locale info.
554  var localeInfo = this._localeInfoList[i];
555 
556  // Create a locale menu item.
557  var menuItemElem = document.createElementNS(XUL_NS, "menuitem");
558  menuItemElem.setAttribute("label", localeInfo.displayName);
559  menuItemElem.setAttribute("value", localeInfo.tag);
560 
561  // Add the locale menu item.
562  localeMenuPopupElem.appendChild(menuItemElem);
563  }
564 
565  // Determine the selected locale.
566  var selectedLocale = this._findMatchingLocaleTag(this._userSelectedLocale);
567  if (!selectedLocale)
568  selectedLocale = this._findMatchingLocaleTag(this._systemLocale);
569  if (!selectedLocale)
570  selectedLocale = this._findMatchingLocaleTag(this._currentLocale);
571 
572  // Set the selected locale.
573  var localeMenuListElem = this._getElement("locale_menulist");
574  this._ignoreLocaleSelectEvents = true;
575  if (selectedLocale)
576  localeMenuListElem.value = selectedLocale;
577  else
578  localeMenuListElem.selectedIndex = 0;
579  this._ignoreLocaleSelectEvents = false;
580  },
581 
582 
587  _getLocaleInfo: function firstRunEULASvc__getLocaleInfo() {
588  // Clear the locale info table.
589  this._localeInfoTable = {};
590 
591  // Get info for all installed locales.
592  var chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
593  .getService(Ci.nsIToolkitChromeRegistry);
594  var localeEnum = chromeRegistry.getLocalesForPackage("songbird");
595  while (localeEnum.hasMore())
596  {
597  // Get the locale info.
598  var tag = localeEnum.getNext();
599  var displayName = this._getLocaleDisplayName(tag);
600 
601  // Add the locale info.
602  var localeInfo = { tag: tag, displayName: displayName };
603  this._localeInfoTable[tag] = localeInfo;
604  }
605 
606  // Get info for the locale bundle.
607  if (this._localeBundle) {
608  var bundleExtensionCount = this._localeBundle.bundleExtensionCount;
609  for (var i = 0; i < bundleExtensionCount; i++) {
610  // Get the next locale info in the bundle.
611  var tag = this._localeBundle.getExtensionAttribute(i, "languageTag");
612  var displayName = this._localeBundle.getExtensionAttribute(i, "name");
613 
614  // Add the locale info.
615  var localeInfo = { tag: tag, displayName: displayName, bundleIndex: i };
616  this._localeInfoTable[tag] = localeInfo;
617  }
618  }
619 
620  // Create an ordered locale info list.
621  this._localeInfoList = [];
622  for (var localeTag in this._localeInfoTable) {
623  this._localeInfoList.push(this._localeInfoTable[localeTag]);
624  }
625 
626  // Sort the ordered locale info list by display name.
627  var sortFunc = function(a, b) {
628  if (a.displayName > b.displayName)
629  return 1;
630  if (a.displayName < b.displayName)
631  return -1;
632  return 0;
633  }
634  this._localeInfoList.sort(sortFunc);
635  },
636 
637 
650  _findMatchingLocaleTag:
651  function firstRunEULASvc__findMatchingLocaleTag(aLocaleTag) {
652  // Return null if no locale tag specified.
653  if (!aLocaleTag)
654  return null;
655 
656  // Return the locale tag if it's in the locale info table.
657  if (aLocaleTag in this._localeInfoTable)
658  return aLocaleTag;
659 
660  // Return the locale language tag if it's in the locale info table.
661  var languageTag = aLocaleTag.split("-")[0];
662  if (languageTag in this._localeInfoTable)
663  return languageTag;
664 
665  return null;
666  },
667 
668 
677  _getLocaleDisplayName:
678  function firstRunEULASvc__getLocaleDisplayName(aLocaleTag) {
679  // Get the locale language and region tags.
680  var localeTagPartList = aLocaleTag.split("-");
681  var languageTag = localeTagPartList[0];
682  var regionTag = "";
683  if (localeTagPartList.length > 1)
684  regionTag = localeTagPartList[1];
685 
686  // Get the language and region display names.
687  var languageDisplayName = SBString(languageTag,
688  "",
689  this._languageNamesBundle);
690  var regionDisplayName = "";
691  if (regionTag)
692  regionDisplayName = SBString(regionTag, "", this._regionNamesBundle);
693 
694  // Get the locale display name.
695  var localeDisplayName = "";
696  if (languageDisplayName && regionDisplayName) {
697  localeDisplayName = SBFormattedString
698  ("locale.language_region.display_name",
699  [ languageDisplayName, regionDisplayName ],
700  "");
701  } else if (languageDisplayName) {
702  localeDisplayName = SBFormattedString
703  ("locale.language.display_name",
704  [ languageDisplayName ],
705  "");
706  }
707  if (!localeDisplayName)
708  localeDisplayName = aLocaleTag;
709 
710  return localeDisplayName;
711  },
712 
713 
714  //----------------------------------------------------------------------------
715  //
716  // sbIBundleDataListener services.
717  //
718  //----------------------------------------------------------------------------
719 
727  onDownloadComplete: function firstRunEULASvc__onDownloadComplete(aBundle) {
728  this._localeBundleDataLoadComplete = true;
729  this._localeBundleDataLoadSucceeded = true;
730  this._getLocaleInfo();
731  this._update();
732  },
733 
734 
742  onError: function firstRunEULASvc__onError(aBundle) {
743  this._localeBundleDataLoadComplete = true;
744  this._localeBundleDataLoadSucceeded = false;
745  this._update();
746  },
747 
748 
749  //----------------------------------------------------------------------------
750  //
751  // Widget locale bundle services.
752  //
753  //----------------------------------------------------------------------------
754 
759  _localeBundleInitialize:
760  function firstRunEULASvc__localeBundleInitialize() {
761  // Initialize the locale bundle fields.
762  this._localeBundle = null;
763  this._localeBundleDataLoadComplete = false;
764  this._localeBundleDataLoadSucceeded = false;
765  },
766 
767 
772  _localeBundleFinalize:
773  function firstRunEULASvc__localeBundleFinalize() {
774  // Finalize locale bundle.
775  //XXXeps need way to cancel it.
776  if (this._localeBundle)
777  this._localeBundle.removeBundleDataListener(this);
778 
779  // Reset the locale bundle fields.
780  this._localeBundleDataLoadComplete = false;
781  this._localeBundleDataLoadSucceeded = false;
782 
783  // Clear locale bundle object fields.
784  this._localeBundle = null;
785  },
786 
787 
792  _localeBundleStart: function firstRunEULASvc__localeBundleStart() {
793  // Mark the locale bundle services running and load the locale bundle.
794  this._localeBundleRunning = true;
795  this._localeBundleLoad();
796  },
797 
798 
803  _localeBundleLoad: function firstRunEULASvc__localeBundleLoad() {
804  // Do nothing if not running.
805  if (!this._localeBundleRunning)
806  return;
807 
808  // Start loading the locale bundle data.
809  if (!this._localeBundle) {
810  // Set up the locale bundle for loading.
811  this._localeBundle = Cc["@songbirdnest.com/Songbird/Bundle;1"]
812  .createInstance(Ci.sbIBundle);
813  this._localeBundle.bundleId = "locales";
814  this._localeBundle.bundleURL =
815  Application.prefs.getValue("songbird.url.locales", "default");
816  this._localeBundle.addBundleDataListener(this);
817 
818  // Start loading the locale bundle data.
819  try {
820  this._localeBundle.retrieveBundleData
821  (this._cfg.localeBundleDataLoadTimeout);
822  } catch (ex) {
823  // Report the exception as an error.
824  Components.utils.reportError(ex);
825 
826  // Indicate that the locale bundle loading failed.
827  this._localeBundleDataLoadComplete = true;
828  this._localeBundleDataLoadSucceeded = false;
829  }
830  }
831  },
832 
833 
838  _localeBundleLoadCancel:
839  function firstRunEULASvc__localeBundleLoadCancel() {
840  // Finalize locale bundle.
841  //XXXeps need way to cancel it.
842  if (this._localeBundle)
843  this._localeBundle.removeBundleDataListener(this);
844  },
845 
846 
847  //----------------------------------------------------------------------------
848  //
849  // Widget perf services.
850  //
851  //----------------------------------------------------------------------------
852 
857  _perfInitialize: function firstRunEULASvc__perfInitialize() {
858  // Get the perf test setting.
859  this._perfTest = window.arguments[0].perfTest;
860 
861  try
862  {
868  var timingService = Cc["@songbirdnest.com/Songbird/TimingService;1"]
869  .getService(Ci.sbITimingService);
870  timingService.startPerfTimer("CSPerfEULA");
871  timingService.stopPerfTimer("CSPerfEULA");
872  }
873  catch (e)
874  {
875  // Ignore errors
876  }
877  if (this._perfTest) {
878  var acceptCheckboxElem = this._getElement("accept_checkbox");
879  acceptCheckboxElem.checked = true;
880  this._update();
881  }
882  },
883 
884 
885  //----------------------------------------------------------------------------
886  //
887  // Internal widget services.
888  //
889  //----------------------------------------------------------------------------
890 
895  _update: function firstRunEULASvc__update() {
896  // Do nothing if wizard page is not being shown.
897  if (this._wizardElem.currentPage != this._wizardPageElem)
898  return;
899 
900  // If the EULA has already been accepted or we're perf testing, skip the
901  // first-run wizard EULA page.
902  var eulaAccepted = Application.prefs.getValue("songbird.eulacheck", false);
903  if (eulaAccepted || this._perfTest) {
904  this._advance();
905  return;
906  }
907 
908  // Update the locale UI.
909  this._localeUpdate();
910 
911  // Only allow the first-run wizard to advance if the accept EULA checkbox is
912  // checked.
913  var acceptCheckboxElem = this._getElement("accept_checkbox");
914  this._wizardElem.canAdvance = acceptCheckboxElem.checked;
915  },
916 
917 
923  _advance: function firstRunEULASvc__advance() {
924  // Only advance if this wizard page is the current wizard page.
925  if (this._wizardElem.currentPage == this._wizardPageElem) {
926  this._wizardElem.canAdvance = true;
927  this._wizardElem.advance();
928  }
929  },
930 
931 
941  _getElement: function firstRunEULASvc__getElement(aElementID) {
942  return document.getAnonymousElementByAttribute(this._widget,
943  "anonid",
944  aElementID);
945  }
946 };
947 
const Cu
function Fx prototype initialize
const Cc
var Application
Definition: sbAboutDRM.js:37
const XUL_NS
Definition: FeedWriter.js:83
function SBFormattedString(aKey, aParams, aDefault, aStringBundle)
function DOMEventListenerSet()
Definition: DOMUtils.jsm:766
function SBString(aKey, aDefault, aStringBundle)
Definition: StringUtils.jsm:93
let window
DataRemote prototype constructor
var _this
function firstRunEULASvc(aWidget)
return null
Definition: FeedWriter.js:1143
const Cr
const Ci
dataSBGenres SBProperties tag
Definition: tuner2.js:871
_getSelectedPageStyle s i
var firstRunEULASvcCfg
Definition: firstRunEula.js:85