25 const Cc = Components.classes;
26 const Ci = Components.interfaces;
27 const Cr = Components.results;
28 const Ce = Components.Exception;
29 const Cu = Components.utils;
34 Cu.import(
"resource://gre/modules/XPCOMUtils.jsm");
35 Cu.import(
"resource://app/jsmodules/ArrayConverter.jsm");
36 Cu.import(
"resource://app/jsmodules/WindowUtils.jsm");
37 Cu.import(
"resource://app/jsmodules/SBTimer.jsm");
38 Cu.import(
"resource://app/jsmodules/SBJobUtils.jsm");
41 SBJobUtils.JobBase.call(
this);
47 this._mlJobTimeoutTimer =
Cc[
"@mozilla.org/timer;1"]
48 .createInstance(
Ci.nsITimer);
52 __proto__: SBJobUtils.JobBase.prototype,
55 classID : Components.ID(
"e4fd9496-1dd1-11b2-93ca-d33e8cc507ba"),
56 contractID :
"@songbirdnest.com/Songbird/MetadataLookup/job;1",
58 [
Ci.sbIMetadataLookupJob,
Ci.sbIJobProgress,
Ci.sbIJobCancelable,
59 Ci.sbIJobProgressListener,
Ci.nsIClassInfo,
Ci.nsITimerCallback]),
62 _mlJobType :
Ci.sbIMetadataLookupJob.JOB_DISC_LOOKUP,
63 _mlJobTimedOut :
false,
67 return this._mlJobType;
71 return this._mlNumResults;
74 init:
function(jobType, status) {
75 this._mlJobType = jobType;
76 this._status = status;
79 this._mlJobTimeoutTimer.initWithCallback(
this,
JOB_TIMEOUT*1000,
80 Ci.nsITimer.TYPE_ONE_SHOT);
83 appendResult:
function(album) {
84 this._mlResults.push(album);
88 changeStatus:
function(status) {
89 if (this._mlJobTimedOut) {
90 Cc[
"@mozilla.org/consoleservice;1"].getService(
Ci.nsIConsoleService)
91 .logStringMessage(
"Attempted to change status on an " +
92 "already timed out lookup job.");
95 this._status = status;
96 this.notifyJobProgressListeners();
97 if (this._mlJobTimeoutTimer)
98 this._mlJobTimeoutTimer.cancel();
101 getMetadataResults:
function() {
102 return ArrayConverter.enumerator(this._mlResults);
108 if (this.status ==
Ci.sbIMetadataLookupJob.STATUS_RUNNING) {
110 this.changeStatus(
Ci.sbIMetadataLookupJob.STATUS_FAILED);
111 this._mlJobTimedOut =
true;
117 return XPCOMUtils.generateModule([
sbMLJob]);
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
TimerLoop prototype notify
sbDeviceFirmwareAutoCheckForUpdate prototype classID