nsMicrosummaryService

nsMicrosummaryService - //@line 41

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //@line 41 "e:\builds\moz2_slave\win32_build\build\browser\components\microsummaries\src\nsMic rosummaryService.js" const Cc = Components.classes; const Ci = Components.interfaces; const Cr = Components.results; const Cu = Components.utils; const PERMS_FILE = 0644; const MODE_WRONLY = 0x02; const MODE_CREATE = 0x08; const MODE_TRUNCATE = 0x20; const NS_ERROR_MODULE_DOM = 2152923136; const NS_ERROR_DOM_BAD_URI = NS_ERROR_MODULE_DOM + 1012; // How often to check for microsummaries that need updating, in milliseconds. const CHECK_INTERVAL = 15 * 1000; // 15 seconds // How often to check for generator updates, in seconds const GENERATOR_INTERVAL = 7 * 86400; // 1 week const MICSUM_NS = "http://www.mozilla.org/microsummaries/0.1"; const XSLT_NS = "http://www.w3.org/1999/XSL/Transform"; const ANNO_MICSUM_GEN_URI = "microsummary/generatorURI"; const ANNO_MICSUM_EXPIRATION = "microsummary/expiration"; const ANNO_STATIC_TITLE = "bookmarks/staticTitle"; const ANNO_CONTENT_TYPE = "bookmarks/contentType"; const MAX_SUMMARY_LENGTH = 4096; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); function MicrosummaryService() { this._obs.addObserver(this, "xpcom-shutdown", true); this._ans.addObserver(this, false); Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefService). getBranch("browser.microsummary."). QueryInterface(Ci.nsIPrefBranch2). addObserver("", this, true); this._initTimers(); this._cacheLocalGenerators(); } MicrosummaryService.prototype = { // Bookmarks Service get _bms() { var svc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. getService(Ci.nsINavBookmarksService); this.__defineGetter__("_bms", function() svc); return this._bms; }, // Annotation Service get _ans() { var svc = Cc["@mozilla.org/browser/annotation-service;1"]. getService(Ci.nsIAnnotationService); this.__defineGetter__("_ans", function() svc); return this._ans; }, // IO Service get _ios() { var svc = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService); this.__defineGetter__("_ios", function() svc); return this._ios; }, // Observer Service get _obs() { var svc = Cc["@mozilla.org/observer-service;1"]. getService(Ci.nsIObserverService); this.__defineGetter__("_obs", function() svc); return this._obs; }, /** * Make a URI from a spec. * @param spec * The string spec of the URI. * @returns An nsIURI object. */ _uri: function MSS__uri(spec) { return this._ios.newURI(spec, null, null); }, // Directory Locator __dirs: null, get _dirs() { if (!this.__dirs) this.__dirs = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties); return this.__dirs; }, // The update interval as specified by the user (defaults to 30 minutes) get _updateInterval() { var updateInterval = getPref("browser.microsummary.updateInterval", 30); // the minimum update interval is 1 minute return Math.max(updateInterval, 1) * 60 * 1000; }, // A cache of local microsummary generators. This gets built on startup // by the _cacheLocalGenerators() method....
View Full Document

This note was uploaded on 03/11/2010 for the course ISD 125 taught by Professor 3ant during the Spring '10 term at École Normale Supérieure.

Page1 / 39

nsMicrosummaryService - //@line 41

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online