зеркало из https://github.com/mozilla/pjs.git
OK, merge back changes from the branch. for real this time
This commit is contained in:
Родитель
151854f257
Коммит
c796864323
|
@ -0,0 +1,46 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -0,0 +1,120 @@
|
|||
|
||||
function EM_NS(aProperty)
|
||||
{
|
||||
return "http://www.mozilla.org/2004/em-rdf#" + aProperty;
|
||||
}
|
||||
|
||||
var gExtensionID = "";
|
||||
var gExtensionDB = null;
|
||||
|
||||
function init()
|
||||
{
|
||||
gExtensionID = window.arguments[0];
|
||||
gExtensionDB = window.arguments[1];
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
|
||||
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var extension = rdfs.GetResource(gExtensionID);
|
||||
|
||||
// Name
|
||||
var nameArc = rdfs.GetResource(EM_NS("name"));
|
||||
var name = gExtensionDB.GetTarget(extension, nameArc, true);
|
||||
name = name.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
// Version
|
||||
var versionArc = rdfs.GetResource(EM_NS("version"));
|
||||
var version = gExtensionDB.GetTarget(extension, versionArc, true);
|
||||
version = version.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
// Description
|
||||
var descriptionArc = rdfs.GetResource(EM_NS("description"));
|
||||
var description = gExtensionDB.GetTarget(extension, descriptionArc, true);
|
||||
if (description)
|
||||
description = description.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
// Home Page URL
|
||||
var homepageArc = rdfs.GetResource(EM_NS("homepageURL"));
|
||||
var homepage = gExtensionDB.GetTarget(extension, homepageArc, true);
|
||||
if (homepage)
|
||||
homepage = homepage.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
|
||||
// Creator
|
||||
var creatorArc = rdfs.GetResource(EM_NS("creator"));
|
||||
var creator = gExtensionDB.GetTarget(extension, creatorArc, true);
|
||||
if (creator)
|
||||
creator = creator.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
|
||||
document.documentElement.setAttribute("title", extensionsStrings.getFormattedString("aboutWindowTitle", [name]));
|
||||
var extensionName = document.getElementById("extensionName");
|
||||
extensionName.setAttribute("value", name);
|
||||
var extensionVersion = document.getElementById("extensionVersion");
|
||||
extensionVersion.setAttribute("value", extensionsStrings.getFormattedString("aboutWindowVersionString", [version]));
|
||||
|
||||
var extensionDescription = document.getElementById("extensionDescription");
|
||||
extensionDescription.appendChild(document.createTextNode(description));
|
||||
|
||||
var extensionCreator = document.getElementById("extensionCreator");
|
||||
extensionCreator.setAttribute("value", creator);
|
||||
|
||||
var extensionHomepage = document.getElementById("extensionHomepage");
|
||||
if (homepage) {
|
||||
extensionHomepage.setAttribute("href", homepage);
|
||||
extensionHomepage.setAttribute("tooltiptext", homepage);
|
||||
}
|
||||
else
|
||||
extensionHomepage.hidden = true;
|
||||
|
||||
var contributorsBox = document.getElementById("contributorsBox");
|
||||
var contributorsArc = rdfs.GetResource(EM_NS("contributor"));
|
||||
var contributors = gExtensionDB.GetTargets(extension, contributorsArc, true);
|
||||
var count = 0;
|
||||
while (contributors.hasMoreElements()) {
|
||||
var contributor = contributors.getNext().QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
var label = document.createElement("label");
|
||||
label.setAttribute("value", contributor);
|
||||
label.setAttribute("class", "contributor");
|
||||
contributorsBox.appendChild(label);
|
||||
++count;
|
||||
}
|
||||
if (count == 0)
|
||||
document.getElementById("extensionContributors").hidden = true;
|
||||
|
||||
var acceptButton = document.documentElement.getButton("accept");
|
||||
acceptButton.label = extensionsStrings.getString("aboutWindowCloseButton");
|
||||
}
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/skin/extensions/about.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://mozapps/locale/extensions/about.dtd">
|
||||
|
||||
<dialog id="genericAbout"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept" onload="init();" onaccept="close();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/extensions/about.js"/>
|
||||
|
||||
<stringbundleset id="aboutSet">
|
||||
<stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<vbox id="clientBox" flex="1">
|
||||
<label id="extensionName" crop="right"/>
|
||||
<label id="extensionVersion" crop="right"/>
|
||||
<description id="extensionDescription"/>
|
||||
|
||||
<label id="extensionCreatorLabel">&creator.label;</label>
|
||||
<hbox id="creatorBox">
|
||||
<label id="extensionCreator" flex="1" crop="right"/>
|
||||
<label id="extensionHomepage" onclick="window.opener.openURL(event.target.getAttribute('href'));">&homepage.label;</label>
|
||||
</hbox>
|
||||
|
||||
<label id="extensionContributors">&contributors.label;</label>
|
||||
<vbox flex="1" id="contributorsBox"/>
|
||||
</vbox>
|
||||
|
||||
<separator id="groove" class="groove"/>
|
||||
|
||||
</dialog>
|
||||
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
view {
|
||||
-moz-binding: url("chrome://mozapps/skin/shared/richview.xml#richview");
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
extension {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension");
|
||||
-moz-box-orient: vertical;
|
||||
}
|
||||
|
||||
extension[state="waiting"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-waiting");
|
||||
}
|
||||
|
||||
extension[state="downloading"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-downloading");
|
||||
}
|
||||
|
||||
extension[state="installing"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-installing");
|
||||
}
|
||||
|
||||
extension[state="done"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-done");
|
||||
}
|
||||
|
||||
extension[toBeDisabled="true"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-tobedisabled");
|
||||
}
|
||||
|
||||
extension[toBeEnabled="true"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-tobeenabled");
|
||||
}
|
||||
|
||||
extension[toBeInstalled="true"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-tobeinstalled");
|
||||
}
|
||||
|
||||
extension[toBeUninstalled="true"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#extension-tobeuninstalled");
|
||||
}
|
||||
|
||||
|
||||
|
||||
extension[itemType="theme"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#theme");
|
||||
}
|
||||
|
||||
extension[itemType="theme"][state="waiting"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#theme-waiting");
|
||||
}
|
||||
|
||||
extension[itemType="theme"][state="downloading"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#theme-downloading");
|
||||
}
|
||||
|
||||
extension[itemType="theme"][state="installing"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#theme-installing");
|
||||
}
|
||||
|
||||
extension[itemType="theme"][state="done"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#theme-done");
|
||||
}
|
||||
|
||||
.themePreviewArea {
|
||||
width: 0px;
|
||||
}
|
||||
|
|
@ -0,0 +1,830 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Globals
|
||||
|
||||
const kObserverServiceProgID = "@mozilla.org/observer-service;1";
|
||||
const nsIUpdateItem = Components.interfaces.nsIUpdateItem;
|
||||
|
||||
var gExtensionManager = null;
|
||||
var gExtensionsView = null;
|
||||
var gWindowState = "";
|
||||
var gURIPrefix = ""; // extension or theme prefix
|
||||
var gDSRoot = ""; // extension or theme root
|
||||
var gGetMoreURL = "";
|
||||
var gCurrentTheme = "";
|
||||
var gDownloadManager = null;
|
||||
var gObserverIndex = -1;
|
||||
|
||||
const PREF_APP_ID = "app.id";
|
||||
const PREF_EXTENSIONS_GETMORETHEMESURL = "extensions.getMoreThemesURL";
|
||||
const PREF_EXTENSIONS_GETMOREEXTENSIONSURL = "extensions.getMoreExtensionsURL";
|
||||
const PREF_EM_LAST_SELECTED_SKIN = "extensions.lastSelectedSkin";
|
||||
const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Utility Functions
|
||||
function stripPrefix(aResourceURI)
|
||||
{
|
||||
return aResourceURI.substr(gURIPrefix.length, aResourceURI.length);
|
||||
}
|
||||
|
||||
function openURL(aURL)
|
||||
{
|
||||
# If we're not a browser, use the external protocol service to load the URI.
|
||||
#ifndef MOZ_PHOENIX
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = aURL;
|
||||
|
||||
var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
|
||||
.getService(Components.interfaces.nsIExternalProtocolService);
|
||||
protocolSvc.loadUrl(uri);
|
||||
# If we're a browser, open a new browser window instead.
|
||||
#else
|
||||
openDialog("chrome://browser/content/browser.xul", "_blank", "chrome,all,dialog=no", aURL, null, null);
|
||||
#endif
|
||||
}
|
||||
|
||||
function flushDataSource()
|
||||
{
|
||||
var rds = gExtensionManager.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
if (rds)
|
||||
rds.Flush();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Event Handlers
|
||||
function onExtensionSelect(aEvent)
|
||||
{
|
||||
if (aEvent.target.selected)
|
||||
aEvent.target.setAttribute("last-selected", aEvent.target.selected.id);
|
||||
else
|
||||
aEvent.target.removeAttribute("last-selected");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Startup, Shutdown
|
||||
function Startup()
|
||||
{
|
||||
gWindowState = window.location.search.substr("?type=".length, window.location.search.length);
|
||||
|
||||
var isExtensions = gWindowState == "extensions";
|
||||
gURIPrefix = isExtensions ? "urn:mozilla:extension:" : "urn:mozilla:theme:";
|
||||
gDSRoot = isExtensions ? "urn:mozilla:extension:root" : "urn:mozilla:theme:root";
|
||||
|
||||
document.documentElement.setAttribute("windowtype", document.documentElement.getAttribute("windowtype") + "-" + gWindowState);
|
||||
|
||||
gExtensionsView = document.getElementById("extensionsView");
|
||||
gExtensionsView.setAttribute("state", gWindowState);
|
||||
gExtensionManager = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Components.interfaces.nsIExtensionManager);
|
||||
|
||||
// Extension Command Updating is handled by a command controller.
|
||||
gExtensionsView.controllers.appendController(gExtensionsViewController);
|
||||
|
||||
// This persists the last-selected extension
|
||||
gExtensionsView.addEventListener("richview-select", onExtensionSelect, false);
|
||||
|
||||
// Finally, update the UI.
|
||||
gExtensionsView.database.AddDataSource(gExtensionManager.datasource);
|
||||
gExtensionsView.setAttribute("ref", gDSRoot);
|
||||
gExtensionsView.focus();
|
||||
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
if (!isExtensions) {
|
||||
gExtensionsView.addEventListener("richview-select", onThemeSelect, false);
|
||||
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Components.interfaces.nsIXULChromeRegistry);
|
||||
gCurrentTheme = cr.getSelectedSkin("global");
|
||||
|
||||
var useThemeButton = document.getElementById("useThemeButton");
|
||||
useThemeButton.hidden = false;
|
||||
}
|
||||
|
||||
// Restore the last-selected extension
|
||||
var lastSelected = gExtensionsView.getAttribute("last-selected");
|
||||
if (lastSelected != "")
|
||||
lastSelected = document.getElementById(lastSelected);
|
||||
if (!lastSelected)
|
||||
gExtensionsView.selectionForward();
|
||||
else
|
||||
gExtensionsView.selected = lastSelected;
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
document.documentElement.setAttribute("title", extensionsStrings.getString(gWindowState + "Title"));
|
||||
|
||||
gExtensionsViewController.onCommandUpdate();
|
||||
|
||||
gGetMoreURL = pref.getComplexValue(isExtensions ? PREF_EXTENSIONS_GETMOREEXTENSIONSURL
|
||||
: PREF_EXTENSIONS_GETMORETHEMESURL,
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
gGetMoreURL = gGetMoreURL.replace(/%APPID%/g, pref.getCharPref(PREF_APP_ID));
|
||||
// Update various pieces of state-dependant UI
|
||||
var getMore = document.getElementById("getMore");
|
||||
getMore.setAttribute("value", getMore.getAttribute(isExtensions ? "valueextensions" : "valuethemes"));
|
||||
getMore.setAttribute("tooltiptext", getMore.getAttribute(isExtensions ? "tooltiptextextensions" : "tooltiptextthemes"));
|
||||
|
||||
if (!isExtensions) {
|
||||
var themePreviewArea = document.getElementById("themePreviewArea");
|
||||
themePreviewArea.hidden = false;
|
||||
gExtensionsView.removeAttribute("flex");
|
||||
}
|
||||
|
||||
// Set Initial Size
|
||||
var win = document.documentElement;
|
||||
if (!win.hasAttribute("width") || !win.hasAttribute("height")) {
|
||||
win.setAttribute("width", isExtensions ? 400 : 500);
|
||||
win.setAttribute("height", isExtensions ? 300 : 380);
|
||||
}
|
||||
|
||||
// Now look and see if we're being opened by XPInstall
|
||||
var gDownloadManager = new XPInstallDownloadManager();
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.addObserver(gDownloadManager, "xpinstall-download-started", false);
|
||||
|
||||
gObserverIndex = gExtensionManager.addDownloadObserver(gDownloadManager);
|
||||
|
||||
if ("arguments" in window) {
|
||||
try {
|
||||
var params = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
gDownloadManager.addDownloads(params);
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
}
|
||||
|
||||
function Shutdown()
|
||||
{
|
||||
if (gWindowState != "extensions")
|
||||
gExtensionsView.removeEventListener("richview-select", onThemeSelect, false);
|
||||
|
||||
gExtensionManager.removeDownloadObserverAt(gObserverIndex);
|
||||
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
if (gDownloadManager)
|
||||
os.removeObserver(gDownloadManager, "xpinstall-download-started");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// XPInstall
|
||||
//
|
||||
|
||||
function getURLSpecFromFile(aFile)
|
||||
{
|
||||
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var fph = ioServ.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
|
||||
return fph.getURLSpecFromFile(aFile);
|
||||
}
|
||||
|
||||
function XPInstallDownloadManager()
|
||||
{
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
this._statusFormatKBMB = extensionsStrings.getString("statusFormatKBMB");
|
||||
this._statusFormatKBKB = extensionsStrings.getString("statusFormatKBKB");
|
||||
this._statusFormatMBMB = extensionsStrings.getString("statusFormatMBMB");
|
||||
}
|
||||
|
||||
XPInstallDownloadManager.prototype = {
|
||||
_statusFormat : null,
|
||||
_statusFormatKBMB : null,
|
||||
_statusFormatKBKB : null,
|
||||
_statusFormatMBMB : null,
|
||||
|
||||
observe: function (aSubject, aTopic, aData)
|
||||
{
|
||||
switch (aTopic) {
|
||||
case "xpinstall-download-started":
|
||||
var params = aSubject.QueryInterface(Components.interfaces.nsISupportsArray);
|
||||
var paramBlock = params.GetElementAt(0).QueryInterface(Components.interfaces.nsISupportsInterfacePointer);
|
||||
paramBlock = paramBlock.data.QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
this.addDownloads(paramBlock);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
addDownloads: function (aParams)
|
||||
{
|
||||
var numXPInstallItems = aParams.GetInt(1);
|
||||
var isExtensions = gWindowState == "extensions";
|
||||
|
||||
var items = [];
|
||||
for (var i = 0; i < numXPInstallItems;) {
|
||||
var displayName = aParams.GetString(i++);
|
||||
var url = aParams.GetString(i++);
|
||||
var iconURL = aParams.GetString(i++);
|
||||
if (!iconURL) {
|
||||
iconURL = isExtensions ? "chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png" :
|
||||
"chrome://mozapps/skin/extensions/themeGeneric.png";
|
||||
}
|
||||
|
||||
var type = isExtensions ? nsIUpdateItem.TYPE_EXTENSION : nsIUpdateItem.TYPE_THEME;
|
||||
// gExtensionManager.addDownload(displayName, url, iconURL, type);
|
||||
var item = Components.classes["@mozilla.org/updates/item;1"]
|
||||
.createInstance(Components.interfaces.nsIUpdateItem);
|
||||
item.init(url, " ", displayName, -1, url, iconURL, "", type);
|
||||
items.push(item);
|
||||
|
||||
// Advance the enumerator
|
||||
var certName = aParams.GetString(i++);
|
||||
}
|
||||
|
||||
gExtensionManager.addDownloads(items, items.length);
|
||||
},
|
||||
|
||||
removeDownload: function (aEvent)
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIExtensionDownloadProgressListener
|
||||
onStateChange: function (aURL, aState, aValue)
|
||||
{
|
||||
const nsIXPIProgressDialog = Components.interfaces.nsIXPIProgressDialog;
|
||||
var element = document.getElementById(aURL);
|
||||
if (!element) return;
|
||||
switch (aState) {
|
||||
case nsIXPIProgressDialog.DOWNLOAD_START:
|
||||
element.setAttribute("state", "waiting");
|
||||
element.setAttribute("progress", "0");
|
||||
break;
|
||||
case nsIXPIProgressDialog.DOWNLOAD_DONE:
|
||||
element.setAttribute("progress", "100");
|
||||
break;
|
||||
case nsIXPIProgressDialog.INSTALL_START:
|
||||
element.setAttribute("state", "installing");
|
||||
break;
|
||||
case nsIXPIProgressDialog.INSTALL_DONE:
|
||||
dump("*** state change = " + aURL + ", state = " + aState + ", value = " + aValue + "\n");
|
||||
element.setAttribute("state", "done");
|
||||
var msg;
|
||||
if (aValue != 0) {
|
||||
var xpinstallStrings = document.getElementById("xpinstallStrings");
|
||||
try {
|
||||
msg = xpinstallStrings.getString("error" + aValue);
|
||||
}
|
||||
catch (e) {
|
||||
msg = xpinstallStrings.getFormattedString("unknown.error", [aValue]);
|
||||
}
|
||||
element.setAttribute("error", msg);
|
||||
}
|
||||
// Remove the dummy, since we installed successfully
|
||||
var type = gWindowState == "extensions" ? nsIUpdateItem.TYPE_EXTENSION
|
||||
: nsIUpdateItem.TYPE_THEME;
|
||||
gExtensionManager.removeDownload(aURL, type);
|
||||
break;
|
||||
case nsIXPIProgressDialog.DIALOG_CLOSE:
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_urls: { },
|
||||
onProgress: function (aURL, aValue, aMaxValue)
|
||||
{
|
||||
var element = document.getElementById(aURL);
|
||||
if (!element) return;
|
||||
var percent = Math.round((aValue / aMaxValue) * 100);
|
||||
if (percent > 1 && !(aURL in this._urls)) {
|
||||
this._urls[aURL] = true;
|
||||
element.setAttribute("state", "downloading");
|
||||
}
|
||||
element.setAttribute("progress", percent);
|
||||
|
||||
var KBProgress = parseInt(aValue/1024 + .5);
|
||||
var KBTotal = parseInt(aMaxValue/1024 + .5);
|
||||
element.setAttribute("status", this._formatKBytes(KBProgress, KBTotal));
|
||||
},
|
||||
|
||||
_replaceInsert: function ( text, index, value )
|
||||
{
|
||||
var result = text;
|
||||
var regExp = new RegExp( "#"+index );
|
||||
result = result.replace( regExp, value );
|
||||
return result;
|
||||
},
|
||||
|
||||
// aBytes aTotalKBytes returns:
|
||||
// x, < 1MB y < 1MB x of y KB
|
||||
// x, < 1MB y >= 1MB x KB of y MB
|
||||
// x, >= 1MB y >= 1MB x of y MB
|
||||
_formatKBytes: function (aKBytes, aTotalKBytes)
|
||||
{
|
||||
var progressHasMB = parseInt(aKBytes/1000) > 0;
|
||||
var totalHasMB = parseInt(aTotalKBytes/1000) > 0;
|
||||
|
||||
var format = "";
|
||||
if (!progressHasMB && !totalHasMB) {
|
||||
format = this._statusFormatKBKB;
|
||||
format = this._replaceInsert(format, 1, aKBytes);
|
||||
format = this._replaceInsert(format, 2, aTotalKBytes);
|
||||
}
|
||||
else if (progressHasMB && totalHasMB) {
|
||||
format = this._statusFormatMBMB;
|
||||
format = this._replaceInsert(format, 1, (aKBytes / 1000).toFixed(1));
|
||||
format = this._replaceInsert(format, 2, (aTotalKBytes / 1000).toFixed(1));
|
||||
}
|
||||
else if (totalHasMB && !progressHasMB) {
|
||||
format = this._statusFormatKBMB;
|
||||
format = this._replaceInsert(format, 1, aKBytes);
|
||||
format = this._replaceInsert(format, 2, (aTotalKBytes / 1000).toFixed(1));
|
||||
}
|
||||
else {
|
||||
// This is an undefined state!
|
||||
dump("*** huh?!\n");
|
||||
}
|
||||
|
||||
return format;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
QueryInterface: function (aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIExtensionDownloadProgressListener) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// View Event Handlers
|
||||
//
|
||||
function onViewDoubleClick()
|
||||
{
|
||||
switch (gWindowState) {
|
||||
case "extensions":
|
||||
gExtensionsViewController.doCommand('cmd_options');
|
||||
break;
|
||||
case "themes":
|
||||
gExtensionsViewController.doCommand('cmd_useTheme');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function onThemeSelect(aEvent)
|
||||
{
|
||||
if (gWindowState != "themes")
|
||||
return;
|
||||
|
||||
var previewImageDeck = document.getElementById("previewImageDeck");
|
||||
if (!gExtensionsView.selected) {
|
||||
previewImageDeck.setAttribute("selectedIndex", "0");
|
||||
return;
|
||||
}
|
||||
var url = gExtensionsView.selected.getAttribute("previewImage");
|
||||
if (url) {
|
||||
previewImageDeck.setAttribute("selectedIndex", "2");
|
||||
var previewImage = document.getElementById("previewImage");
|
||||
previewImage.setAttribute("src", url);
|
||||
}
|
||||
else
|
||||
previewImageDeck.setAttribute("selectedIndex", "1");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// View Context Menus
|
||||
var gExtensionContextMenus = ["menuitem_options", "menuitem_homepage", "menuitem_about",
|
||||
"menuseparator_1", "menuitem_uninstall", "menuitem_update",
|
||||
"menuitem_enable", "menuitem_disable", "menuseparator_2",
|
||||
"menuitem_moveTop", "menuitem_moveUp", "menuitem_moveDn"];
|
||||
var gThemeContextMenus = ["menuitem_useTheme", "menuitem_homepage", "menuitem_about",
|
||||
"menuseparator_1", "menuitem_uninstall", "menuitem_update"];
|
||||
|
||||
function buildContextMenu(aEvent)
|
||||
{
|
||||
if (aEvent.target.id != "extensionContextMenu")
|
||||
return false;
|
||||
|
||||
var popup = document.getElementById("extensionContextMenu");
|
||||
while (popup.hasChildNodes())
|
||||
popup.removeChild(popup.firstChild);
|
||||
|
||||
var isExtensions = gWindowState == "extensions";
|
||||
|
||||
var menus = isExtensions ? gExtensionContextMenus : gThemeContextMenus;
|
||||
for (var i = 0; i < menus.length; ++i) {
|
||||
var clonedMenu = document.getElementById(menus[i]).cloneNode(true);
|
||||
clonedMenu.id = clonedMenu.id + "_clone";
|
||||
popup.appendChild(clonedMenu);
|
||||
}
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
var menuitem_about = document.getElementById("menuitem_about_clone");
|
||||
var name = document.popupNode.getAttribute("name");
|
||||
menuitem_about.setAttribute("label", extensionsStrings.getFormattedString("aboutExtension", [name]));
|
||||
|
||||
if (isExtensions) {
|
||||
var canEnable = gExtensionsViewController.isCommandEnabled("cmd_enable");
|
||||
var menuitemToShow, menuitemToHide;
|
||||
if (canEnable) {
|
||||
menuitemToShow = document.getElementById("menuitem_enable_clone");
|
||||
menuitemToHide = document.getElementById("menuitem_disable_clone");
|
||||
}
|
||||
else {
|
||||
menuitemToShow = document.getElementById("menuitem_disable_clone");
|
||||
menuitemToHide = document.getElementById("menuitem_enable_clone");
|
||||
}
|
||||
menuitemToShow.hidden = false;
|
||||
menuitemToHide.hidden = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Drag and Drop
|
||||
|
||||
var gExtensionsDNDObserver =
|
||||
{
|
||||
_ioServ: null,
|
||||
_filePH: null,
|
||||
|
||||
_ensureServices: function ()
|
||||
{
|
||||
if (!this._ioServ) {
|
||||
this._ioServ = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
this._filePH = this._ioServ.getProtocolHandler("file")
|
||||
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
|
||||
}
|
||||
},
|
||||
|
||||
onDragOver: function (aEvent, aFlavor, aDragSession)
|
||||
{
|
||||
this._ensureServices();
|
||||
|
||||
aDragSession.canDrop = true;
|
||||
var count = aDragSession.numDropItems;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var xfer = Components.classes["@mozilla.org/widget/transferable;1"]
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
xfer.addDataFlavor("text/x-moz-url");
|
||||
aDragSession.getData(xfer, i);
|
||||
|
||||
var data = { }, length = { };
|
||||
xfer.getTransferData("text/x-moz-url", data, length);
|
||||
var fileURL = data.value.QueryInterface(Components.interfaces.nsISupportsString).data;
|
||||
|
||||
var fileURI = this._ioServ.newURI(fileURL, null, null);
|
||||
var url = fileURI.QueryInterface(Components.interfaces.nsIURL);
|
||||
if (url.fileExtension != "jar" && url.fileExtension != "xpi") {
|
||||
aDragSession.canDrop = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDrop: function(aEvent, aXferData, aDragSession)
|
||||
{
|
||||
this._ensureServices();
|
||||
|
||||
var xpinstallObj = {};
|
||||
var themes = {};
|
||||
var xpiCount = 0;
|
||||
var themeCount = 0;
|
||||
|
||||
var count = aDragSession.numDropItems;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var xfer = Components.classes["@mozilla.org/widget/transferable;1"]
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
xfer.addDataFlavor("text/x-moz-url");
|
||||
aDragSession.getData(xfer, i);
|
||||
|
||||
var data = { }, length = { };
|
||||
xfer.getTransferData("text/x-moz-url", data, length);
|
||||
var fileURL = data.value.QueryInterface(Components.interfaces.nsISupportsString).data;
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = fileURL;
|
||||
var url = uri.QueryInterface(Components.interfaces.nsIURL);
|
||||
if (url.fileExtension == "xpi") {
|
||||
xpinstallObj[url.fileName] = fileURL;
|
||||
++xpiCount;
|
||||
}
|
||||
else if (url.fileExtension == "jar") {
|
||||
themes[url.fileName] = fileURL;
|
||||
++themeCount;
|
||||
}
|
||||
}
|
||||
if (xpiCount > 0)
|
||||
InstallTrigger.install(xpinstallObj);
|
||||
if (themeCount > 0) {
|
||||
for (var fileName in themes)
|
||||
InstallTrigger.installChrome(InstallTrigger.SKIN, themes[fileName], fileName);
|
||||
}
|
||||
},
|
||||
_flavourSet: null,
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
if (!this._flavourSet) {
|
||||
this._flavourSet = new FlavourSet();
|
||||
this._flavourSet.appendFlavour("text/x-moz-url");
|
||||
}
|
||||
return this._flavourSet;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Command Updating and Command Handlers
|
||||
|
||||
var gExtensionsViewController = {
|
||||
supportsCommand: function (aCommand)
|
||||
{
|
||||
var commandNode = document.getElementById(aCommand);
|
||||
return commandNode && (commandNode.parentNode == document.getElementById("extensionsCommands"));
|
||||
},
|
||||
|
||||
isCommandEnabled: function (aCommand)
|
||||
{
|
||||
var selectedItem = gExtensionsView.selected;
|
||||
switch (aCommand) {
|
||||
case "cmd_close":
|
||||
return true;
|
||||
case "cmd_useTheme":
|
||||
return selectedItem && gCurrentTheme != selectedItem.getAttribute("internalName");
|
||||
case "cmd_options":
|
||||
return selectedItem && !selectedItem.disabled && selectedItem.getAttribute("optionsURL") != "";
|
||||
case "cmd_about":
|
||||
return !selectedItem || (selectedItem.disabled ? selectedItem.getAttribute("aboutURL") == "" : true);
|
||||
case "cmd_homepage":
|
||||
return (selectedItem && selectedItem.getAttribute("homepageURL") != "");
|
||||
case "cmd_uninstall":
|
||||
return selectedItem && selectedItem.getAttribute("locked") != "true";
|
||||
case "cmd_update":
|
||||
return true;
|
||||
case "cmd_enable":
|
||||
return selectedItem && selectedItem.disabled && !gExtensionManager.inSafeMode;
|
||||
case "cmd_disable":
|
||||
return selectedItem && selectedItem.getAttribute("locked") != "true" && !selectedItem.disabled;
|
||||
case "cmd_movetop":
|
||||
return (gExtensionsView.children[0] != selectedItem);
|
||||
case "cmd_moveup":
|
||||
return (gExtensionsView.children[0] != selectedItem);
|
||||
case "cmd_movedn":
|
||||
var children = gExtensionsView.children;
|
||||
return (children[children.length-1] != selectedItem);
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
case "cmd_install":
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
doCommand: function (aCommand)
|
||||
{
|
||||
if (this.isCommandEnabled(aCommand))
|
||||
this.commands[aCommand]();
|
||||
},
|
||||
|
||||
onCommandUpdate: function ()
|
||||
{
|
||||
var extensionsCommands = document.getElementById("extensionsCommands");
|
||||
for (var i = 0; i < extensionsCommands.childNodes.length; ++i) {
|
||||
var command = extensionsCommands.childNodes[i];
|
||||
if (this.isCommandEnabled(command.id))
|
||||
command.removeAttribute("disabled");
|
||||
else
|
||||
command.setAttribute("disabled", "true");
|
||||
}
|
||||
},
|
||||
|
||||
commands: {
|
||||
cmd_close: function ()
|
||||
{
|
||||
closeWindow(true);
|
||||
},
|
||||
|
||||
cmd_useTheme: function ()
|
||||
{
|
||||
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Components.interfaces.nsIXULChromeRegistry);
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
gCurrentTheme = gExtensionsView.selected.getAttribute("internalName");
|
||||
var inUse = cr.isSkinSelected(gCurrentTheme , true);
|
||||
if (inUse == Components.interfaces.nsIChromeRegistry.FULL)
|
||||
return;
|
||||
|
||||
pref.setCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN, gCurrentTheme);
|
||||
|
||||
// Set this pref so the user can reset the theme in safe mode
|
||||
pref.setCharPref(PREF_EM_LAST_SELECTED_SKIN, gCurrentTheme);
|
||||
cr.selectSkin(gCurrentTheme, true);
|
||||
cr.refreshSkins();
|
||||
|
||||
|
||||
// disable the useThemeButton
|
||||
gExtensionsViewController.onCommandUpdate();
|
||||
},
|
||||
|
||||
cmd_options: function ()
|
||||
{
|
||||
if (!gExtensionsView.selected) return;
|
||||
var optionsURL = gExtensionsView.selected.getAttribute("optionsURL");
|
||||
if (optionsURL != "")
|
||||
openDialog(optionsURL, "", "chrome,modal");
|
||||
},
|
||||
|
||||
cmd_homepage: function ()
|
||||
{
|
||||
var homepageURL = gExtensionsView.selected.getAttribute("homepageURL");
|
||||
if (homepageURL != "")
|
||||
openURL(homepageURL);
|
||||
},
|
||||
|
||||
cmd_about: function ()
|
||||
{
|
||||
var aboutURL = gExtensionsView.selected.getAttribute("aboutURL");
|
||||
if (aboutURL != "")
|
||||
openDialog(aboutURL, "", "chrome,modal");
|
||||
else
|
||||
openDialog("chrome://mozapps/content/extensions/about.xul", "", "chrome,modal", gExtensionsView.selected.id, gExtensionsView.database);
|
||||
},
|
||||
|
||||
cmd_movetop: function ()
|
||||
{
|
||||
var movingID = gExtensionsView.selected.id;
|
||||
gExtensionManager.moveTop(stripPrefix(movingID));
|
||||
gExtensionsView.selected = document.getElementById(movingID);
|
||||
},
|
||||
|
||||
cmd_moveup: function ()
|
||||
{
|
||||
var movingID = gExtensionsView.selected.id;
|
||||
gExtensionManager.moveUp(stripPrefix(movingID));
|
||||
gExtensionsView.selected = document.getElementById(movingID);
|
||||
},
|
||||
|
||||
cmd_movedn: function ()
|
||||
{
|
||||
var movingID = gExtensionsView.selected.id;
|
||||
gExtensionManager.moveDown(stripPrefix(movingID));
|
||||
gExtensionsView.selected = document.getElementById(movingID);
|
||||
},
|
||||
|
||||
cmd_update: function ()
|
||||
{
|
||||
var id = gExtensionsView.selected ? stripPrefix(gExtensionsView.selected.id) : null;
|
||||
var itemType = gWindowState == "extensions" ? nsIUpdateItem.TYPE_EXTENSION : nsIUpdateItem.TYPE_THEME;
|
||||
var items = gExtensionManager.getItemList(id, itemType, { });
|
||||
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIUpdateService);
|
||||
updates.checkForUpdates(items, items.length, itemType,
|
||||
Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER,
|
||||
window);
|
||||
},
|
||||
|
||||
cmd_uninstall: function ()
|
||||
{
|
||||
// Confirm the uninstall
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
var brandStrings = document.getElementById("brandStrings");
|
||||
|
||||
var name = gExtensionsView.selected.getAttribute("name");
|
||||
var title = extensionsStrings.getFormattedString("queryUninstallTitle", [name]);
|
||||
if (gWindowState == "extensions")
|
||||
message = extensionsStrings.getFormattedString("queryUninstallExtensionMessage", [name, name]);
|
||||
else if (gWindowState == "themes")
|
||||
message = extensionsStrings.getFormattedString("queryUninstallThemeMessage", [name]);
|
||||
|
||||
// XXXben - improve the wording on the buttons here!
|
||||
var promptSvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
if (!promptSvc.confirm(window, title, message))
|
||||
return;
|
||||
|
||||
var selectedID = gExtensionsView.selected.id;
|
||||
var selectedElement = document.getElementById(selectedID);
|
||||
var nextElement = selectedElement.nextSibling;
|
||||
if (!nextElement)
|
||||
nextElement = selectedElement.previousSibling;
|
||||
nextElement = nextElement.id;
|
||||
|
||||
if (gWindowState == "extensions")
|
||||
gExtensionManager.uninstallExtension(stripPrefix(selectedID));
|
||||
else if (gWindowState == "themes")
|
||||
gExtensionManager.uninstallTheme(stripPrefix(selectedID));
|
||||
|
||||
gExtensionsView.selected = document.getElementById(nextElement);
|
||||
},
|
||||
|
||||
cmd_disable: function ()
|
||||
{
|
||||
gExtensionManager.disableExtension(stripPrefix(gExtensionsView.selected.id));
|
||||
},
|
||||
|
||||
cmd_enable: function ()
|
||||
{
|
||||
gExtensionManager.enableExtension(stripPrefix(gExtensionsView.selected.id));
|
||||
},
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
cmd_install: function()
|
||||
{
|
||||
if (gWindowState == "extensions")
|
||||
installExtension();
|
||||
else
|
||||
installSkin();
|
||||
},
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
///////////////////////////////////////////////////////////////
|
||||
// functions to support installing of themes in thunderbird
|
||||
///////////////////////////////////////////////////////////////
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
const nsIIOService = Components.interfaces.nsIIOService;
|
||||
const nsIFileProtocolHandler = Components.interfaces.nsIFileProtocolHandler;
|
||||
const nsIURL = Components.interfaces.nsIURL;
|
||||
|
||||
function installSkin()
|
||||
{
|
||||
// 1) Prompt the user for the location of the theme to install.
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, extensionsStrings.getString("installThemePickerTitle"), nsIFilePicker.modeOpen);
|
||||
|
||||
|
||||
fp.appendFilter(extensionsStrings.getString("themesFilter"), "*.jar");
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
var ret = fp.show();
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
{
|
||||
var ioService = Components.classes['@mozilla.org/network/io-service;1'].getService(nsIIOService);
|
||||
var fileProtocolHandler =
|
||||
ioService.getProtocolHandler("file").QueryInterface(nsIFileProtocolHandler);
|
||||
var url = fileProtocolHandler.newFileURI(fp.file).QueryInterface(nsIURL);
|
||||
InstallTrigger.installChrome(InstallTrigger.SKIN, url.spec, decodeURIComponent(url.fileBaseName));
|
||||
}
|
||||
}
|
||||
|
||||
function installExtension()
|
||||
{
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, extensionsStrings.getString("installExtensionPickerTitle"), nsIFilePicker.modeOpen);
|
||||
|
||||
fp.appendFilter(extensionsStrings.getString("extensionFilter"), "*.xpi");
|
||||
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
var ret = fp.show();
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
{
|
||||
var ioService = Components.classes['@mozilla.org/network/io-service;1'].getService(nsIIOService);
|
||||
var fileProtocolHandler =
|
||||
ioService.getProtocolHandler("file").QueryInterface(nsIFileProtocolHandler);
|
||||
var url = fileProtocolHandler.newFileURI(fp.file).QueryInterface(nsIURL);
|
||||
var xpi = {};
|
||||
xpi[decodeURIComponent(url.fileBaseName)] = url.spec;
|
||||
InstallTrigger.install(xpi);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
|
@ -0,0 +1,422 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
|
||||
<!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd" >
|
||||
%brandDTD;
|
||||
%extensionsDTD;
|
||||
]>
|
||||
|
||||
<bindings id="extensionBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="extension" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="extension-item-description" xbl:inherits="value=description" crop="right"/>
|
||||
<xul:label class="extension-item-creator" xbl:inherits="value=creator" crop="right"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-button" anonid="options-button"
|
||||
#ifdef XP_WIN
|
||||
tooltiptext="&options.tooltip;"
|
||||
#else
|
||||
tooltiptext="&optionsUnix.tooltip;"
|
||||
#endif
|
||||
onclick="gExtensionsViewController.doCommand('cmd_options');"/>
|
||||
<xul:image class="extension-button" anonid="about-button"
|
||||
tooltiptext="&about.tooltip;"
|
||||
onclick="gExtensionsViewController.doCommand('cmd_about');"/>
|
||||
<xul:image class="extension-button" anonid="homepage-button"
|
||||
tooltiptext="&homepage.tooltip;"
|
||||
onclick="gExtensionsViewController.doCommand('cmd_homepage');"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-tobedisabled" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:description class="extension-item-description">
|
||||
&extensionItem.toBeDisabled.label;
|
||||
</xul:description>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-tobeenabled" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:description class="extension-item-description">
|
||||
&extensionItem.toBeEnabled.label;
|
||||
</xul:description>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-tobeinstalled" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:description class="extension-item-description">
|
||||
&extensionItem.toBeInstalled.label;
|
||||
</xul:description>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-tobeuninstalled" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:description class="extension-item-description">
|
||||
&extensionItem.toBeUninstalled.label;
|
||||
</xul:description>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-waiting" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:description class="extension-item-description">
|
||||
&extensionItem.waiting.label;
|
||||
</xul:description>
|
||||
<xul:label value=" "/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-downloading" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:progressmeter class="extension-item-progress" xbl:inherits="value=progress"/>
|
||||
<xul:label class="extension-item-status" xbl:inherits="value=status"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-installing" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:description class="extension-item-description">
|
||||
&extensionItem.installing.label;
|
||||
</xul:description>
|
||||
<xul:label value=" "/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="extension-done" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="extension-item-description" xbl:inherits="value=error"
|
||||
value="&extensionItem.done.label;"/>
|
||||
<xul:label value=" "/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="theme" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="extension-item-creator" xbl:inherits="value=creator" crop="right"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="theme-waiting" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="extension-item-status" crop="right">&extensionItem.waiting.label;</xul:label>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="theme-downloading" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:progressmeter class="extension-item-progress" xbl:inherits="value=progress"/>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="theme-installing" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="extension-item-status" crop="right">&extensionItem.installing.label;</xul:label>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="theme-done" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:vbox pack="start">
|
||||
<xul:image class="extension-icon" xbl:inherits="src=image"
|
||||
style="width: 32px; max-width: 32px; height: 32px; max-height: 32px;"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox pack="start" flex="1">
|
||||
<xul:hbox>
|
||||
<xul:label class="extension-item-name" xbl:inherits="value=name" crop="center"/>
|
||||
<xul:label class="extension-item-version" xbl:inherits="value=version"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="extension-item-status" crop="right">&extensionItem.done.label;</xul:label>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,281 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/content/extensions/extensions.css"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/skin/extensions/extensions.css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
|
||||
%brandDTD;
|
||||
<!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd">
|
||||
%extensionsDTD;
|
||||
]>
|
||||
|
||||
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="extensionsManager" windowtype="Extension:Manager"
|
||||
orient="vertical" title="&extensions.title;" statictitle="&extensions.title;"
|
||||
screenX="10" screenY="10"
|
||||
persist="width height screenX screenY sizeMode"
|
||||
onload="Startup();" onunload="Shutdown();"
|
||||
onclose="return closeWindow(false);">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/extensions/extensions.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
|
||||
<stringbundleset id="extensionsSet">
|
||||
<stringbundle id="brandStrings" src="chrome://global/locale/brand.properties"/>
|
||||
<stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
|
||||
<stringbundle id="xpinstallStrings" src="chrome://communicator/locale/xpinstall/xpinstall.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<keyset id="extensionsKeys">
|
||||
<key id="key_close" key="&cmd.close.commandKey;" modifiers="accel" command="cmd_close"
|
||||
oncommand="gExtensionsViewController.doCommand('cmd_close');"/>
|
||||
<key id="key_about" key="&cmd.info.commandKey;" modifiers="accel" command="cmd_about"
|
||||
oncommand="gExtensionsViewController.doCommand('cmd_about');"/>
|
||||
<key id="key_options" key="&cmd.options.commandKey;" modifiers="accel" command="cmd_options"
|
||||
oncommand="gExtensionsViewController.doCommand('cmd_options');"/>
|
||||
</keyset>
|
||||
|
||||
<commandset id="extensionsCommands"
|
||||
events="richview-select,focus"
|
||||
commandupdater="true"
|
||||
oncommandupdate="gExtensionsViewController.onCommandUpdate();"
|
||||
oncommand="gExtensionsViewController.doCommand(event.target.id);">
|
||||
<command id="cmd_close"/>
|
||||
<command id="cmd_options"/>
|
||||
<command id="cmd_about"/>
|
||||
<command id="cmd_homepage"/>
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
<command id="cmd_install"/>
|
||||
#endif
|
||||
<command id="cmd_uninstall"/>
|
||||
<command id="cmd_update"/>
|
||||
<command id="cmd_enable"/>
|
||||
<command id="cmd_disable"/>
|
||||
<command id="cmd_movetop"/>
|
||||
<command id="cmd_moveup"/>
|
||||
<command id="cmd_movedn"/>
|
||||
<command id="cmd_useTheme"/>
|
||||
</commandset>
|
||||
|
||||
<vbox id="contextMenuPalette" hidden="true">
|
||||
<menuitem id="menuitem_useTheme" default="true" command="cmd_useTheme"
|
||||
label="&cmd.useTheme.label;" accesskey="&cmd.useTheme.accesskey;"/>
|
||||
<menuitem id="menuitem_options" default="true" command="cmd_options"
|
||||
#ifdef XP_WIN
|
||||
label="&cmd.options.label;" accesskey="&cmd.options.accesskey;"/>
|
||||
#else
|
||||
label="&cmd.optionsUnix.label;" accesskey="&cmd.optionsUnix.accesskey;"/>
|
||||
#endif
|
||||
<menuitem id="menuitem_homepage" command="cmd_homepage"
|
||||
label="&cmd.homepage.label;" accesskey="&cmd.homepage.accesskey;"/>
|
||||
<menuitem id="menuitem_about" command="cmd_about"
|
||||
label="&cmd.about.label;" accesskey="&cmd.about.accesskey;"/>
|
||||
<menuseparator id="menuseparator_1"/>
|
||||
<menuitem id="menuitem_uninstall" command="cmd_uninstall"
|
||||
label="&cmd.uninstall.label;" accesskey="&cmd.uninstall.accesskey;"/>
|
||||
<menuitem id="menuitem_update" command="cmd_update"
|
||||
label="&cmd.update.label;" accesskey="&cmd.update.accesskey;"/>
|
||||
<menuitem id="menuitem_enable" command="cmd_enable"
|
||||
label="&cmd.enable.label;" accesskey="&cmd.enable.accesskey;"/>
|
||||
<menuitem id="menuitem_disable" command="cmd_disable"
|
||||
label="&cmd.disable.label;" accesskey="&cmd.disable.accesskey;"/>
|
||||
<menuseparator id="menuseparator_2"/>
|
||||
<menuitem id="menuitem_moveTop" command="cmd_movetop"
|
||||
label="&cmd.moveToTop.label;" accesskey="&cmd.moveToTop.accesskey;"/>
|
||||
<menuitem id="menuitem_moveUp" command="cmd_moveup"
|
||||
label="&cmd.moveUp.label;" accesskey="&cmd.moveUp.accesskey;"/>
|
||||
<menuitem id="menuitem_moveDn" command="cmd_movedn"
|
||||
label="&cmd.moveDn.label;" accesskey="&cmd.moveDn.accesskey;"/>
|
||||
</vbox>
|
||||
|
||||
<popup id="extensionContextMenu" onpopupshowing="return buildContextMenu(event);"/>
|
||||
|
||||
<hbox flex="1">
|
||||
<view id="extensionsView" flex="3" style="overflow: auto;"
|
||||
datasources="rdf:null" persist="last-selected"
|
||||
ondragover="nsDragAndDrop.dragOver(event, gExtensionsDNDObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, gExtensionsDNDObserver);"
|
||||
ondblclick="onViewDoubleClick();">
|
||||
<template>
|
||||
<rule>
|
||||
<conditions>
|
||||
<content uri="?uri"/>
|
||||
<member container="?uri" child="?extension"/>
|
||||
<triple subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#name"
|
||||
object="?name"/>
|
||||
<triple subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#version"
|
||||
object="?version"/>
|
||||
</conditions>
|
||||
<bindings>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#creator"
|
||||
object="?creator"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#iconURL"
|
||||
object="?icon"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#previewImage"
|
||||
object="?previewImage"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#optionsURL"
|
||||
object="?options-url"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#aboutURL"
|
||||
object="?about-url"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#updateURL"
|
||||
object="?update-url"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#disabled"
|
||||
object="?disabled"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#homepageURL"
|
||||
object="?homepage-url"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#description"
|
||||
object="?description"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#locked"
|
||||
object="?locked"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#toBeInstalled"
|
||||
object="?toBeInstalled"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#toBeUninstalled"
|
||||
object="?toBeUninstalled"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#toBeEnabled"
|
||||
object="?toBeEnabled"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#toBeDisabled"
|
||||
object="?toBeDisabled"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#itemType"
|
||||
object="?itemType"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#internalName"
|
||||
object="?internalName"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#downloadURL"
|
||||
object="?downloadURL"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#state"
|
||||
object="?state"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#progress"
|
||||
object="?progress"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#status"
|
||||
object="?status"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<!-- XXXben - we could really use a variety of different templates
|
||||
here to make each element not be so heavy. -->
|
||||
<extension uri="?extension" context="extensionContextMenu"
|
||||
image="?icon" name="?name" version="?version"
|
||||
description="?description" creator="?creator"
|
||||
disabled="?disabled" locked="?locked"
|
||||
optionsURL="?options-url" homepageURL="?homepage-url"
|
||||
aboutURL="?about-url" updateURL="?update-url"
|
||||
previewImage="?previewImage" internalName="?internalName"
|
||||
toBeInstalled="?toBeInstalled" toBeUninstalled="?toBeUninstalled"
|
||||
toBeEnabled="?toBeEnabled" toBeDisabled="?toBeDisabled"
|
||||
itemType="?itemType" downloadURL="?downloadURL"
|
||||
state="?state" progress="?progress" status="?status"/>
|
||||
</action>
|
||||
</rule>
|
||||
</template>
|
||||
</view>
|
||||
<vbox flex="5" id="themePreviewArea" class="themePreviewArea" hidden="true">
|
||||
<deck id="previewImageDeck" flex="1">
|
||||
<vbox id="noThemeSelected" pack="center" align="center">
|
||||
<label class="previewText">&previewNoThemeSelected.label;</label>
|
||||
</vbox>
|
||||
<vbox id="noPreviewImage" pack="center" align="center">
|
||||
<label class="previewText">&previewNoPreviewImage.label;</label>
|
||||
</vbox>
|
||||
<vbox id="previewImageContainer" align="center" pack="center"
|
||||
style="overflow: auto;">
|
||||
<description>
|
||||
<image id="previewImage"/>
|
||||
</description>
|
||||
</vbox>
|
||||
</deck>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<hbox id="commandBar" flex="1" align="center">
|
||||
<hbox>
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
<button id="installButton"
|
||||
label="&cmd.install.label;" accesskey="&cmd.install.accesskey;" tooltiptext="&cmd.install.tooltip;"
|
||||
command="cmd_install"/>
|
||||
#endif
|
||||
<button id="uninstallButton"
|
||||
label="&cmd.uninstall.label;" accesskey="&cmd.uninstall.accesskey;" tooltiptext="&cmd.uninstall.tooltip;"
|
||||
command="cmd_uninstall"/>
|
||||
<separator class="commandBarSeparator"/>
|
||||
<button id="updateButton"
|
||||
label="&cmd.update.label;" accesskey="&cmd.update.accesskey;" tooltiptext="&cmd.update.tooltip;"
|
||||
command="cmd_update"/>
|
||||
<separator class="commandBarSeparator"/>
|
||||
<button id="useThemeButton" hidden="true"
|
||||
label="&cmd.useTheme.label;" accesskey="&cmd.useTheme.accesskey;" tooltiptext="&cmd.useTheme.tooltip;"
|
||||
command="cmd_useTheme"/>
|
||||
</hbox>
|
||||
<spacer flex="1"/>
|
||||
<label id="getMore" onclick="openURL(gGetMoreURL);"
|
||||
valuethemes="&getMoreThemes.label;"
|
||||
valueextensions="&getMoreExtensions.label;"
|
||||
tooltiptextthemes="&getMoreThemes.tooltip;"
|
||||
tooltiptextextensions="&getMoreExtensions.tooltip;"/>
|
||||
</hbox>
|
||||
|
||||
<resizer id="windowResizer" dir="bottomright"/>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % finalizeDTD SYSTEM "chrome://mozapps/locale/extensions/finalize.dtd">
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
|
||||
%finalizeDTD;
|
||||
%brandDTD;
|
||||
]>
|
||||
|
||||
<dialog id="finalize" title="&finalize.title;"
|
||||
style="width: 30em;" onload="init();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
function init()
|
||||
{
|
||||
var accept = document.documentElement.getButton("accept");
|
||||
accept.hidden = true;
|
||||
var cancel = document.documentElement.getButton("cancel");
|
||||
cancel.hidden = true;
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<label>&intro.label;</label>
|
||||
|
||||
</dialog>
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
|
||||
var gMismatchDialog = {
|
||||
_extensions: [],
|
||||
|
||||
init: function ()
|
||||
{
|
||||
for (var i = 0; i < window.arguments.length; ++i)
|
||||
this._extensions.push(eval(window.arguments[i]));
|
||||
|
||||
var incompatible = document.getElementById("incompatible");
|
||||
|
||||
for (var i = 0; i < this._extensions.length; ++i) {
|
||||
var extension = this._extensions[i];
|
||||
var listitem = document.createElement("listitem");
|
||||
listitem.setAttribute("label", extension.name + " " + extension.version);
|
||||
incompatible.appendChild(listitem);
|
||||
}
|
||||
|
||||
var strings = document.getElementById("extensionsStrings");
|
||||
var accept = document.documentElement.getButton("accept");
|
||||
accept.label = strings.getString("mismatchCheckNow");
|
||||
var cancel = document.documentElement.getButton("cancel");
|
||||
cancel.label = strings.getString("mismatchDontCheck");
|
||||
},
|
||||
|
||||
uninit: function ()
|
||||
{
|
||||
},
|
||||
|
||||
cancel: function ()
|
||||
{
|
||||
window.close();
|
||||
},
|
||||
|
||||
accept: function ()
|
||||
{
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Components.interfaces.nsIExtensionManager);
|
||||
openDialog("chrome://mozapps/content/extensions/update.xul",
|
||||
"", "chrome,modal", "extensions", em, null);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/extensions/mismatch.dtd">
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
|
||||
%updateDTD;
|
||||
%brandDTD;
|
||||
]>
|
||||
|
||||
<dialog id="mismatch" title="&mismatch.title;"
|
||||
style="width: 30em;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept,cancel"
|
||||
onload="gMismatchDialog.init();"
|
||||
onunload="gMismatchDialog.uninit();"
|
||||
ondialogcancel="gMismatchDialog.cancel();"
|
||||
ondialogaccept="gMismatchDialog.accept();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/extensions/mismatch.js"/>
|
||||
|
||||
<stringbundleset id="updateSet">
|
||||
<stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<label>&intro1.label;</label>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<listbox id="incompatible" flex="1"/>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<label style="font-weight: bold;">&intro2.label;</label>
|
||||
<separator class="thin"/>
|
||||
|
||||
<label>&intro3.label;</label>
|
||||
|
||||
</dialog>
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
var gUpdateDialog = {
|
||||
_updateType: "",
|
||||
_extensionManager: "",
|
||||
_extensionID: "",
|
||||
_openTime: null,
|
||||
_brandShortName: "",
|
||||
_updateStrings: null,
|
||||
_extensionsToUpdate: [],
|
||||
|
||||
_messages: ["update-started",
|
||||
"update-ended",
|
||||
"update-item-started",
|
||||
"update-item-ended",
|
||||
"update-item-error"],
|
||||
|
||||
init: function ()
|
||||
{
|
||||
this._updateType = window.arguments[0];
|
||||
this._extensionManager = window.arguments[1];
|
||||
this._extensionID = window.arguments[2];
|
||||
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
for (var i = 0; i < this._messages.length; ++i)
|
||||
os.addObserver(this, this._messages[i], false);
|
||||
|
||||
this._openTime = Math.abs(Date.UTC());
|
||||
|
||||
this._brandShortName = document.getElementById("brandStrings").getString("brandShortName");
|
||||
this._updateStrings = document.getElementById("extensionsStrings");
|
||||
|
||||
if (this._updateType == "extensions")
|
||||
this._extensionManager.updateExtension(this._extensionID, window);
|
||||
else if (gUpdateType == "themes")
|
||||
this._extensionManager.updateTheme(this._extensionID);
|
||||
},
|
||||
|
||||
uninit: function ()
|
||||
{
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
for (var i = 0; i < this._messages.length; ++i)
|
||||
os.removeObserver(this, this._messages[i]);
|
||||
},
|
||||
|
||||
cancel: function ()
|
||||
{
|
||||
// This will cause uninit to be called, removing our listener, so the extension manager's
|
||||
// notifications will go nowhere.
|
||||
window.close();
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData)
|
||||
{
|
||||
switch (aTopic) {
|
||||
case "update-started":
|
||||
break;
|
||||
case "update-item-started":
|
||||
break;
|
||||
case "update-item-ended":
|
||||
this._extensionsToUpdate.push(aSubject);
|
||||
break;
|
||||
case "update-ended":
|
||||
var installObj = { };
|
||||
for (var i = 0; i < this._extensionsToUpdate.length; ++i) {
|
||||
var e = this._extensionsToUpdate[i];
|
||||
installObj[e.name + " " + e.version] = e.xpiURL;
|
||||
}
|
||||
if (InstallTrigger.updateEnabled())
|
||||
InstallTrigger.install(installObj);
|
||||
|
||||
document.documentElement.acceptDialog();
|
||||
break;
|
||||
/*
|
||||
case "update-start":
|
||||
dump("*** update-start: " + aSubject + ", " + aData + "\n");
|
||||
break;
|
||||
case "update-item-network-start":
|
||||
dump("*** update-item-network-start: " + aSubject + ", " + aData + "\n");
|
||||
break;
|
||||
case "update-item-network-end":
|
||||
dump("*** update-item-network-end: " + aSubject + ", " + aData + "\n");
|
||||
break;
|
||||
case "update-item-processing-start":
|
||||
dump("*** update-item-processing-start: " + aSubject + ", " + aData + "\n");
|
||||
break;
|
||||
case "update-item-processing-end":
|
||||
dump("*** update-item-processing-end: " + aSubject + ", " + aData + "\n");
|
||||
break;
|
||||
case "update-item-error":
|
||||
dump("*** update-item-error: " + aSubject + ", " + aData + "\n");
|
||||
break;
|
||||
case "update-end":
|
||||
dump("*** update-end: " + aSubject + ", " + aData + "\n");
|
||||
|
||||
// Report Status
|
||||
|
||||
// Unhook observers
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
for (var i = 0; i < this._messages.length; ++i)
|
||||
os.removeObserver(this, this._messages[i]);
|
||||
|
||||
break;
|
||||
*/
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/extensions/update.dtd">
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
|
||||
%updateDTD;
|
||||
%brandDTD;
|
||||
]>
|
||||
|
||||
<dialog id="updateProgress" title="&update.title;"
|
||||
style="width: 30em;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="cancel"
|
||||
onload="gUpdateDialog.init();"
|
||||
onunload="gUpdateDialog.uninit();"
|
||||
ondialogcancel="gUpdateDialog.cancel();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/extensions/update.js"/>
|
||||
|
||||
<stringbundleset id="updateSet">
|
||||
<stringbundle id="brandStrings" src="chrome://global/locale/brand.properties"/>
|
||||
<stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<label>&intro.label;</label>
|
||||
|
||||
<description id="items"/>
|
||||
|
||||
<progressmeter id="progress"/>
|
||||
|
||||
<description id="status"/>
|
||||
|
||||
</dialog>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<!ENTITY extensions.title "Extensions">
|
||||
|
||||
<!ENTITY cmd.info.commandKey "i">
|
||||
<!ENTITY cmd.options.commandKey ",">
|
||||
<!ENTITY cmd.close.commandKey "w">
|
||||
|
||||
<!-- Command Bar items -->
|
||||
<!ENTITY cmd.uninstall.label "Uninstall">
|
||||
<!ENTITY cmd.uninstall.tooltip "Uninstalls the selected Extension">
|
||||
<!ENTITY cmd.uninstall.accesskey "i">
|
||||
<!ENTITY cmd.update.label "Update">
|
||||
<!ENTITY cmd.update.accesskey "U">
|
||||
<!ENTITY cmd.update.tooltip "Checks for Updates to your Extensions">
|
||||
<!ENTITY cmd.useTheme.label " Use Theme">
|
||||
<!ENTITY cmd.useTheme.accesskey "U">
|
||||
<!ENTITY cmd.useTheme.tooltip "Changes &brandShortName;'s theme.">
|
||||
<!-- the following command bar items are used by thunderbird only -->
|
||||
<!ENTITY cmd.install.label "Install">
|
||||
<!ENTITY cmd.install.tooltip "Install an extension">
|
||||
<!ENTITY cmd.install.accesskey "n">
|
||||
|
||||
<!-- Context Menu Options: Extension -->
|
||||
<!ENTITY cmd.options.label "Options">
|
||||
<!ENTITY cmd.options.accesskey "O">
|
||||
<!ENTITY cmd.optionsUnix.label "Preferences">
|
||||
<!ENTITY cmd.optionsUnix.accesskey "r">
|
||||
<!ENTITY cmd.homepage.label "Visit Home Page">
|
||||
<!ENTITY cmd.homepage.accesskey "H">
|
||||
<!ENTITY cmd.about.label "About this Extension">
|
||||
<!ENTITY cmd.about.accesskey "A">
|
||||
<!ENTITY cmd.uninstall.label "Uninstall">
|
||||
<!ENTITY cmd.uninstall.accesskey "i">
|
||||
<!ENTITY cmd.update.label "Update">
|
||||
<!ENTITY cmd.update.accesskey "U">
|
||||
<!ENTITY cmd.enable.label "Enable">
|
||||
<!ENTITY cmd.enable.accesskey "E">
|
||||
<!ENTITY cmd.disable.label "Disable">
|
||||
<!ENTITY cmd.disable.accesskey "D">
|
||||
<!ENTITY cmd.moveToTop.label "Move to Top">
|
||||
<!ENTITY cmd.moveToTop.accesskey "T">
|
||||
<!ENTITY cmd.moveUp.label "Move Up">
|
||||
<!ENTITY cmd.moveUp.accesskey "p">
|
||||
<!ENTITY cmd.moveDn.label "Move Down">
|
||||
<!ENTITY cmd.moveDn.accesskey "w">
|
||||
|
||||
<!-- Extension Items -->
|
||||
<!ENTITY options.tooltip "Options">
|
||||
<!ENTITY optionsUnix.tooltip "Preferences">
|
||||
<!ENTITY about.tooltip "About">
|
||||
<!ENTITY homepage.tooltip "Home Page">
|
||||
|
||||
<!ENTITY extensionItem.toBeDisabled.label "This item will be disabled after you restart &brandShortName;.">
|
||||
<!ENTITY extensionItem.toBeEnabled.label "This item will be enabled after you restart &brandShortName;.">
|
||||
<!ENTITY extensionItem.toBeInstalled.label "This item will be installed after you restart &brandShortName;.">
|
||||
<!ENTITY extensionItem.toBeUninstalled.label "This item will be uninstalled after you restart &brandShortName;.">
|
||||
<!ENTITY extensionItem.done.label "Install Success">
|
||||
<!ENTITY extensionItem.waiting.label "Waiting...">
|
||||
<!ENTITY extensionItem.installing.label "Installing...">
|
||||
|
||||
<!ENTITY getMoreExtensions.label "Get More Extensions">
|
||||
<!ENTITY getMoreExtensions.tooltip "Get More Extensions from update.mozilla.org">
|
||||
<!ENTITY getMoreThemes.label "Get More Themes">
|
||||
<!ENTITY getMoreThemes.tooltip "Get More Themes from update.mozilla.org">
|
||||
|
||||
<!ENTITY previewNoThemeSelected.label "No Theme Selected">
|
||||
<!ENTITY previewNoPreviewImage.label "This Theme does not have a Preview Image">
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
aboutWindowTitle=About %S
|
||||
aboutWindowCloseButton=Close
|
||||
aboutWindowVersionString=version %S
|
||||
aboutExtension=About %S...
|
||||
restartBeforeEnableTitle=Enable Extension
|
||||
restartBeforeDisableTitle=Disable Extension
|
||||
restartBeforeEnableMessage=%S will be enabled the next time you restart %S.
|
||||
restartBeforeDisableMessage=%S will be disabled the next time you restart %S.
|
||||
restartBeforeUninstallTitle=Uninstall
|
||||
restartBeforeUninstallMessage=%S will be uninstalled the next time you restart %S.
|
||||
queryUninstallExtensionMessage=If you uninstall %S, the functionality it offers will no longer be available. Do you want to uninstall %S?
|
||||
queryUninstallThemeMessage=Do you want to uninstall %S?
|
||||
queryUninstallTitle=Uninstall %S
|
||||
|
||||
update.extensions.wsdl=http://update.mozilla.org:8080/axis/services/VersionCheck?wsdl
|
||||
extensions.getMoreExtensionsURL=http://update.mozilla.org/extensions/?application=%APPID%
|
||||
extensions.getMoreThemesURL=http://update.mozilla.org/themes/?application=%APPID%
|
||||
|
||||
themesTitle=Themes
|
||||
extensionsTitle=Extensions
|
||||
|
||||
|
||||
globalItemList=The following items are available to all users. \nYou can start Firefox with -lock-item "{GUID}" to prevent users from uninstalling or disabling an item. To unlock an item, start Firefox with -unlock-item "{GUID}"
|
||||
globalItemListExtensions=\n\nGlobally Available Extensions:\n==============================\n\n
|
||||
globalItemListThemes=\n\nGlobally Available Themes:\n==========================\n\n
|
||||
|
||||
installSuccess=Installed Successfully
|
||||
|
||||
statusFormatKBKB=#1 of #2 KB
|
||||
statusFormatKBMB=#1 KB of #2 MB
|
||||
statusFormatMBMB=#1 of #2 MB
|
||||
|
||||
disabledObsoleteTitle=Old Extensions
|
||||
disabledObsoleteMessage=Any old extensions that you have installed have been disabled.
|
||||
|
||||
incompatibleTitle=Incompatible Extension
|
||||
incompatibleMessage=%S %S could not be installed because it is not compatible with this version of %S. (%S %S will only work with %S versions from %S to %S)
|
||||
incompatibleMessageSingleAppVersion=%S %S could not be installed because it is not compatible with this version of %S. (%S %S will only work with %S %S)
|
||||
|
||||
malformedMessage=%S could not install this item because "%S" (provided by the item) is malformed. Please contact the author about this problem.
|
||||
malformedTitle=Malformed File
|
||||
|
||||
invalidVersionMessage=%S could not install "%S" because its version information ("%S") is invalid. Please contact the author about this problem.
|
||||
invalidVersionTitle=Invalid Version
|
||||
|
||||
# The following are used by Thunderbird only in order to provide a way to load
|
||||
# extension and JAR files.
|
||||
|
||||
extensionFilter=Extensions (*.xpi)
|
||||
themesFilter=Themes (*.jar)
|
||||
installThemePickerTitle=Select a theme to install
|
||||
installExtensionPickerTitle=Select an extension to install
|
|
@ -0,0 +1,50 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = extensions
|
||||
XPIDL_MODULE = extensions
|
||||
|
||||
XPIDLSRCS = nsIExtensionManager.idl
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Extension Manager.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIFile;
|
||||
interface nsIRDFDataSource;
|
||||
interface nsIUpdateItem;
|
||||
|
||||
[scriptable, uuid(9048223f-ec50-49e5-9866-80ee8f26179d)]
|
||||
interface nsIExtensionDownloadProgressListener : nsISupports
|
||||
{
|
||||
void onStateChange(in wstring aURL, in short aState, in long aValue);
|
||||
|
||||
void onProgress(in wstring aURL, in unsigned long aValue, in unsigned long aMaxValue);
|
||||
};
|
||||
|
||||
[scriptable, uuid(c3515b0f-99f4-453b-805e-1fdf5724d6d9)]
|
||||
interface nsIExtensionManager : nsISupports
|
||||
{
|
||||
// Apprunner hooks
|
||||
boolean start(in boolean aIsDirty);
|
||||
|
||||
/**
|
||||
* Returns true if mismatches were found and the app needs to restart.
|
||||
*/
|
||||
boolean checkForMismatches();
|
||||
|
||||
void handleCommandLineArgs();
|
||||
|
||||
// Installing Extensions
|
||||
const unsigned long FLAG_INSTALL_PROFILE = 0x01;
|
||||
const unsigned long FLAG_INSTALL_GLOBAL = 0x02;
|
||||
|
||||
void installExtension(in nsIFile aXPIFile, in unsigned long aFlags);
|
||||
void uninstallExtension(in string aExtensionID);
|
||||
void enableExtension(in string aExtensionID);
|
||||
void disableExtension(in string aExtensionID);
|
||||
|
||||
// Installing Themes
|
||||
void installTheme(in nsIFile aJARFile, in unsigned long aFlags);
|
||||
void uninstallTheme(in string aThemeID);
|
||||
|
||||
// Downloads
|
||||
void addDownloads([array, size_is(aItemCount)] in nsIUpdateItem aItems,
|
||||
in unsigned long aItemCount);
|
||||
void removeDownload(in wstring aURL, in unsigned short aType);
|
||||
long addDownloadObserver(in nsIExtensionDownloadProgressListener aObserver);
|
||||
void removeDownloadObserverAt(in long aIndex);
|
||||
|
||||
readonly attribute boolean inSafeMode;
|
||||
|
||||
// Updates
|
||||
void update([array, size_is(aItemCount)] in nsIUpdateItem aItems,
|
||||
in unsigned long aItemCount);
|
||||
|
||||
// Management
|
||||
void getItemList(in string aItemID,
|
||||
in unsigned short aType,
|
||||
out unsigned long aItemCount,
|
||||
[retval, array, size_is(aItemCount)] out nsIUpdateItem aItems);
|
||||
|
||||
void moveUp(in string aItemID);
|
||||
void moveDown(in string aItemID);
|
||||
void moveTop(in string aItemID);
|
||||
|
||||
readonly attribute nsIRDFDataSource datasource;
|
||||
};
|
||||
|
||||
[scriptable, uuid(c0b7517f-0b3a-41a2-bde8-ba3ac8a5af47)]
|
||||
interface nsIExtensionItemUpdater : nsISupports
|
||||
{
|
||||
void checkForUpdates();
|
||||
|
||||
readonly attribute unsigned short sourceEvent;
|
||||
readonly attribute unsigned short updateTypes;
|
||||
};
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package org.mozilla.update.extensions;
|
||||
|
||||
public class UpdateItem
|
||||
{
|
||||
private int row;
|
||||
private java.lang.String id;
|
||||
private java.lang.String version;
|
||||
private java.lang.String name;
|
||||
private java.lang.String updateURL;
|
||||
private java.lang.String iconURL;
|
||||
private int type;
|
||||
|
||||
public UpdateItem()
|
||||
{
|
||||
}
|
||||
|
||||
public int getRow()
|
||||
{
|
||||
return row;
|
||||
}
|
||||
|
||||
public void setRow(int row)
|
||||
{
|
||||
this.row = row;
|
||||
}
|
||||
|
||||
public java.lang.String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(java.lang.String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public java.lang.String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(java.lang.String version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public java.lang.String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(java.lang.String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public java.lang.String getUpdateURL()
|
||||
{
|
||||
return updateURL;
|
||||
}
|
||||
|
||||
public void setUpdateURL(java.lang.String updateURL)
|
||||
{
|
||||
this.updateURL = updateURL;
|
||||
}
|
||||
|
||||
public java.lang.String getIconURL()
|
||||
{
|
||||
return iconURL;
|
||||
}
|
||||
|
||||
public void setIconURL(java.lang.String iconURL)
|
||||
{
|
||||
this.iconURL = iconURL;
|
||||
}
|
||||
|
||||
public int getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
//public class ExtensionType
|
||||
//{
|
||||
// public ExtensionType()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public int row;
|
||||
// public String id;
|
||||
// public String version;
|
||||
// public String name;
|
||||
// public String updateURL;
|
||||
// public String iconURL;
|
||||
// public int type;
|
||||
//}
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Extension Manager.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
package org.mozilla.update.extensions;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
public class VersionCheck
|
||||
{
|
||||
public VersionCheck()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
public static void main(String[] args)
|
||||
{
|
||||
VersionCheck impl = new VersionCheck();
|
||||
// int id = impl.getNewestExtension("{bb8ee064-ccb9-47fc-94ae-ec335af3fe2d}", "3.0", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "0.8.0+");
|
||||
int id = impl.getNewestExtension("{93c4cb22-bf10-40a2-adff-c4c64a38df0c}", "1.5", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "0.8.0+");
|
||||
System.out.println("result row = " + id + ", xpiUrl = " + impl.getProperty(id, "xpiurl"));
|
||||
}
|
||||
*/
|
||||
|
||||
public UpdateItem[] getExtensionsToUpdate(UpdateItem[] aItems, String aTargetApp, String aTargetAppVersion)
|
||||
{
|
||||
Vector results = new Vector();
|
||||
for (int i = 0; i < aItems.length; ++i)
|
||||
{
|
||||
UpdateItem e = aItems[i];
|
||||
int row = getNewestExtension(e.getId(), e.getVersion(), aTargetApp, aTargetAppVersion);
|
||||
if (row != -1)
|
||||
{
|
||||
e.setRow(row);
|
||||
e.setId(getProperty(row, "guid"));
|
||||
e.setName(getProperty(row, "name"));
|
||||
e.setVersion(getProperty(row, "version"));
|
||||
e.setUpdateURL(getProperty(row, "updateurl"));
|
||||
e.setIconURL(getProperty(row, "iconurl"));
|
||||
results.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
return (UpdateItem[])results.toArray();
|
||||
}
|
||||
|
||||
// This method is a temporary workaround until Mozilla's Web Services implementation
|
||||
// supports passing Arrays of complex types.
|
||||
public UpdateItem getNewestExtension(UpdateItem aItem,
|
||||
String aTargetApp,
|
||||
String aTargetAppVersion)
|
||||
{
|
||||
UpdateItem e = new UpdateItem();
|
||||
|
||||
int row = getNewestExtension(aItem.getId(), aItem.getVersion(),
|
||||
aTargetApp, aTargetAppVersion);
|
||||
if (row != -1)
|
||||
{
|
||||
e.setRow(row);
|
||||
e.setId(getProperty(row, "guid"));
|
||||
e.setName(getProperty(row, "name"));
|
||||
e.setVersion(getProperty(row, "version"));
|
||||
e.setUpdateURL(getProperty(row, "updateurl"));
|
||||
e.setIconURL(getProperty(row, "iconurl"));
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
protected String getProperty(int aRowID, String aProperty)
|
||||
{
|
||||
String result = null;
|
||||
try
|
||||
{
|
||||
Connection c = getConnection();
|
||||
Statement s = c.createStatement();
|
||||
|
||||
String sql = "SELECT * FROM extensions WHERE id = '" + aRowID + "'";
|
||||
ResultSet rs = s.executeQuery(sql);
|
||||
|
||||
result = rs.next() ? rs.getString(aProperty) : null;
|
||||
if (result == null)
|
||||
result = "query succeeded, but null!";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected int getNewestExtension(String aExtensionGUID, String aInstalledVersion, String aTargetApp, String aTargetAppVersion)
|
||||
{
|
||||
int id = -1;
|
||||
int extensionVersionParts = getPartCount(aInstalledVersion);
|
||||
int targetAppVersionParts = getPartCount(aTargetAppVersion);
|
||||
|
||||
int extensionVersion = parseVersion(aInstalledVersion, extensionVersionParts);
|
||||
int targetAppVersion = parseVersion(aTargetAppVersion, targetAppVersionParts);
|
||||
|
||||
Connection c;
|
||||
Statement s;
|
||||
ResultSet rs;
|
||||
try
|
||||
{
|
||||
c = getConnection();
|
||||
s = c.createStatement();
|
||||
|
||||
// We need to find all rows matching aExtensionGUID, and filter like so:
|
||||
// 1) version > extensionVersion
|
||||
// 2) targetapp == aTargetApp
|
||||
// 3) mintargetappversion <= targetAppVersion <= maxtargetappversion
|
||||
String sql = "SELECT * FROM extensions WHERE guid = '" + aExtensionGUID + "' AND targetapp = '" + aTargetApp + "'";
|
||||
|
||||
boolean goat = s.execute(sql);
|
||||
rs = s.getResultSet();
|
||||
|
||||
int newestExtensionVersion = extensionVersion;
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
int minTargetAppVersion = parseVersion(rs.getString("mintargetappversion"), targetAppVersionParts);
|
||||
int maxTargetAppVersion = parseVersion(rs.getString("maxtargetappversion"), targetAppVersionParts);
|
||||
|
||||
int version = parseVersion(rs.getString("version"), extensionVersionParts);
|
||||
if (version > extensionVersion &&
|
||||
version > newestExtensionVersion &&
|
||||
minTargetAppVersion <= targetAppVersion &&
|
||||
targetAppVersion < maxTargetAppVersion)
|
||||
{
|
||||
newestExtensionVersion = version;
|
||||
id = rs.getInt("id");
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
s.close();
|
||||
c.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
protected int parseVersion(String aVersionString, int aPower)
|
||||
{
|
||||
int version = 0;
|
||||
StringTokenizer tokenizer = new StringTokenizer(aVersionString, ".");
|
||||
|
||||
if (aPower == 0)
|
||||
aPower = tokenizer.countTokens();
|
||||
|
||||
for (int i = 0; tokenizer.hasMoreTokens(); ++i)
|
||||
{
|
||||
String token = tokenizer.nextToken();
|
||||
if (token.endsWith("+"))
|
||||
{
|
||||
token = token.substring(0, token.lastIndexOf("+"));
|
||||
version += 1;
|
||||
if (token.length() == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
version += Integer.parseInt(token) * Math.pow(10, aPower - i);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
protected int getPartCount(String aVersionString)
|
||||
{
|
||||
return (new StringTokenizer(aVersionString, ".")).countTokens();
|
||||
}
|
||||
|
||||
protected Connection getConnection() throws Exception
|
||||
{
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
return DriverManager.getConnection("jdbc:mysql://localhost/umo_extensions", "root", "");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = extensions
|
||||
|
||||
EXTRA_COMPONENTS = nsExtensionManager.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
nsExtensionManager.js: nsExtensionManager.js.in
|
||||
$(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) $^ > $@
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,205 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Rich ScrollView.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2003-2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
<bindings id="richViewBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="richview-item">
|
||||
<implementation>
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var e = document.createEvent("Events");
|
||||
e.initEvent(this.eventPrefix + aEventType, false, true);
|
||||
|
||||
this.dispatchEvent(e);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="disabled" onget="return this.getAttribute('disabled') == 'true'"
|
||||
onset="this.setAttribute('disabled', val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="richview">
|
||||
<implementation>
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var e = document.createEvent("Events");
|
||||
var eventType = "richview-" + aEventType;
|
||||
e.initEvent(eventType, false, true);
|
||||
this.dispatchEvent(e);
|
||||
|
||||
var handler = this.getAttribute("onrichview-" + aEventType);
|
||||
if (handler != "") {
|
||||
var fn = new Function("event", handler);
|
||||
fn(e);
|
||||
}
|
||||
document.commandDispatcher.updateCommands(eventType);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="_selected">null</field>
|
||||
<property name="selected">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this._selected)
|
||||
this._selected.removeAttribute("selected");
|
||||
this._selected = val;
|
||||
if (this._selected)
|
||||
this._selected.setAttribute("selected", "true");
|
||||
|
||||
this.fireEvent("select");
|
||||
]]>
|
||||
</setter>
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this._selected;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="selectForwardInternal">
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
for (var temp = aElement; temp; temp = temp.nextSibling) {
|
||||
if ("fireEvent" in temp) {
|
||||
this.selected = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectBackwardInternal">
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
for (var temp = aElement; temp; temp = temp.previousSibling) {
|
||||
if ("fireEvent" in temp) {
|
||||
this.selected = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectionForward">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selected)
|
||||
this.selectForwardInternal(this.selected.nextSibling);
|
||||
else {
|
||||
if (this.hasChildNodes())
|
||||
this.selectForwardInternal(this.firstChild);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectionBackward">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selected)
|
||||
this.selectBackwardInternal(this.selected.previousSibling);
|
||||
else {
|
||||
if (this.hasChildNodes())
|
||||
this.selectBackwardInternal(this.lastChild);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="children">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var childNodes = [];
|
||||
for (var i = 0; i < this.childNodes.length; ++i) {
|
||||
if ("fireEvent" in this.childNodes[i])
|
||||
childNodes.push(this.childNodes[i]);
|
||||
}
|
||||
return childNodes;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
if (event.ctrlKey) {
|
||||
this.selected = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target == this)
|
||||
this.selected = null
|
||||
else
|
||||
this.selected = event.target;
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="dblclick" action="if (this.selected && event.button == 0) this.selected.fireEvent('open');"/>
|
||||
<handler event="keypress" keycode="vk_enter" action="if (this.selected) this.selected.fireEvent('open');"/>
|
||||
<handler event="keypress" keycode="vk_return" action="if (this.selected) this.selected.fireEvent('open');"/>
|
||||
<handler event="keypress" keycode="vk_up" action="this.selectionBackward(event);"/>
|
||||
<handler event="keypress" keycode="vk_left" action="this.selectionBackward(event);"/>
|
||||
<handler event="keypress" keycode="vk_down" action="this.selectionForward(event);"/>
|
||||
<handler event="keypress" keycode="vk_right" action="this.selectionForward(event);"/>
|
||||
<handler event="keypress" keycode="vk_up" modifiers="meta" action="this.selected = null"/>
|
||||
<handler event="keypress" keycode="vk_down" modifiers="meta" action="this.selected = null"/>
|
||||
<handler event="keypress" keycode="vk_left" modifiers="meta" action="this.selected = null"/>
|
||||
<handler event="keypress" keycode="vk_right" modifiers="meta" action="this.selected = null"/>
|
||||
<handler event="keypress" keycode="vk_delete" action="if (this.selected) this.selected.fireEvent('remove');"/>
|
||||
<handler event="keypress" key=" " action="if (this.selected) { this.selected.pauseResume(); }"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Update Service.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://mozapps/locale/update/errors.dtd">
|
||||
|
||||
<dialog id="errors"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&errors.title;"
|
||||
onload="init()"
|
||||
style="width: 28em;"
|
||||
buttons="cancel">
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
function init()
|
||||
{
|
||||
var state = window.arguments[0].state;
|
||||
var brandShortName = document.getElementById("brandStrings").getString("brandShortName");
|
||||
var str = document.getElementById("updateStrings").getFormattedString(state + "ErrorDescription", [brandShortName]);
|
||||
document.getElementById("intro").appendChild(document.createTextNode(str));
|
||||
|
||||
var items = window.arguments[0].errors;
|
||||
var listbox = document.getElementById("extensions");
|
||||
for (var i = 0; i < items.length; ++i) {
|
||||
if (items[i].error) {
|
||||
var listitem = document.createElement("listitem");
|
||||
listitem.setAttribute("label", items[i].name);
|
||||
listbox.appendChild(listitem);
|
||||
}
|
||||
}
|
||||
var strings = document.getElementById("updateStrings");
|
||||
var cancel = document.documentElement.getButton("cancel");
|
||||
cancel.label = strings.getString("closeButton");
|
||||
cancel.focus();
|
||||
}
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<stringbundleset id="updateSet">
|
||||
<stringbundle id="brandStrings" src="chrome://global/locale/brand.properties"/>
|
||||
<stringbundle id="updateStrings" src="chrome://mozapps/locale/update/update.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<description id="intro"/>
|
||||
<separator/>
|
||||
<listbox id="extensions" rows="7"/>
|
||||
<separator/>
|
||||
|
||||
</dialog>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
updateitem {
|
||||
-moz-binding: url("chrome://mozapps/content/update/updates.xml#updateItem");
|
||||
display: -moz-box;
|
||||
}
|
||||
|
|
@ -0,0 +1,577 @@
|
|||
//
|
||||
// window.arguments[1...] is an array of nsIUpdateItem implementing objects
|
||||
// that are to be updated.
|
||||
// * if the array is empty, all items are updated (like a background update
|
||||
// check)
|
||||
// * if the array contains one or two UpdateItems, with null id fields,
|
||||
// all items of that /type/ are updated.
|
||||
//
|
||||
// This UI can be opened from the following places, and in the following modes:
|
||||
//
|
||||
// - from the Version Compatibility Checker at startup
|
||||
// as the application starts a check is done to see if the application being
|
||||
// started is the same version that was started last time. If it isn't, a
|
||||
// list of UpdateItems that are incompatible with the verison being
|
||||
// started is generated and this UI opened with that list. This UI then
|
||||
// offers to check for updates to those UpdateItems that are compatible
|
||||
// with the version of the application being started.
|
||||
//
|
||||
// In this mode, the wizard is opened to panel 'mismatch'.
|
||||
//
|
||||
// - from the Extension Manager or Options Dialog or any UI where the user
|
||||
// directly requests to check for updates.
|
||||
// in this case the user selects UpdateItem(s) to update and this list
|
||||
// is passed to this UI. If a single item is sent with the id field set to
|
||||
// null but the type set correctly, this UI will check for updates to all
|
||||
// items of that type.
|
||||
//
|
||||
// In this mode, the wizard is opened to panel 'checking'.
|
||||
//
|
||||
// - from the Updates Available Status Bar notification.
|
||||
// in this case the background update checking has determined there are new
|
||||
// updates that can be installed and has prepared a list for the user to see.
|
||||
// They can update by clicking on a status bar icon which passes the list
|
||||
// to this UI which lets them choose to install updates.
|
||||
//
|
||||
// In this mode, the wizard is opened to panel 'updatesFound' if the data
|
||||
// set is immediately available, or 'checking' if the user closed the browser
|
||||
// since the last background check was performed and the check needs to be
|
||||
// performed again.
|
||||
//
|
||||
|
||||
const nsIUpdateItem = Components.interfaces.nsIUpdateItem;
|
||||
const nsIUpdateService = Components.interfaces.nsIUpdateService;
|
||||
const nsIExtensionManager = Components.interfaces.nsIExtensionManager;
|
||||
|
||||
const PREF_APP_ID = "app.id";
|
||||
const PREF_UPDATE_APP_UPDATESAVAILABLE = "update.app.updatesAvailable";
|
||||
const PREF_UPDATE_EXTENSIONS_ENABLED = "update.extensions.enabled";
|
||||
|
||||
var gSourceEvent = null;
|
||||
var gUpdateTypes = null;
|
||||
|
||||
var gUpdateWizard = {
|
||||
// The items to check for updates for (e.g. an extension, some subset of extensions,
|
||||
// all extensions, a list of compatible extensions, etc...)
|
||||
items: [],
|
||||
// The items that we found updates available for
|
||||
itemsToUpdate: [],
|
||||
// The items that we successfully installed updates for
|
||||
updatedCount: 0,
|
||||
appUpdatesAvailable: false,
|
||||
|
||||
shouldSuggestAutoChecking: false,
|
||||
shouldAutoCheck: false,
|
||||
|
||||
updatingApp: false,
|
||||
|
||||
init: function ()
|
||||
{
|
||||
gUpdateTypes = window.arguments[0];
|
||||
gSourceEvent = window.arguments[1];
|
||||
for (var i = 2; i < window.arguments.length; ++i)
|
||||
this.items.push(window.arguments[i].QueryInterface(nsIUpdateItem));
|
||||
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
this.shouldSuggestAutoChecking = (gSourceEvent == nsIUpdateService.SOURCE_EVENT_MISMATCH) &&
|
||||
!pref.getBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED);
|
||||
|
||||
if (gSourceEvent == nsIUpdateService.SOURCE_EVENT_USER) {
|
||||
document.getElementById("mismatch").setAttribute("next", "checking");
|
||||
document.documentElement.advance();
|
||||
}
|
||||
|
||||
gMismatchPage.init();
|
||||
},
|
||||
|
||||
uninit: function ()
|
||||
{
|
||||
gUpdatePage.uninit();
|
||||
},
|
||||
|
||||
onWizardFinish: function ()
|
||||
{
|
||||
if (this.shouldSuggestAutoChecking) {
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
pref.setBoolPref("update.extensions.enabled", this.shouldAutoCheck);
|
||||
}
|
||||
|
||||
if (this.updatingApp) {
|
||||
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIUpdateService);
|
||||
# If we're not a browser, use the external protocol service to load the URI.
|
||||
#ifndef MOZ_PHOENIX
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = updates.appUpdateURL;
|
||||
|
||||
var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
|
||||
.getService(Components.interfaces.nsIExternalProtocolService);
|
||||
if (protocolSvc.isExposedProtocol(uri.scheme))
|
||||
protocolSvc.loadUrl(uri);
|
||||
# If we're a browser, open a new browser window instead.
|
||||
#else
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
var ary = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var url = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
url.data = updates.appUpdateURL;
|
||||
ary.AppendElement(url);
|
||||
ww.openWindow(null, "chrome://browser/content/browser.xul",
|
||||
"_blank", "chrome,all,dialog=no", ary);
|
||||
#endif
|
||||
}
|
||||
},
|
||||
|
||||
_setUpButton: function (aButtonID, aButtonKey, aDisabled)
|
||||
{
|
||||
var strings = document.getElementById("updateStrings");
|
||||
var button = document.documentElement.getButton(aButtonID);
|
||||
if (aButtonKey) {
|
||||
button.label = strings.getString(aButtonKey);
|
||||
try {
|
||||
button.accesskey = strings.getString(aButtonKey + "Accesskey");
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
button.disabled = aDisabled;
|
||||
},
|
||||
|
||||
setButtonLabels: function (aBackButton, aBackButtonIsDisabled,
|
||||
aNextButton, aNextButtonIsDisabled,
|
||||
aCancelButton, aCancelButtonIsDisabled)
|
||||
{
|
||||
|
||||
this._setUpButton("back", aBackButton, aBackButtonIsDisabled);
|
||||
this._setUpButton("next", aNextButton, aNextButtonIsDisabled);
|
||||
this._setUpButton("cancel", aCancelButton, aCancelButtonIsDisabled);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Update Errors
|
||||
errorItems: [],
|
||||
errorOnApp: false,
|
||||
|
||||
showErrors: function (aState, aErrors)
|
||||
{
|
||||
openDialog("chrome://mozapps/content/update/errors.xul", "",
|
||||
"modal", { state: aState, errors: aErrors });
|
||||
},
|
||||
|
||||
showUpdateCheckErrors: function ()
|
||||
{
|
||||
var errors = [];
|
||||
for (var i = 0; i < this.errorItems.length; ++i)
|
||||
errors.push({ name: this.errorItems[i].name, error: true });
|
||||
|
||||
if (this.errorOnApp) {
|
||||
var brandShortName = document.getElementById("brandStrings").getString("brandShortName");
|
||||
errors.push({ name: brandShortName, error: true });
|
||||
}
|
||||
|
||||
this.showErrors("checking", errors);
|
||||
},
|
||||
|
||||
checkForErrors: function (aElementIDToShow)
|
||||
{
|
||||
if (this.errorOnGeneric || this.errorItems.length > 0 || this.errorOnApp)
|
||||
document.getElementById(aElementIDToShow).hidden = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var gMismatchPage = {
|
||||
init: function ()
|
||||
{
|
||||
var incompatible = document.getElementById("mismatch.incompatible");
|
||||
for (var i = 0; i < gUpdateWizard.items.length; ++i) {
|
||||
var item = gUpdateWizard.items[i];
|
||||
var listitem = document.createElement("listitem");
|
||||
listitem.setAttribute("label", item.name + " " + item.version);
|
||||
incompatible.appendChild(listitem);
|
||||
}
|
||||
},
|
||||
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"mismatchCheckNow", false,
|
||||
"mismatchDontCheck", false);
|
||||
document.documentElement.getButton("next").focus();
|
||||
}
|
||||
};
|
||||
|
||||
var gUpdatePage = {
|
||||
_completeCount: 0,
|
||||
_updateState: 0,
|
||||
_messages: ["Update:Extension:Started",
|
||||
"Update:Extension:Ended",
|
||||
"Update:Extension:Item-Started",
|
||||
"Update:Extension:Item-Ended",
|
||||
"Update:Extension:Item-Error",
|
||||
"Update:App:Ended",
|
||||
"Update:Ended"],
|
||||
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
"cancelButtonText", true);
|
||||
document.documentElement.getButton("next").focus();
|
||||
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
for (var i = 0; i < this._messages.length; ++i)
|
||||
os.addObserver(this, this._messages[i], false);
|
||||
|
||||
gUpdateWizard.errorItems = [];
|
||||
|
||||
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIUpdateService);
|
||||
updates.checkForUpdatesInternal(gUpdateWizard.items, gUpdateWizard.items.length,
|
||||
gUpdateTypes, gSourceEvent);
|
||||
|
||||
this._updateState = nsIUpdateService.UPDATED_NONE;
|
||||
},
|
||||
|
||||
uninit: function ()
|
||||
{
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
for (var i = 0; i < this._messages.length; ++i)
|
||||
os.removeObserver(this, this._messages[i]);
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData)
|
||||
{
|
||||
var canFinish = false;
|
||||
switch (aTopic) {
|
||||
case "Update:Extension:Started":
|
||||
break;
|
||||
case "Update:Extension:Item-Started":
|
||||
break;
|
||||
case "Update:Extension:Item-Ended":
|
||||
var item = aSubject.QueryInterface(Components.interfaces.nsIUpdateItem);
|
||||
gUpdateWizard.itemsToUpdate.push(item);
|
||||
|
||||
++this._completeCount;
|
||||
|
||||
var progress = document.getElementById("checking.progress");
|
||||
progress.value = Math.ceil(this._completeCount / gUpdateWizard.itemsToUpdate.length) * 100;
|
||||
|
||||
break;
|
||||
case "Update:Extension:Item-Error":
|
||||
if (aSubject) {
|
||||
var item = aSubject.QueryInterface(Components.interfaces.nsIUpdateItem);
|
||||
gUpdateWizard.errorItems.push(item);
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < gUpdateWizard.items.length; ++i) {
|
||||
if (!gUpdateWizard.items[i].updateRDF)
|
||||
gUpdateWizard.errorItems.push(gUpdateWizard.items[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Update:Extension:Ended":
|
||||
// If we were passed a set of extensions/themes/other to update, this
|
||||
// means we're not checking for app updates, so don't wait for the app
|
||||
// update to complete before advancing (because there is none).
|
||||
// canFinish = gUpdateWizard.items.length > 0;
|
||||
// XXXben
|
||||
break;
|
||||
case "Update:Ended":
|
||||
// If we're doing a general update check, (that is, no specific extensions/themes
|
||||
// were passed in for us to check for updates to), this notification means both
|
||||
// extension and app updates have completed.
|
||||
canFinish = true;
|
||||
break;
|
||||
case "Update:App:Error":
|
||||
gUpdateWizard.errorOnApp = true;
|
||||
break;
|
||||
case "Update:App:Ended":
|
||||
// The "Updates Found" page of the update wizard needs to know if it there are app
|
||||
// updates so it can list them first.
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
gUpdateWizard.appUpdatesAvailable = pref.getBoolPref(PREF_UPDATE_APP_UPDATESAVAILABLE);
|
||||
|
||||
if (gUpdateWizard.appUpdatesAvailable) {
|
||||
var appID = pref.getCharPref(PREF_APP_ID);
|
||||
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIUpdateService);
|
||||
|
||||
|
||||
var brandShortName = document.getElementById("brandStrings").getString("brandShortName");
|
||||
var item = Components.classes["@mozilla.org/updates/item;1"]
|
||||
.createInstance(Components.interfaces.nsIUpdateItem);
|
||||
item.init(appID, updates.appUpdateVersion,
|
||||
brandShortName, -1, updates.appUpdateURL,
|
||||
"chrome://mozapps/skin/update/icon32.png",
|
||||
"", nsIUpdateItem.TYPE_APP);
|
||||
gUpdateWizard.itemsToUpdate.splice(0, 0, item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (canFinish) {
|
||||
if (gUpdateWizard.itemsToUpdate.length > 0 || gUpdateWizard.appUpdatesAvailable)
|
||||
document.getElementById("checking").setAttribute("next", "found");
|
||||
document.documentElement.advance();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var gFoundPage = {
|
||||
_appUpdateExists: false,
|
||||
_appSelected: false,
|
||||
_appItem: null,
|
||||
_nonAppItems: [],
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"installButtonText", false,
|
||||
null, false);
|
||||
document.documentElement.getButton("next").focus();
|
||||
|
||||
var list = document.getElementById("foundList");
|
||||
for (var i = 0; i < gUpdateWizard.itemsToUpdate.length; ++i) {
|
||||
var updateitem = document.createElement("updateitem");
|
||||
list.appendChild(updateitem);
|
||||
|
||||
var item = gUpdateWizard.itemsToUpdate[i];
|
||||
updateitem.name = item.name + " " + item.version;
|
||||
updateitem.url = item.updateURL;
|
||||
|
||||
// If we have an App entry in the list, check it and uncheck
|
||||
// the others since the two are mutually exclusive installs.
|
||||
updateitem.type = item.type;
|
||||
if (item.type == nsIUpdateItem.TYPE_APP) {
|
||||
updateitem.checked = true;
|
||||
this._appUpdateExists = true;
|
||||
this._appSelected = true;
|
||||
this._appItem = updateitem;
|
||||
document.getElementById("found").setAttribute("next", "appupdate");
|
||||
}
|
||||
else {
|
||||
updateitem.checked = !this._appUpdateExists;
|
||||
this._nonAppItems.push(updateitem);
|
||||
}
|
||||
|
||||
if (item.iconURL != "")
|
||||
updateitem.icon = item.iconURL;
|
||||
}
|
||||
|
||||
gUpdateWizard.checkForErrors("updateCheckErrorNotFound");
|
||||
},
|
||||
|
||||
onCommand: function (aEvent)
|
||||
{
|
||||
var i;
|
||||
if (this._appUpdateExists) {
|
||||
if (aEvent.target.type == nsIUpdateItem.TYPE_APP) {
|
||||
for (i = 0; i < this._nonAppItems.length; ++i) {
|
||||
var nonAppItem = this._nonAppItems[i];
|
||||
nonAppItem.checked = !aEvent.target.checked;
|
||||
}
|
||||
document.getElementById("found").setAttribute("next", "appupdate");
|
||||
}
|
||||
else {
|
||||
this._appItem.checked = false;
|
||||
document.getElementById("found").setAttribute("next", "installing");
|
||||
}
|
||||
}
|
||||
|
||||
var next = document.documentElement.getButton("next");
|
||||
next.disabled = true;
|
||||
var foundList = document.getElementById("foundList");
|
||||
for (i = 0; i < foundList.childNodes.length; ++i) {
|
||||
var listitem = foundList.childNodes[i];
|
||||
if (listitem.checked) {
|
||||
next.disabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var gAppUpdatePage = {
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
null, true,
|
||||
null, true);
|
||||
gUpdateWizard.updatingApp = true;
|
||||
|
||||
document.documentElement.getButton("finish").focus();
|
||||
}
|
||||
};
|
||||
|
||||
var gInstallingPage = {
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
null, true);
|
||||
|
||||
// Get XPInstallManager and kick off download/install
|
||||
// process, registering us as an observer.
|
||||
var items = [];
|
||||
|
||||
var foundList = document.getElementById("foundList");
|
||||
for (var i = 0; i < foundList.childNodes.length; ++i) {
|
||||
var item = foundList.childNodes[i];
|
||||
if (item.type != nsIUpdateItem.TYPE_APP) {
|
||||
items.push(item.url);
|
||||
this._objs.push({ name: item.name });
|
||||
}
|
||||
}
|
||||
|
||||
var xpimgr = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
|
||||
.createInstance(Components.interfaces.nsIXPInstallManager);
|
||||
xpimgr.initManagerFromChrome(items, items.length, this);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIXPIProgressDialog
|
||||
onStateChange: function (aIndex, aState, aValue)
|
||||
{
|
||||
var strings = document.getElementById("updateStrings");
|
||||
|
||||
const nsIXPIProgressDialog = Components.interfaces.nsIXPIProgressDialog;
|
||||
switch (aState) {
|
||||
case nsIXPIProgressDialog.DOWNLOAD_START:
|
||||
var label = strings.getFormattedString("downloadingPrefix", [this._objs[aIndex].name]);
|
||||
var actionItem = document.getElementById("actionItem");
|
||||
actionItem.value = label;
|
||||
break;
|
||||
case nsIXPIProgressDialog.DOWNLOAD_DONE:
|
||||
case nsIXPIProgressDialog.INSTALL_START:
|
||||
var label = strings.getFormattedString("installingPrefix", [this._objs[aIndex].name]);
|
||||
var actionItem = document.getElementById("actionItem");
|
||||
actionItem.value = label;
|
||||
break;
|
||||
case nsIXPIProgressDialog.INSTALL_DONE:
|
||||
if (aValue) {
|
||||
this._objs[aIndex].error = aValue;
|
||||
this._errors = true;
|
||||
}
|
||||
break;
|
||||
case nsIXPIProgressDialog.DIALOG_CLOSE:
|
||||
document.getElementById("installing").setAttribute("next", this._errors ? "errors" : "finished");
|
||||
document.documentElement.advance();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_objs: [],
|
||||
_errors: false,
|
||||
|
||||
onProgress: function (aIndex, aValue, aMaxValue)
|
||||
{
|
||||
var downloadProgress = document.getElementById("downloadProgress");
|
||||
downloadProgress.value = Math.ceil((aValue/aMaxValue) * 100);
|
||||
}
|
||||
};
|
||||
|
||||
var gErrorsPage = {
|
||||
onPageShow: function ()
|
||||
{
|
||||
document.documentElement.getButton("finish").focus();
|
||||
},
|
||||
|
||||
onShowErrors: function ()
|
||||
{
|
||||
gUpdateWizard.showErrors("install", gInstallingPage._objs);
|
||||
}
|
||||
};
|
||||
|
||||
var gFinishedPage = {
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true, null, true, null, true);
|
||||
document.documentElement.getButton("finish").focus();
|
||||
|
||||
var iR = document.getElementById("incompatibleRemaining");
|
||||
var iR2 = document.getElementById("incompatibleRemaining2");
|
||||
var fEC = document.getElementById("finishedEnableChecking");
|
||||
|
||||
if (gUpdateWizard.shouldSuggestAutoChecking) {
|
||||
iR.hidden = true;
|
||||
iR2.hidden = false;
|
||||
fEC.hidden = false;
|
||||
fEC.click();
|
||||
}
|
||||
else {
|
||||
iR.hidden = false;
|
||||
iR2.hidden = true;
|
||||
fEC.hidden = true;
|
||||
}
|
||||
|
||||
if (gSourceEvent == nsIUpdateService.SOURCE_EVENT_MISMATCH) {
|
||||
document.getElementById("finishedMismatch").hidden = false;
|
||||
document.getElementById("incompatibleAlert").hidden = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var gNoUpdatesPage = {
|
||||
onPageShow: function (aEvent)
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true, null, true, null, true);
|
||||
document.documentElement.getButton("finish").focus();
|
||||
if (gSourceEvent == nsIUpdateService.SOURCE_EVENT_MISMATCH) {
|
||||
document.getElementById("introUser").hidden = true;
|
||||
document.getElementById("introMismatch").hidden = false;
|
||||
document.getElementById("mismatchNoUpdates").hidden = false;
|
||||
|
||||
if (gUpdateWizard.shouldSuggestAutoChecking) {
|
||||
document.getElementById("mismatchIncompatibleRemaining").hidden = true;
|
||||
document.getElementById("mismatchIncompatibleRemaining2").hidden = false;
|
||||
document.getElementById("mismatchFinishedEnableChecking").hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
gUpdateWizard.checkForErrors("updateCheckErrorNotFound");
|
||||
}
|
||||
};
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Update Service.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
|
@ -0,0 +1,203 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Update Service.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/content/update/update.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/skin/update/update.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE wizard [
|
||||
<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/update/update.dtd">
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd">
|
||||
%updateDTD;
|
||||
%brandDTD;
|
||||
]>
|
||||
|
||||
<wizard id="migrationWizard"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&updateWizard.title;"
|
||||
onload="gUpdateWizard.init()"
|
||||
onunload="gUpdateWizard.uninit()"
|
||||
onwizardfinish="gUpdateWizard.onWizardFinish();"
|
||||
style="width: 40em;"
|
||||
buttons="accept,cancel">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/update/update.js"/>
|
||||
|
||||
<stringbundleset id="updateSet">
|
||||
<stringbundle id="brandStrings" src="chrome://global/locale/brand.properties"/>
|
||||
<stringbundle id="updateStrings" src="chrome://mozapps/locale/update/update.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<wizardpage id="mismatch" pageid="mismatch" next="checking"
|
||||
label="&mismatch.title;"
|
||||
onpageshow="gMismatchPage.onPageShow();">
|
||||
|
||||
<label>&mismatch.intro1.label;</label>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<listbox id="mismatch.incompatible" flex="1"/>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<label style="font-weight: bold;">&mismatch.intro2.label;</label>
|
||||
<separator class="thin"/>
|
||||
|
||||
<label>&mismatch.intro3.label;</label>
|
||||
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="checking" pageid="checking" next="noupdates"
|
||||
label="&checking.title;"
|
||||
onpageshow="gUpdatePage.onPageShow();">
|
||||
|
||||
<label>&checking.intro.label;</label>
|
||||
|
||||
<separator/>
|
||||
|
||||
<progressmeter id="checking.progress"/>
|
||||
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="noupdates" pageid="noupdates"
|
||||
label="&noupdates.title;"
|
||||
onpageshow="gNoUpdatesPage.onPageShow();">
|
||||
<label id="introUser">&noupdates.intro.user.label;</label>
|
||||
<label id="introMismatch" hidden="true">&noupdates.intro.mismatch.label;</label>
|
||||
<separator/>
|
||||
<vbox id="mismatchNoUpdates" hidden="true">
|
||||
<description id="mismatchIncompatibleRemaining" flex="1">
|
||||
&noupdates.intro2.mismatch.label;
|
||||
</description>
|
||||
<description id="mismatchIncompatibleRemaining2" flex="1" hidden="true">
|
||||
&noupdates.intro3.mismatch.label;
|
||||
</description>
|
||||
<separator class="thin"/>
|
||||
|
||||
<vbox align="left">
|
||||
<checkbox label="&noupdates.enableChecking.label;"
|
||||
id="mismatchFinishedEnableChecking" hidden="true"
|
||||
oncommand="gUpdateWizard.shouldAutoCheck = this.checked;"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
<hbox id="updateCheckErrorNotFound" hidden="true" align="center">
|
||||
<description flex="1">
|
||||
&updateCheckError.description;
|
||||
</description>
|
||||
<button label="&updateCheckError.label;" accesskey="&updateCheckError.accesskey;"
|
||||
oncommand="gUpdateWizard.showUpdateCheckErrors();"/>
|
||||
</hbox>
|
||||
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="found" pageid="found" next="installing"
|
||||
label="&found.title;"
|
||||
onpageshow="gFoundPage.onPageShow();">
|
||||
|
||||
<label>&found.intro.label;</label>
|
||||
|
||||
<vbox id="foundList" flex="1" style="height: 16em; overflow: auto;"
|
||||
oncommand="gFoundPage.onCommand(event);"/>
|
||||
|
||||
<label>&found.instructions.label;</label>
|
||||
|
||||
<hbox id="updateCheckErrorFound" hidden="true" align="center">
|
||||
<description flex="1">
|
||||
&updateCheckError.description;
|
||||
</description>
|
||||
<button label="&updateCheckError.label;" accesskey="&updateCheckError.accesskey;"
|
||||
oncommand="gUpdateWizard.showUpdateCheckErrors();"/>
|
||||
</hbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="appupdate" pageid="appupdate"
|
||||
label="&appupdate.title;"
|
||||
onpageshow="gAppUpdatePage.onPageShow();">
|
||||
|
||||
<hbox>
|
||||
<label flex="1">&appupdate.intro.label;</label>
|
||||
<separator/>
|
||||
<image src="chrome://mozapps/skin/update/icon32.png"/>
|
||||
</hbox>
|
||||
|
||||
<separator/>
|
||||
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="installing" pageid="installing" next="finished"
|
||||
label="&installing.title;"
|
||||
onpageshow="gInstallingPage.onPageShow();">
|
||||
<label>&installing.intro.label;</label>
|
||||
<label id="actionItem"/>
|
||||
<progressmeter id="downloadProgress"/>
|
||||
|
||||
<separator/>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="errors" pageid="errors"
|
||||
label="&errors.title;"
|
||||
align="right">
|
||||
<label>&errors.intro.label;</label>
|
||||
<separator/>
|
||||
<button label="&errors.details.label;" accesskey="&errors.details.accesskey;"
|
||||
oncommand="gErrorsPage.onShowErrors();"/>
|
||||
<separator/>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage id="finished" pageid="finished"
|
||||
label="&finished.title;"
|
||||
onpageshow="gFinishedPage.onPageShow();">
|
||||
|
||||
<label id="updated">&finished.updated.label;</label>
|
||||
<separator/>
|
||||
<hbox id="incompatibleAlert" align="top" hidden="true">
|
||||
<image id="alert"/>
|
||||
<description id="incompatibleRemaining" flex="1">&finished.remaining.label;</description>
|
||||
<description id="incompatibleRemaining2" flex="1">&finished.remaining2.label;</description>
|
||||
</hbox>
|
||||
<vbox align="left">
|
||||
<checkbox class="indent" label="&finished.enableChecking.label;" id="finishedEnableChecking"
|
||||
oncommand="gUpdateWizard.shouldAutoCheck = this.checked;"/>
|
||||
</vbox>
|
||||
<separator flex="1"/>
|
||||
<label id="finishedMismatch" hidden="true">&finished.mismatch.label;</label>
|
||||
|
||||
</wizardpage>
|
||||
|
||||
</wizard>
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/update/update.dtd">
|
||||
|
||||
<bindings id="updatesBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="updateStatusbarNotification" extends="chrome://global/content/bindings/general.xml#statusbarpanel">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/update/update.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1" class="updateIndicator" xbl:inherits="updateCount"
|
||||
anonid="infoPanel">
|
||||
<xul:image xbl:inherits="severity" class="updateIcon"/>
|
||||
<xul:label xbl:inherits="value=updateCount" flex="1" crop="right"/>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation implements="nsIAlertListener">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this.refreshData(null);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<method name="refreshData">
|
||||
<parameter name="aSourceEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIUpdateService);
|
||||
this.severity = updates.updateSeverity;
|
||||
this.updateCount = updates.updateCount;
|
||||
|
||||
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var updateStrings = sbs.createBundle("chrome://mozapps/locale/update/update.properties");
|
||||
var key = "updatesAvailableTooltip-" + this.severity;
|
||||
var tooltip = updateStrings.GetStringFromName(key);
|
||||
this.setAttribute("tooltiptext", tooltip);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="showUpdates">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIUpdateService);
|
||||
updates.checkForUpdates([], 0, Components.interfaces.nsIUpdateItem.TYPE_ANY,
|
||||
Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER,
|
||||
window);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="severity" onset="this.setAttribute('severity', val); return val;"
|
||||
onget="return this.getAttribute('severity');"/>
|
||||
<property name="updateCount" onset="this.setAttribute('updateCount', val); return val;"
|
||||
onget="return this.getAttribute('updateCount');"/>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="dblclick">
|
||||
<![CDATA[
|
||||
this.showUpdates();
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="updateItem">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/update/update.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox flex="1">
|
||||
<xul:stack>
|
||||
<xul:vbox align="center">
|
||||
<xul:image class="updateItemIcon" xbl:inherits="src=icon"/>
|
||||
</xul:vbox>
|
||||
<xul:vbox align="right">
|
||||
<xul:checkbox class="updateItemChecked" anonid="updateItemChecked" xbl:inherits="checked"/>
|
||||
</xul:vbox>
|
||||
</xul:stack>
|
||||
<xul:vbox flex="1">
|
||||
<xul:hbox class="updateItemNameRow" align="center">
|
||||
<xul:label class="updateItemName" xbl:inherits="value=name" flex="1" crop="right"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox class="updateItemInfoRow" anonid="updateItemInfoRow" align="center" hidden="true">
|
||||
<xul:label class="updateItemInfo" anonid="updateItemText" flex="1" crop="right">&appInfo.label;</xul:label>
|
||||
</xul:hbox>
|
||||
<xul:hbox class="updateItemDetailsRow" align="center">
|
||||
<xul:label class="updateItemFromLabel">&from.label;</xul:label>
|
||||
<xul:textbox class="updateItemURL" xbl:inherits="value=url" flex="1" readonly="true" crop="right"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<property name="name" onset="this.setAttribute('name', val); return val;"
|
||||
onget="return this.getAttribute('name');"/>
|
||||
<property name="url" onset="this.setAttribute('url', val); return val;"
|
||||
onget="return this.getAttribute('url');"/>
|
||||
<property name="icon" onset="this.setAttribute('icon', val); return val;"
|
||||
onget="return this.getAttribute('icon');"/>
|
||||
<property name="type" onget="return parseInt(this.getAttribute('type'));">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.setAttribute("type", val);
|
||||
if (val == Components.interfaces.nsIUpdateItem.TYPE_APP) {
|
||||
var infoRow = document.getAnonymousElementByAttribute(this, "anonid", "updateItemInfoRow");
|
||||
infoRow.removeAttribute("hidden");
|
||||
}
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<setter>
|
||||
var checkbox = document.getAnonymousElementByAttribute(this, "anonid", "updateItemChecked");
|
||||
checkbox.checked = val;
|
||||
return val;
|
||||
</setter>
|
||||
<getter>
|
||||
var checkbox = document.getAnonymousElementByAttribute(this, "anonid", "updateItemChecked");
|
||||
return checkbox.checked;
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<!ENTITY updateWizard.title "&brandShortName; Update">
|
||||
|
||||
<!ENTITY mismatch.title "Incompatible Components">
|
||||
<!ENTITY mismatch.intro1.label "The following components are not compatible with the new version
|
||||
of &brandShortName; you have just installed:">
|
||||
<!ENTITY mismatch.intro2.label "They have been disabled until compatible versions are
|
||||
installed.">
|
||||
<!ENTITY mismatch.intro3.label "&brandShortName; can check for and install newer, compatible
|
||||
versions of these components.">
|
||||
|
||||
<!ENTITY checking.title "Checking for Updates">
|
||||
<!ENTITY checking.intro.label "&brandShortName; is now checking for available updates...">
|
||||
|
||||
<!ENTITY found.title "Updates Found">
|
||||
<!ENTITY found.intro.label "&brandShortName; found the following available updates:">
|
||||
<!ENTITY found.instructions.label "Choose the ones you want to install and click Install Now to install them.">
|
||||
<!ENTITY from.label "from: ">
|
||||
|
||||
<!ENTITY installing.title "Installing Updates">
|
||||
<!ENTITY installing.intro.label "Now downloading and installing updates...">
|
||||
<!ENTITY installing.disclaimer.label "XXXben - this will not work until we have a scriptable API to XPInstall.">
|
||||
|
||||
<!ENTITY noupdates.title "No Updates Found">
|
||||
<!ENTITY noupdates.intro.user.label "&brandShortName; was not able to find any available updates.">
|
||||
|
||||
<!ENTITY noupdates.intro.mismatch.label "&brandShortName; was not able to find any available updates -
|
||||
compatible versions may not be available at this time.">
|
||||
<!ENTITY noupdates.intro2.mismatch.label "&brandShortName; will check periodically and inform you when
|
||||
compatible versions become available.">
|
||||
<!ENTITY noupdates.intro3.mismatch.label "&brandShortName; can check periodically and inform you when
|
||||
compatible versions become available.">
|
||||
<!ENTITY noupdates.enableChecking.label "Allow &brandShortName; to check for updates.">
|
||||
|
||||
<!ENTITY finished.title "Update Complete">
|
||||
<!ENTITY finished.updated.label "&brandShortName; has installed the available updates.">
|
||||
<!ENTITY finished.remaining.label "Some incompatible components could not be updated, perhaps
|
||||
because compatible versions are not available at this time.
|
||||
&brandShortName; will check periodically and inform you
|
||||
when updated versions become available.">
|
||||
<!ENTITY finished.remaining2.label "Some incompatible components could not be updated, perhaps
|
||||
because compatible versions are not available at this time.
|
||||
&brandShortName; can check periodically and inform you
|
||||
when updated versions become available.">
|
||||
<!ENTITY finished.error.label "&brandShortName; did not succeed in downloading and
|
||||
installing some updates.">
|
||||
<!ENTITY finished.enableChecking.label "Allow &brandShortName; to check for updates.">
|
||||
<!ENTITY finished.mismatch.label "Click Finish to continue starting &brandShortName;.">
|
||||
|
||||
<!ENTITY appInfo.label "This update must be installed separately from any others.">
|
||||
|
||||
<!ENTITY appupdate.title "&brandShortName; Update">
|
||||
<!ENTITY appupdate.intro.label "&brandShortName; Update will now close and take you to the
|
||||
web site where you can download the latest version of
|
||||
&brandShortName;.">
|
||||
|
||||
<!ENTITY errors.title "Problems During Update">
|
||||
<!ENTITY errors.intro.label "&brandShortName; encountered problems when updating your
|
||||
software, and as a result not all components could be updated.">
|
||||
<!ENTITY errors.details.label "Details">
|
||||
<!ENTITY errors.details.accesskey "D">
|
||||
|
||||
<!ENTITY updateCheckError.description "&brandShortName; encountered problems when trying to find
|
||||
updates for some items.">
|
||||
<!ENTITY updateCheckError.label "Details">
|
||||
<!ENTITY updateCheckError.accesskey "D">
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
mismatchCheckNow=Check Now
|
||||
mismatchCheckNowAccesskey=C
|
||||
mismatchDontCheck=Don't Check
|
||||
mismatchDontCheckAccesskey=D
|
||||
installButtonText=Install Now
|
||||
installButtonTextAccesskey=I
|
||||
nextButtonText=Next >
|
||||
cancelButtonText=Cancel
|
||||
update.app.url=http://update.mozilla.org/update.rdf
|
||||
|
||||
updatesAvailableTitle=New Updates Available
|
||||
updatesAvailableText=Click Here to View
|
||||
|
||||
downloadingPrefix=Downloading: %S
|
||||
installingPrefix=Installing: %S
|
||||
closeButton=Close
|
||||
|
||||
installErrorDescription=The following components could not be installed due to errors (the file could not be downloaded, was corrupt, or for some other reason).
|
||||
checkingErrorDescription=%S could not check for updates to the following components (either the update server(s) did not respond, or the update service(s) were not found).
|
||||
|
||||
updatesAvailableTooltip-0=Update(s) Available
|
||||
updatesAvailableTooltip-1=Update(s) Available
|
||||
updatesAvailableTooltip-2=Critical Update(s) Available
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = update
|
||||
XPIDL_MODULE = update
|
||||
|
||||
XPIDLSRCS = nsIUpdateService.idl
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Extension Manager.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindowInternal;
|
||||
|
||||
[scriptable, uuid(37648f86-0f77-4007-929e-673a75d5438f)]
|
||||
interface nsIUpdateItem : nsISupports
|
||||
{
|
||||
readonly attribute string id;
|
||||
readonly attribute string version;
|
||||
readonly attribute wstring name;
|
||||
readonly attribute long row;
|
||||
readonly attribute wstring updateURL;
|
||||
readonly attribute wstring iconURL;
|
||||
readonly attribute wstring updateRDF;
|
||||
|
||||
const unsigned short TYPE_ANY = 0x01;
|
||||
const unsigned short TYPE_APP = 0x02;
|
||||
const unsigned short TYPE_ADDON = 0x04;
|
||||
|
||||
const unsigned short TYPE_EXTENSION = 0x08;
|
||||
const unsigned short TYPE_THEME = 0x10;
|
||||
const unsigned short TYPE_LOCALE = 0x20;
|
||||
|
||||
readonly attribute long type;
|
||||
|
||||
void init(in string aID, in string aVersion, in wstring aName,
|
||||
in long aRow, in wstring aUpdateURL, in wstring aIconURL,
|
||||
in wstring aUpdateRDF, in long aType);
|
||||
|
||||
readonly attribute wstring objectSource;
|
||||
};
|
||||
|
||||
[scriptable, uuid(c8a2339e-770a-417d-ab9c-efde1f23ba24)]
|
||||
interface nsIUpdateService : nsISupports
|
||||
{
|
||||
void watchForUpdates();
|
||||
|
||||
const unsigned short SOURCE_EVENT_USER = 0x01;
|
||||
const unsigned short SOURCE_EVENT_BACKGROUND = 0x02;
|
||||
const unsigned short SOURCE_EVENT_MISMATCH = 0x04;
|
||||
|
||||
void checkForUpdates([array, size_is(aItemCount)] in nsIUpdateItem aItems,
|
||||
in unsigned long aItemCount,
|
||||
in unsigned short aUpdateTypes,
|
||||
in unsigned short aSourceEvent,
|
||||
in nsIDOMWindowInternal aParentWindow);
|
||||
void checkForUpdatesInternal([array, size_is(aItemCount)] in nsIUpdateItem aItems,
|
||||
in unsigned long aItemCount,
|
||||
in unsigned short aUpdateTypes,
|
||||
in unsigned short aSourceEvent);
|
||||
|
||||
readonly attribute long updateCount;
|
||||
readonly attribute unsigned short updateSeverity;
|
||||
|
||||
readonly attribute string appUpdateVersion;
|
||||
readonly attribute wstring appUpdateDescription;
|
||||
readonly attribute wstring appUpdateURL;
|
||||
};
|
||||
|
||||
[scriptable, uuid(22d35700-5765-42e1-914b-a0da7c911a8c)]
|
||||
interface nsIVersionChecker : nsISupports
|
||||
{
|
||||
// -ve if B is newer
|
||||
// equal if A == B
|
||||
// +ve if A is newer
|
||||
long compare(in string aVersionA, in string aVersionB);
|
||||
|
||||
boolean isValidVersion(in string aVersion);
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = update
|
||||
|
||||
EXTRA_COMPONENTS = nsBackgroundUpdateService.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,675 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Update Service.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Ben Goodger.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const PREF_APP_ID = "app.id";
|
||||
const PREF_APP_VERSION = "app.version";
|
||||
const PREF_UPDATE_APP_ENABLED = "update.app.enabled";
|
||||
const PREF_UPDATE_APP_URI = "update.app.url";
|
||||
const PREF_UPDATE_APP_UPDATESAVAILABLE = "update.app.updatesAvailable";
|
||||
const PREF_UPDATE_APP_UPDATEVERSION = "update.app.updateVersion";
|
||||
const PREF_UPDATE_APP_UPDATEDESCRIPTION = "update.app.updateDescription";
|
||||
const PREF_UPDATE_APP_UPDATEURL = "update.app.updateURL";
|
||||
|
||||
const PREF_UPDATE_EXTENSIONS_ENABLED = "update.extensions.enabled";
|
||||
const PREF_UPDATE_EXTENSIONS_AUTOUPDATE = "update.extensions.autoUpdate";
|
||||
const PREF_UPDATE_EXTENSIONS_COUNT = "update.extensions.count";
|
||||
|
||||
const PREF_UPDATE_INTERVAL = "update.interval";
|
||||
const PREF_UPDATE_LASTUPDATEDATE = "update.lastUpdateDate";
|
||||
const PREF_UPDATE_SEVERITY = "update.severity";
|
||||
|
||||
const nsIUpdateService = Components.interfaces.nsIUpdateService;
|
||||
const nsIUpdateItem = Components.interfaces.nsIUpdateItem;
|
||||
|
||||
const UPDATED_EXTENSIONS = 0x01;
|
||||
const UPDATED_APP = 0x02;
|
||||
|
||||
function nsUpdateService()
|
||||
{
|
||||
this._pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
this.watchForUpdates();
|
||||
}
|
||||
|
||||
nsUpdateService.prototype = {
|
||||
_timer: null,
|
||||
_pref: null,
|
||||
_updateObserver: null,
|
||||
|
||||
// whether or not we're currently updating. prevents multiple simultaneous
|
||||
// update operations.
|
||||
updating: false,
|
||||
|
||||
updateEnded: function ()
|
||||
{
|
||||
// this.updating = false;
|
||||
delete this._updateObserver;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIUpdateService
|
||||
watchForUpdates: function ()
|
||||
{
|
||||
// This is called when the app starts, so check to see if the time interval
|
||||
// expired between now and the last time an automated update was performed.
|
||||
// now is the same one that was started last time.
|
||||
var appUpdatesEnabled = this._pref.getBoolPref(PREF_UPDATE_APP_ENABLED);
|
||||
var extUpdatesEnabled = this._pref.getBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED);
|
||||
if (!appUpdatesEnabled && !extUpdatesEnabled)
|
||||
return;
|
||||
|
||||
var interval = this._pref.getIntPref(PREF_UPDATE_INTERVAL);
|
||||
var lastUpdateTime = this._pref.getIntPref(PREF_UPDATE_LASTUPDATEDATE);
|
||||
var timeSinceLastCheck = lastUpdateTime ? Math.abs(Date.UTC() - lastUpdateTime) : 0;
|
||||
if (timeSinceLastCheck > interval) {
|
||||
// if (!this.updating)
|
||||
this.checkForUpdatesInternal([], 0, nsIUpdateItem.TYPE_ANY,
|
||||
nsIUpdateService.SOURCE_EVENT_BACKGROUND);
|
||||
}
|
||||
else
|
||||
this._makeTimer(interval - timeSinceLastCheck);
|
||||
},
|
||||
|
||||
checkForUpdates: function (aItems, aItemCount, aUpdateTypes, aSourceEvent, aParentWindow)
|
||||
{
|
||||
// if (this.updating) return;
|
||||
|
||||
switch (aSourceEvent) {
|
||||
case nsIUpdateService.SOURCE_EVENT_MISMATCH:
|
||||
case nsIUpdateService.SOURCE_EVENT_USER:
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
var ary = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
var updateTypes = Components.classes["@mozilla.org/supports-PRUint8;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsPRUint8);
|
||||
updateTypes.data = aUpdateTypes;
|
||||
ary.AppendElement(updateTypes);
|
||||
var sourceEvent = Components.classes["@mozilla.org/supports-PRUint8;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsPRUint8);
|
||||
sourceEvent.data = aSourceEvent;
|
||||
ary.AppendElement(sourceEvent);
|
||||
for (var i = 0; i < aItems.length; ++i)
|
||||
ary.AppendElement(aItems[i]);
|
||||
ww.openWindow(aParentWindow, "chrome://mozapps/content/update/update.xul",
|
||||
"", "chrome,modal,centerscreen", ary);
|
||||
break;
|
||||
case nsIUpdateService.SOURCE_EVENT_BACKGROUND:
|
||||
// Rather than show a UI, call the checkForUpdates function directly here.
|
||||
// The Browser's inline front end update notification system listens for the
|
||||
// updates that this function broadcasts.
|
||||
this.checkForUpdatesInternal([], 0, aUpdateTypes, aSourceEvent);
|
||||
|
||||
// If this was a background update, reset timer.
|
||||
this._makeTimer(this._pref.getIntPref(PREF_UPDATE_INTERVAL));
|
||||
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
checkForUpdatesInternal: function (aItems, aItemCount, aUpdateTypes, aSourceEvent)
|
||||
{
|
||||
// this.updating = true;
|
||||
|
||||
// Listen for notifications sent out by the app updater (implemented here) and the
|
||||
// extension updater (implemented in nsExtensionItemUpdater)
|
||||
this._updateObserver = new nsUpdateObserver(aUpdateTypes, aSourceEvent, this);
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.addObserver(this._updateObserver, "Update:Extension:Item-Ended", false);
|
||||
os.addObserver(this._updateObserver, "Update:Extension:Ended", false);
|
||||
os.addObserver(this._updateObserver, "Update:App:Ended", false);
|
||||
|
||||
if ((aUpdateTypes == nsIUpdateItem.TYPE_ANY) || (aUpdateTypes == nsIUpdateItem.TYPE_APP)) {
|
||||
var dsURI = this._pref.getComplexValue(PREF_UPDATE_APP_URI,
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
var ds = rdf.GetDataSource(dsURI);
|
||||
var rds = ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource)
|
||||
if (rds.loaded)
|
||||
this.datasourceLoaded(ds);
|
||||
else {
|
||||
var sink = ds.QueryInterface(Components.interfaces.nsIRDFXMLSink);
|
||||
sink.addXMLSinkObserver(new nsAppUpdateXMLRDFDSObserver(this));
|
||||
}
|
||||
}
|
||||
if (aUpdateTypes != nsIUpdateItem.TYPE_APP) {
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Components.interfaces.nsIExtensionManager);
|
||||
em.update(aItems, aItems.length);
|
||||
}
|
||||
|
||||
if (aSourceEvent == nsIUpdateService.SOURCE_EVENT_BACKGROUND)
|
||||
this._pref.setIntPref(PREF_UPDATE_LASTUPDATEDATE, Math.abs(Date.UTC()));
|
||||
},
|
||||
|
||||
_rdf: null,
|
||||
_ncR: function (aProperty)
|
||||
{
|
||||
return this._rdf.GetResource("http://home.netscape.com/NC-rdf#" + aProperty);
|
||||
},
|
||||
|
||||
_getProperty: function (aDS, aAppID, aProperty)
|
||||
{
|
||||
var app = this._rdf.GetResource("urn:mozilla:app:" + aAppID);
|
||||
return aDS.GetTarget(app, this._ncR(aProperty), true).QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
},
|
||||
|
||||
// This is called when the remote update datasource is ready to be parsed.
|
||||
datasourceLoaded: function (aDataSource)
|
||||
{
|
||||
if (!this._rdf) {
|
||||
this._rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
}
|
||||
// <?xml version="1.0"?>
|
||||
// <RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
// xmlns:NC="http://home.netscape.com/NC-rdf#">
|
||||
// <RDF:Description about="urn:mozilla:app:{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
// <NC:version>1.2</NC:version>
|
||||
// <NC:severity>0</NC:severity>
|
||||
// <NC:URL>http://www.mozilla.org/products/firefox/</NC:URL>
|
||||
// <NC:description>Firefox 1.2 features new goats.</NC:description>
|
||||
// </RDF:Description>
|
||||
// </RDF:RDF>
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var appID = pref.getCharPref(PREF_APP_ID);
|
||||
var appVersion = pref.getCharPref(PREF_APP_VERSION);
|
||||
|
||||
// do update checking here, parsing something like this format:
|
||||
var version = this._getProperty(aDataSource, appID, "version");
|
||||
var versionChecker = Components.classes["@mozilla.org/updates/version-checker;1"]
|
||||
.getService(Components.interfaces.nsIVersionChecker);
|
||||
if (versionChecker.compare(appVersion, version) < 0) {
|
||||
pref.setCharPref(PREF_UPDATE_APP_UPDATEVERSION, version);
|
||||
|
||||
var severity = this._getProperty(aDataSource, appID, "severity");
|
||||
// Synthesize the real severity value using the hint from the web site
|
||||
// and the version.
|
||||
pref.setIntPref(PREF_UPDATE_SEVERITY, severity);
|
||||
pref.setBoolPref(PREF_UPDATE_APP_UPDATESAVAILABLE, true);
|
||||
|
||||
var urlStr = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
urlStr.data = this._getProperty(aDataSource, appID, "URL");
|
||||
pref.setComplexValue(PREF_UPDATE_APP_UPDATEURL,
|
||||
Components.interfaces.nsISupportsString,
|
||||
urlStr);
|
||||
|
||||
var descStr = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
descStr.data = this._getProperty(aDataSource, appID, "description");
|
||||
pref.setComplexValue(PREF_UPDATE_APP_UPDATEDESCRIPTION,
|
||||
Components.interfaces.nsISupportsString,
|
||||
descStr);
|
||||
}
|
||||
|
||||
// The Update Wizard uses this notification to determine that the application
|
||||
// update process is now complete.
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.notifyObservers(null, "Update:App:Ended", "");
|
||||
},
|
||||
|
||||
datasourceError: function ()
|
||||
{
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.notifyObservers(null, "Update:App:Error", "");
|
||||
os.notifyObservers(null, "Update:App:Ended", "");
|
||||
},
|
||||
|
||||
get updateCount()
|
||||
{
|
||||
// The number of available updates is the number of extension/theme/other
|
||||
// updates + 1 for an application update, if one is available.
|
||||
var updateCount = this._pref.getIntPref(PREF_UPDATE_EXTENSIONS_COUNT);
|
||||
if (this._pref.prefHasUserValue(PREF_UPDATE_APP_UPDATESAVAILABLE) &&
|
||||
this._pref.getBoolPref(PREF_UPDATE_APP_UPDATESAVAILABLE))
|
||||
++updateCount;
|
||||
return updateCount;
|
||||
},
|
||||
|
||||
get updateSeverity()
|
||||
{
|
||||
return this._pref.getIntPref(PREF_UPDATE_SEVERITY);
|
||||
},
|
||||
|
||||
get appUpdateVersion()
|
||||
{
|
||||
return this._pref.getComplexValue(PREF_UPDATE_APP_UPDATEVERSION,
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
},
|
||||
|
||||
get appUpdateDescription()
|
||||
{
|
||||
return this._pref.getComplexValue(PREF_UPDATE_APP_UPDATEDESCRIPTION,
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
},
|
||||
|
||||
get appUpdateURL()
|
||||
{
|
||||
return this._pref.getComplexValue(PREF_UPDATE_APP_UPDATEURL,
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsITimerCallback
|
||||
notify: function (aTimer)
|
||||
{
|
||||
// if (this.updating) return;
|
||||
this.checkForUpdatesInternal([], 0, nsIUpdateItem.TYPE_ANY,
|
||||
nsIUpdateService.SOURCE_EVENT_BACKGROUND);
|
||||
this._makeTimer(this._pref.getIntPref(PREF_UPDATE_INTERVAL));
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsUpdateService
|
||||
_makeTimer: function (aDelay)
|
||||
{
|
||||
if (this._timer)
|
||||
this._timer.cancel();
|
||||
|
||||
this._timer = Components.classes["@mozilla.org/timer;1"]
|
||||
.createInstance(Components.interfaces.nsITimer);
|
||||
this._timer.initWithCallback(this, aDelay,
|
||||
Components.interfaces.nsITimer.TYPE_ONE_SHOT);
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
QueryInterface: function (aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIUpdateService) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
function nsUpdateObserver(aUpdateTypes, aSourceEvent, aService)
|
||||
{
|
||||
this._pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
this._updateTypes = aUpdateTypes;
|
||||
this._sourceEvent = aSourceEvent;
|
||||
this._service = aService;
|
||||
}
|
||||
|
||||
nsUpdateObserver.prototype = {
|
||||
_updateTypes: 0,
|
||||
_sourceEvent: 0,
|
||||
_updateState: 0,
|
||||
|
||||
get _doneUpdating()
|
||||
{
|
||||
var test = 0;
|
||||
var updatingApp = this._updateTypes == nsIUpdateItem.TYPE_ANY ||
|
||||
this._updateTypes == nsIUpdateItem.TYPE_APP;
|
||||
var updatingExt = this._updateTypes != nsIUpdateItem.TYPE_APP;
|
||||
|
||||
if (updatingApp)
|
||||
test |= UPDATED_APP;
|
||||
if (updatingExt)
|
||||
test |= UPDATED_EXTENSIONS;
|
||||
|
||||
return (this._updateState & test) == test;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIObserver
|
||||
observe: function (aSubject, aTopic, aData)
|
||||
{
|
||||
switch (aTopic) {
|
||||
case "Update:Extension:Started":
|
||||
// Reset the count
|
||||
this._pref.setIntPref(PREF_UPDATE_EXTENSIONS_COUNT, 0);
|
||||
break;
|
||||
case "Update:Extension:Item-Ended":
|
||||
this._pref.setIntPref(PREF_UPDATE_EXTENSIONS_COUNT,
|
||||
this._pref.getIntPref(PREF_UPDATE_EXTENSIONS_COUNT) + 1);
|
||||
break;
|
||||
case "Update:Extension:Ended":
|
||||
this._updateState |= UPDATED_EXTENSIONS;
|
||||
break;
|
||||
case "Update:App:Ended":
|
||||
this._updateState |= UPDATED_APP;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this._doneUpdating) {
|
||||
// The Inline Browser Update UI uses this notification to refresh its update
|
||||
// UI if necessary.
|
||||
var os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.notifyObservers(null, "Update:Ended", this._sourceEvent.toString());
|
||||
|
||||
// Show update notification UI if:
|
||||
// We were updating any types and any item was found
|
||||
// We were updating extensions and an extension update was found.
|
||||
// We were updating app and an app update was found.
|
||||
var updatesAvailable = (((this._updateTypes == nsIUpdateItem.TYPE_EXTENSION) ||
|
||||
(this._updateTypes == nsIUpdateItem.TYPE_ANY)) &&
|
||||
this._pref.getIntPref(PREF_UPDATE_EXTENSIONS_COUNT) != 0);
|
||||
if (!updatesAvailable) {
|
||||
updatesAvailable = ((this._updateTypes == nsIUpdateItem.TYPE_APP) ||
|
||||
(this._updateTypes == nsIUpdateItem.TYPE_ANY)) &&
|
||||
this._pref.getBoolPref(PREF_UPDATE_APP_UPDATESAVAILABLE);
|
||||
}
|
||||
|
||||
if (updatesAvailable && this._sourceEvent == nsIUpdateService.SOURCE_EVENT_BACKGROUND) {
|
||||
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundle = sbs.createBundle("chrome://mozapps/locale/update/update.properties");
|
||||
|
||||
var alertTitle = bundle.GetStringFromName("updatesAvailableTitle");
|
||||
var alertText = bundle.GetStringFromName("updatesAvailableText");
|
||||
|
||||
var alerts = Components.classes["@mozilla.org/alerts-service;1"]
|
||||
.getService(Components.interfaces.nsIAlertsService);
|
||||
alerts.showAlertNotification("chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png",
|
||||
alertTitle, alertText, true, "", this);
|
||||
}
|
||||
|
||||
os.removeObserver(this, "Update:Extension:Item-Ended");
|
||||
os.removeObserver(this, "Update:Extension:Ended");
|
||||
os.removeObserver(this, "Update:App:Ended");
|
||||
|
||||
this._service.updating = false;
|
||||
}
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIObserver
|
||||
|
||||
onAlertFinished: function ()
|
||||
{
|
||||
},
|
||||
|
||||
onAlertClickCallback: function (aCookie)
|
||||
{
|
||||
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIUpdateService);
|
||||
updates.checkForUpdates([], 0, Components.interfaces.nsIUpdateItem.TYPE_ANY,
|
||||
Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER,
|
||||
null);
|
||||
}
|
||||
};
|
||||
|
||||
function nsAppUpdateXMLRDFDSObserver(aUpdateService)
|
||||
{
|
||||
this._updateService = aUpdateService;
|
||||
}
|
||||
|
||||
nsAppUpdateXMLRDFDSObserver.prototype =
|
||||
{
|
||||
_updateService: null,
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRDFXMLSinkObserver
|
||||
onBeginLoad: function(aSink)
|
||||
{
|
||||
},
|
||||
onInterrupt: function(aSink)
|
||||
{
|
||||
},
|
||||
onResume: function(aSink)
|
||||
{
|
||||
},
|
||||
|
||||
onEndLoad: function(aSink)
|
||||
{
|
||||
aSink.removeXMLSinkObserver(this);
|
||||
|
||||
var ds = aSink.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
this._updateService.datasourceLoaded(ds);
|
||||
},
|
||||
|
||||
onError: function(aSink, aStatus, aErrorMsg)
|
||||
{
|
||||
aSink.removeXMLSinkObserver(this);
|
||||
|
||||
this._updateService.datasourceError();
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateItem ()
|
||||
{
|
||||
}
|
||||
|
||||
UpdateItem.prototype = {
|
||||
init: function (aID, aVersion, aName, aRow, aUpdateURL, aIconURL, aUpdateRDF, aType)
|
||||
{
|
||||
this._id = aID;
|
||||
this._version = aVersion;
|
||||
this._name = aName;
|
||||
this._row = aRow;
|
||||
this._updateURL = aUpdateURL;
|
||||
this._iconURL = aIconURL;
|
||||
this._updateRDF = aUpdateRDF;
|
||||
this._type = aType;
|
||||
},
|
||||
|
||||
get id() { return this._id; },
|
||||
get version() { return this._version; },
|
||||
get name() { return this._name; },
|
||||
get row() { return this._row; },
|
||||
get updateURL() { return this._updateURL; },
|
||||
get iconURL() { return this._iconURL },
|
||||
get updateRDF() { return this._updateRDF; },
|
||||
get type() { return this._type; },
|
||||
|
||||
get objectSource()
|
||||
{
|
||||
return { id: this._id, version: this._version, name: this._name,
|
||||
row: this._row, updateURL: this._updateURL,
|
||||
iconURL: this._iconURL, type: this._type }.toSource();
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
QueryInterface: function (aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIUpdateItem) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
function nsVersionChecker()
|
||||
{
|
||||
}
|
||||
|
||||
nsVersionChecker.prototype = {
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIVersionChecker
|
||||
|
||||
// -ve if B is newer
|
||||
// equal if A == B
|
||||
// +ve if A is newer
|
||||
compare: function (aVersionA, aVersionB)
|
||||
{
|
||||
var a = this._decomposeVersion(aVersionA);
|
||||
var b = this._decomposeVersion(aVersionB);
|
||||
return a - b;
|
||||
},
|
||||
|
||||
// Version strings get translated into a "score" that indicates how new
|
||||
// the product is.
|
||||
//
|
||||
// a.b.c+ -> a*1000 + b*100 + c*10 + 1*[+]
|
||||
// i.e 0.6.1+ = 6 * 100 + 1 * 10 = 611.
|
||||
_decomposeVersion: function (aVersion)
|
||||
{
|
||||
var result = 0;
|
||||
if (aVersion.charAt(aVersion.length-1) == "+") {
|
||||
aVersion = aVersion.substr(0, aVersion.length-1);
|
||||
result += 1;
|
||||
}
|
||||
|
||||
var parts = aVersion.split(".");
|
||||
result += this._getValidInt(parts[0]) * 1000;
|
||||
result += this._getValidInt(parts[1]) * 100;
|
||||
result += this._getValidInt(parts[2]) * 10;
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
_getValidInt: function (aPartString)
|
||||
{
|
||||
var integer = parseInt(aPartString);
|
||||
if (isNaN(integer))
|
||||
return 0;
|
||||
return integer;
|
||||
},
|
||||
|
||||
isValidVersion: function (aVersion)
|
||||
{
|
||||
var parts = aVersion.split(".");
|
||||
if (parts.length == 0)
|
||||
return false;
|
||||
for (var i = 0; i < parts.length; ++i) {
|
||||
var part = parts[i];
|
||||
if (i == parts.length - 1) {
|
||||
if (part.lastIndexOf("+") != -1)
|
||||
parts[i] = part.substr(0, part.length - 1);
|
||||
}
|
||||
var integer = parseInt(part);
|
||||
if (isNaN(integer))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
QueryInterface: function (aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIVersionChecker) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
var gModule = {
|
||||
_firstTime: true,
|
||||
|
||||
registerSelf: function (aComponentManager, aFileSpec, aLocation, aType)
|
||||
{
|
||||
if (this._firstTime) {
|
||||
this._firstTime = false;
|
||||
throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
|
||||
}
|
||||
aComponentManager = aComponentManager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
for (var key in this._objects) {
|
||||
var obj = this._objects[key];
|
||||
aComponentManager.registerFactoryLocation(obj.CID, obj.className, obj.contractID,
|
||||
aFileSpec, aLocation, aType);
|
||||
}
|
||||
},
|
||||
|
||||
getClassObject: function (aComponentManager, aCID, aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
for (var key in this._objects) {
|
||||
if (aCID.equals(this._objects[key].CID))
|
||||
return this._objects[key].factory;
|
||||
}
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
_objects: {
|
||||
manager: { CID: Components.ID("{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}"),
|
||||
contractID: "@mozilla.org/updates/update-service;1",
|
||||
className: "Update Service",
|
||||
factory: {
|
||||
createInstance: function (aOuter, aIID)
|
||||
{
|
||||
if (aOuter != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
return (new nsUpdateService()).QueryInterface(aIID);
|
||||
}
|
||||
}
|
||||
},
|
||||
version: { CID: Components.ID("{9408E0A5-509E-45E7-80C1-0F35B99FF7A9}"),
|
||||
contractID: "@mozilla.org/updates/version-checker;1",
|
||||
className: "Version Checker",
|
||||
factory: {
|
||||
createInstance: function (aOuter, aIID)
|
||||
{
|
||||
if (aOuter != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
return (new nsVersionChecker()).QueryInterface(aIID);
|
||||
}
|
||||
}
|
||||
},
|
||||
item: { CID: Components.ID("{F3294B1C-89F4-46F8-98A0-44E1EAE92518}"),
|
||||
contractID: "@mozilla.org/updates/item;1",
|
||||
className: "Extension Item",
|
||||
factory: {
|
||||
createInstance: function (aOuter, aIID)
|
||||
{
|
||||
if (aOuter != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
return new UpdateItem().QueryInterface(aIID);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
canUnload: function (aComponentManager)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
function NSGetModule(compMgr, fileSpec)
|
||||
{
|
||||
return gModule;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:NC="http://home.netscape.com/NC-rdf#">
|
||||
|
||||
<RDF:Description about="urn:mozilla:app:{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
<!-- the version of the application being offered -->
|
||||
<NC:version>1.2</NC:version>
|
||||
|
||||
<!-- a hint to the client as to the severity of this update -->
|
||||
<!-- 0 = low (extension/theme updates),
|
||||
1 = medium (app minor version),
|
||||
2 = high (major version) -->
|
||||
<NC:severity>2</NC:severity>
|
||||
|
||||
<!-- URL to send users to to download this update -->
|
||||
<NC:URL>http://www.mozilla.org/products/firefox/</NC:URL>
|
||||
|
||||
<!-- languages this update is available in -->
|
||||
<NC:language>en-US</NC:language>
|
||||
<NC:language>ja-JP</NC:language>
|
||||
|
||||
<!-- textual description of the changes -->
|
||||
<NC:description>Firefox 1.2 features new goats.</NC:description>
|
||||
</RDF:Description>
|
||||
|
||||
</RDF:RDF>
|
Загрузка…
Ссылка в новой задаче