29 const Cc = Components.classes;
30 const Ci = Components.interfaces;
31 const Cr = Components.results;
32 const Cu = Components.utils;
34 Cu.import(
"resource://gre/modules/XPCOMUtils.jsm");
35 Cu.import(
"resource://app/jsmodules/SBJobUtils.jsm");
36 Cu.import(
"resource://app/jsmodules/SBTimer.jsm");
38 var SBLocalDatabaseMigrationUtils = {
39 baseHandlerContractID:
"@songbirdnest.com/Songbird/Library/LocalDatabase/Migration/Handler/"
45 SBLocalDatabaseMigrationUtils.BaseMigrationHandler =
function() {
46 SBJobUtils.JobBase.call(
this);
49 SBLocalDatabaseMigrationUtils.BaseMigrationHandler.prototype = {
50 __proto__ : SBJobUtils.JobBase.prototype,
53 [
Ci.sbIJobProgress,
Ci.sbIJobCancelable,
54 Ci.sbILocalDatabaseMigrationHandler,
Ci.nsIClassInfo]),
61 flags :
Ci.nsIClassInfo.MAIN_THREAD_ONLY,
67 Ci.sbILocalDatabaseMigrationHandler,
71 count.value = interfaces.length;
80 _notifyJobsTimer:
null,
82 startNotificationTimer:
function BaseMigrationHandler_startNotificationTimer(aTimeout) {
83 if(this._notifyJobsTimer) {
84 this._notifyJobsTimer.cancel();
85 this._notifyJobsTimer =
null;
88 if(aTimeout ==
null) {
93 function notifyListeners() {
94 self.notifyJobProgressListeners();
97 this._notifyJobsTimer =
new SBTimer(notifyListeners,
99 Ci.nsITimer.TYPE_REPEATING_SLACK);
102 stopNotificationTimer:
function BaseMigrationHandler_stopNotificationTimer() {
103 if(this._notifyJobsTimer) {
104 this._notifyJobsTimer.cancel();
105 this._notifyJobsTimer =
null;
113 if(this.migrationQuery) {
114 var executing = this.migrationQuery.isExecuting();
116 return Ci.sbIJobProgress.STATUS_RUNNING;
119 var complete = ( this.migrationQuery.getQueryCount() == 0 );
123 return Ci.sbIJobProgress.STATUS_SUCCEEDED;
126 return Ci.sbIJobProgress.STATUS_FAILED;
135 if(this.migrationQuery) {
136 return this.migrationQuery.currentQuery();
139 return this._progress;
143 if(this.migrationQuery && !this._total) {
147 this._total = this.migrationQuery.getQueryCount() + this.migrationQuery.currentQuery();
154 if(this.migrationQuery) {
158 return this._canCancel;
161 cancel:
function BaseMigrationHandler_cancel() {
162 if(this.migrationQuery) {
163 this.migrationQuery.abort();
171 createMigrationQuery:
function sbLibraryMigration_createMigrationQuery(aLibrary) {
172 var query =
Cc[
"@songbirdnest.com/Songbird/DatabaseQuery;1"]
173 .createInstance(
Ci.sbIDatabaseQuery);
174 query.databaseLocation = aLibrary.databaseLocation;
175 query.setDatabaseGUID(aLibrary.databaseGuid);
177 query.addQuery(
"begin");
180 query.addQuery(
"update library_metadata set value = '"
181 + this.toVersion +
"' where name = 'version'");
203 migrate :
function BaseMigrationHandler_migrate(aLibrary) {
204 throw Cr.NS_ERROR_NOT_IMPLEMENTED;
sbDeviceFirmwareAutoCheckForUpdate prototype flags
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
sbDeviceFirmwareAutoCheckForUpdate prototype getHelperForLanguage
sbDeviceFirmwareAutoCheckForUpdate prototype classID
sbDeviceFirmwareAutoCheckForUpdate prototype getInterfaces
sbDeviceFirmwareAutoCheckForUpdate prototype interfaces
classDescription implementationLanguage