2011-09-28 04:15:06 +09:00
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2012-01-26 10:40:08 +09:00
|
|
|
const EXT_PREFIX = 'extensions.uriloader@pdf.js';
|
|
|
|
const PDFJS_EVENT_ID = 'pdf.js.message';
|
2011-09-07 07:00:24 +09:00
|
|
|
let Cc = Components.classes;
|
|
|
|
let Ci = Components.interfaces;
|
|
|
|
let Cm = Components.manager;
|
|
|
|
let Cu = Components.utils;
|
|
|
|
|
2011-09-28 04:15:06 +09:00
|
|
|
Cu.import('resource://gre/modules/Services.jsm');
|
2011-09-07 07:00:24 +09:00
|
|
|
|
|
|
|
function log(str) {
|
2011-09-28 04:15:06 +09:00
|
|
|
dump(str + '\n');
|
|
|
|
}
|
2012-01-26 10:40:08 +09:00
|
|
|
|
|
|
|
|
2011-09-07 07:00:24 +09:00
|
|
|
function startup(aData, aReason) {
|
2011-09-28 04:15:06 +09:00
|
|
|
let manifestPath = 'chrome.manifest';
|
2011-10-31 21:18:30 +09:00
|
|
|
let manifest = Cc['@mozilla.org/file/local;1']
|
|
|
|
.createInstance(Ci.nsILocalFile);
|
2011-09-07 07:00:24 +09:00
|
|
|
try {
|
2011-10-31 21:18:30 +09:00
|
|
|
manifest.initWithPath(aData.installPath.path);
|
|
|
|
manifest.append(manifestPath);
|
|
|
|
Cm.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(manifest);
|
|
|
|
Services.prefs.setBoolPref('extensions.pdf.js.active', true);
|
2011-09-28 04:15:06 +09:00
|
|
|
} catch (e) {
|
2011-09-07 07:00:24 +09:00
|
|
|
log(e);
|
|
|
|
}
|
2011-09-28 04:15:06 +09:00
|
|
|
}
|
2011-09-07 07:00:24 +09:00
|
|
|
|
|
|
|
function shutdown(aData, aReason) {
|
2012-01-28 03:53:07 +09:00
|
|
|
if (Services.prefs.getBoolPref('extensions.pdf.js.active'))
|
2011-10-31 21:18:30 +09:00
|
|
|
Services.prefs.setBoolPref('extensions.pdf.js.active', false);
|
2011-09-28 04:15:06 +09:00
|
|
|
}
|
2011-09-07 07:00:24 +09:00
|
|
|
|
|
|
|
function install(aData, aReason) {
|
2011-10-31 21:18:30 +09:00
|
|
|
Services.prefs.setBoolPref('extensions.pdf.js.active', false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function uninstall(aData, aReason) {
|
|
|
|
Services.prefs.clearUserPref('extensions.pdf.js.active');
|
2012-01-26 10:40:08 +09:00
|
|
|
application.prefs.setValue(EXT_PREFIX + '.database', '{}');
|
2011-09-28 04:15:06 +09:00
|
|
|
}
|
2011-09-07 07:00:24 +09:00
|
|
|
|