~ubuntu-branches/ubuntu/utopic/ubufox/utopic-proposed

« back to all changes in this revision

Viewing changes to res/pfs-providers/PFS.jsm

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-11-12 13:27:26 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20121112132726-ssrixfmjgibo8f3s
Tags: 2.6-0ubuntu1
* New upstream release.
  - Translation updates, thanks to Adolfo Jayme Barrientos and David Planella

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 *
39
39
 * ***** END LICENSE BLOCK ***** */
40
40
 
41
 
const Cu = Components.utils;
42
 
const Cc = Components.classes;
43
 
const Ci = Components.interfaces;
 
41
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
44
42
 
45
43
const nsIHttpProtocolHandler  = Ci.nsIHttpProtocolHandler;
46
44
const nsIXULChromeRegistry    = Ci.nsIXULChromeRegistry;
54
52
 
55
53
const PFS_NS = "http://www.mozilla.org/2004/pfs-rdf#";
56
54
 
57
 
var EXPORTED_SYMBOLS = [ ];
 
55
var EXPORTED_SYMBOLS = [];
58
56
 
59
57
Cu.import("resource://ubufox/modules/PluginFinder.jsm");
60
58
Cu.import("resource://ubufox/modules/Distro.jsm");
61
59
Cu.import("resource://gre/modules/Services.jsm");
62
 
 
63
 
["LOG", "WARN", "ERROR"].forEach(function(aName) {
64
 
  this.__defineGetter__(aName, function() {
65
 
    Components.utils.import("resource://gre/modules/AddonLogging.jsm");
66
 
 
67
 
    LogManager.getLogger("ubufox.pluginprovider.pfs", this);
68
 
    return this[aName];
69
 
  });
70
 
}, this);
 
60
Cu.import("resource://ubufox/modules/utils.jsm");
 
61
 
 
62
addLogger(this, "plugin-finder.provider.pfs");
71
63
 
72
64
function getPluginInfoRequestObserver(aMimeType, aListener) {
73
65
  this.mimetype = aMimeType;
87
79
  
88
80
  onError: function(aSink, aStatus, aErrorMsg) {  
89
81
    aSink.removeXMLSinkObserver(this);   
90
 
    PluginProviderPFS.onDataSourceError(aStatus.toString(), this.mimetype, this.listener);
 
82
    PluginProviderPFS.onDataSourceError(aStatus.toString(), this.listener);
91
83
  }
92
84
};
93
85
 
94
86
var PluginProviderPFS = {
 
87
  __exposedProps__: ["getPluginInfo", "name"],
 
88
 
 
89
  name: "PFS",
 
90
 
95
91
  get clientOS() {
96
92
    if (!this._clientOS) {
97
93
      this._clientOS = Cc["@mozilla.org/network/protocol;1?name=http"]
128
124
      uri = distro.PFSURI;
129
125
    }
130
126
    if (!uri) {
131
 
      this.onDataSourceError("No PFS URL", aMimeType, aListener);
 
127
      this.onDataSourceError("No PFS URL", aListener);
132
128
      return;
133
129
    }
134
130
 
246
242
            pluginInfos.push(pluginInfo);
247
243
          }
248
244
        }       catch (ex) {
249
 
          Cu.reportError(ex);
 
245
          ERROR(ex);
250
246
        }
251
247
      }
252
248
    } catch (ex) {
253
 
      Cu.reportError(ex);
 
249
      ERROR(ex);
254
250
    }
255
251
 
256
252
    aListener.pluginInfoReceived(pluginInfos);
257
253
  },
258
254
 
259
 
  onDataSourceError: function PPPFS_onDatasourceError(aError, aMimeType, aListener) {
260
 
    ERROR(aError + " whilst handling request for mimetype " + aMimeType);
 
255
  onDataSourceError: function PPPFS_onDatasourceError(aError, aListener) {
261
256
    aListener.providerErrorReceived(aError);
262
257
  }
263
258
};
264
259
 
265
 
var PluginProviderIface = {
266
 
  getPluginInfo: function PFI_getPluginInfo(aMimeType, aListener) {
267
 
    PluginProviderPFS.getPluginInfo(aMimeType, aListener);
268
 
  }
269
 
};
270
 
 
271
 
PluginFinder.registerProvider(PluginProviderIface);
 
260
PluginFinder.registerProvider(SimpleObjectWrapper(PluginProviderPFS));