зеркало из https://github.com/mozilla/gecko-dev.git
We no longer need any of these files
This commit is contained in:
Родитель
23295958bc
Коммит
175130b283
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,32 +0,0 @@
|
|||
#
|
||||
# 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
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
<!DOCTYPE window [
|
||||
<!ENTITY % downloadDTD SYSTEM "chrome://browser/locale/downloads/downloadmanager.dtd" >
|
||||
%downloadDTD;
|
||||
]>
|
||||
|
||||
<bindings id="downloadBindings"
|
||||
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"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
|
||||
<binding id="download">
|
||||
<resources>
|
||||
<stylesheet src="chrome://browser/skin/downloads/downloadmanager.css"/>
|
||||
</resources>
|
||||
<content>
|
||||
<xul:hbox>
|
||||
#ifdef XP_WIN
|
||||
<xul:image style="width: 16px; max-width: 16px; height: 16px; max-height: 16px;" xbl:inherits="src=image"/>
|
||||
#endif
|
||||
<xul:label xbl:inherits="value=target"/>
|
||||
</xul:hbox>
|
||||
<xul:vbox flex="1"
|
||||
#ifdef XP_WIN
|
||||
class="indented"
|
||||
#endif
|
||||
>
|
||||
<xul:hbox flex="1">
|
||||
<xul:progressmeter mode="normal" value="0"
|
||||
xbl:inherits="value=progress,mode=progressmode"/>
|
||||
<xul:label xbl:inherits="value=progress"/>
|
||||
</xul:hbox>
|
||||
<xul:hbox align="start">
|
||||
<xul:label value="&cancel.label;" class="link" onclick="this.parentNode.parentNode.parentNode.cancel();"/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<method name="cancel">
|
||||
<body>
|
||||
<![CDATA[
|
||||
const dlmgrContractID = "@mozilla.org/download-manager;1";
|
||||
const dlmgrIID = Components.interfaces.nsIDownloadManager;
|
||||
var dlmgr = Components.classes[dlmgrContractID].getService(dlmgrIID);
|
||||
dlmgr.cancelDownload(this.id);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
</bindings>
|
|
@ -1,241 +0,0 @@
|
|||
const kObserverServiceProgID = "@mozilla.org/observer-service;1";
|
||||
const NC_NS = "http://home.netscape.com/NC-rdf#";
|
||||
|
||||
var gDownloadManager;
|
||||
var gDownloadHistoryView;
|
||||
|
||||
const dlObserver = {
|
||||
observe: function(subject, topic, state) {
|
||||
if (topic != "dl-progress") return;
|
||||
var dl = subject.QueryInterface(Components.interfaces.nsIDownload);
|
||||
var elt = document.getElementById(dl.target.path);
|
||||
|
||||
var percentComplete = dl.percentComplete;
|
||||
if (percentComplete == -1) {
|
||||
if (!elt.hasAttribute("progressmode"))
|
||||
elt.setAttribute("progressmode", "undetermined");
|
||||
if (elt.hasAttribute("progress"))
|
||||
elt.removeAttribute("progress");
|
||||
}
|
||||
else {
|
||||
elt.setAttribute("progress", percentComplete+"%");
|
||||
if (elt.hasAttribute("progressmode"))
|
||||
elt.removeAttribute("progressmode");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function Startup() {
|
||||
var downloadView = document.getElementById("downloadView");
|
||||
|
||||
const dlmgrContractID = "@mozilla.org/download-manager;1";
|
||||
const dlmgrIID = Components.interfaces.nsIDownloadManager;
|
||||
gDownloadManager = Components.classes[dlmgrContractID].getService(dlmgrIID);
|
||||
|
||||
var ds = gDownloadManager.datasource;
|
||||
|
||||
downloadView.database.AddDataSource(ds);
|
||||
downloadView.builder.rebuild();
|
||||
|
||||
gDownloadHistoryView = document.getElementById("downloadHistoryView");
|
||||
gDownloadHistoryView.database.AddDataSource(ds);
|
||||
gDownloadHistoryView.builder.rebuild();
|
||||
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.addObserver(dlObserver, "dl-progress", false);
|
||||
observerService.addObserver(dlObserver, "dl-done", false);
|
||||
observerService.addObserver(dlObserver, "dl-cancel", false);
|
||||
observerService.addObserver(dlObserver, "dl-failed", false);
|
||||
|
||||
window.setTimeout(onRebuild, 0);
|
||||
}
|
||||
|
||||
function onRebuild() {
|
||||
gDownloadHistoryView.controllers.appendController(downloadViewController);
|
||||
}
|
||||
|
||||
function Shutdown() {
|
||||
var observerService = Components.classes[kObserverServiceProgID]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
observerService.removeObserver(dlObserver, "dl-progress");
|
||||
observerService.removeObserver(dlObserver, "dl-done");
|
||||
observerService.removeObserver(dlObserver, "dl-cancel");
|
||||
observerService.removeObserver(dlObserver, "dl-failed");
|
||||
}
|
||||
|
||||
var downloadDNDObserver =
|
||||
{
|
||||
onDragOver: function (aEvent, aFlavour, aDragSession)
|
||||
{
|
||||
aDragSession.canDrop = true;
|
||||
},
|
||||
|
||||
onDrop: function(aEvent, aXferData, aDragSession)
|
||||
{
|
||||
var split = aXferData.data.split("\n");
|
||||
var url = split[0];
|
||||
if (url != aXferData.data) { //do nothing, not a valid URL
|
||||
var name = split[1];
|
||||
saveURL(url, name, null, true, true);
|
||||
}
|
||||
},
|
||||
_flavourSet: null,
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
if (!this._flavourSet) {
|
||||
this._flavourSet = new FlavourSet();
|
||||
this._flavourSet.appendFlavour("text/x-moz-url");
|
||||
this._flavourSet.appendFlavour("text/unicode");
|
||||
}
|
||||
return this._flavourSet;
|
||||
}
|
||||
}
|
||||
|
||||
function onSelect(aEvent) {
|
||||
window.updateCommands("list-select");
|
||||
}
|
||||
|
||||
var downloadViewController = {
|
||||
supportsCommand: function dVC_supportsCommand (aCommand)
|
||||
{
|
||||
switch (aCommand) {
|
||||
case "cmd_properties":
|
||||
case "cmd_remove":
|
||||
case "cmd_openfile":
|
||||
case "cmd_showinshell":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
isCommandEnabled: function dVC_isCommandEnabled (aCommand)
|
||||
{
|
||||
var selectionCount = gDownloadHistoryView.selectedCount;
|
||||
if (!selectionCount) return false;
|
||||
|
||||
var selectedItem = gDownloadHistoryView.selectedItem;
|
||||
switch (aCommand) {
|
||||
case "cmd_openfile":
|
||||
case "cmd_showinshell":
|
||||
case "cmd_properties":
|
||||
return selectionCount == 1;
|
||||
case "cmd_remove":
|
||||
return selectionCount;
|
||||
case "cmd_selectAll":
|
||||
return gDownloadHistoryView.getRowCount() != selectionCount;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
doCommand: function dVC_doCommand (aCommand)
|
||||
{
|
||||
var selectedItem, selectedItems, file, i;
|
||||
|
||||
switch (aCommand) {
|
||||
case "cmd_openfile":
|
||||
selectedItem = gDownloadHistoryView.selectedItem;
|
||||
file = getFileForItem(selectedItem);
|
||||
file.launch();
|
||||
break;
|
||||
case "cmd_showinshell":
|
||||
selectedItem = gDownloadHistoryView.selectedItem;
|
||||
file = getFileForItem(selectedItem);
|
||||
|
||||
#ifdef XP_UNIX
|
||||
// on unix, open a browser window rooted at the parent
|
||||
file = file.QueryInterface(Components.interfaces.nsIFile);
|
||||
var parent = file.parent;
|
||||
if (parent) {
|
||||
//XXXBlake use chromeUrlForTask pref here
|
||||
const browserURL = "chrome://browser/content/browser.xul";
|
||||
window.openDialog(browserURL, "_blank", "chrome,all,dialog=no", parent.path);
|
||||
}
|
||||
#else
|
||||
file.reveal();
|
||||
#endif
|
||||
break;
|
||||
case "cmd_properties":
|
||||
selectedItem = gDownloadHistoryView.selectedItem;
|
||||
window.openDialog("chrome://browser/content/downloads/downloadProperties.xul",
|
||||
"_blank", "modal,centerscreen,chrome,resizable=no", selectedItem.id);
|
||||
break;
|
||||
case "cmd_remove":
|
||||
selectedItems = gDownloadHistoryView.selectedItems;
|
||||
var selectedIndex = gDownloadHistoryView.selectedIndex;
|
||||
gDownloadManager.startBatchUpdate();
|
||||
|
||||
// Notify the datasource that we're about to begin a batch operation
|
||||
gDownloadManager.datasource.beginUpdateBatch();
|
||||
for (i = 0; i <= selectedItems.length - 1; ++i) {
|
||||
gDownloadManager.removeDownload(selectedItems[i].id);
|
||||
}
|
||||
gDownloadManager.datasource.endUpdateBatch();
|
||||
|
||||
gDownloadManager.endBatchUpdate();
|
||||
var rowCount = gDownloadHistoryView.getRowCount();
|
||||
if (selectedIndex > ( rowCount- 1))
|
||||
selectedIndex = rowCount - 1;
|
||||
|
||||
gDownloadHistoryView.selectedIndex = selectedIndex;
|
||||
break;
|
||||
case "cmd_selectAll":
|
||||
gDownloadHistoryView.selectAll();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
},
|
||||
|
||||
onEvent: function dVC_onEvent (aEvent)
|
||||
{
|
||||
switch (aEvent) {
|
||||
case "list-select":
|
||||
this.onCommandUpdate();
|
||||
}
|
||||
},
|
||||
|
||||
onCommandUpdate: function dVC_onCommandUpdate ()
|
||||
{
|
||||
var cmds = ["cmd_properties", "cmd_remove",
|
||||
"cmd_openfile", "cmd_showinshell"];
|
||||
for (var command in cmds)
|
||||
goUpdateCommand(cmds[command]);
|
||||
}
|
||||
};
|
||||
|
||||
function getFileForItem(aElement)
|
||||
{
|
||||
return createLocalFile(aElement.id);
|
||||
}
|
||||
|
||||
function createLocalFile(aFilePath)
|
||||
{
|
||||
var lfContractID = "@mozilla.org/file/local;1";
|
||||
var lfIID = Components.interfaces.nsILocalFile;
|
||||
var lf = Components.classes[lfContractID].createInstance(lfIID);
|
||||
lf.initWithPath(aFilePath);
|
||||
return lf;
|
||||
}
|
||||
|
||||
function buildContextMenu()
|
||||
{
|
||||
var selectionCount = gDownloadHistoryView.selectedCount;
|
||||
if (!selectionCount)
|
||||
return false;
|
||||
|
||||
var launchItem = document.getElementById("menuitem_launch");
|
||||
var launchSep = document.getElementById("menuseparator_launch");
|
||||
var removeItem = document.getElementById("menuitem_remove");
|
||||
var showItem = document.getElementById("menuitem_show");
|
||||
var propsItem = document.getElementById("menuitem_properties");
|
||||
var propsSep = document.getElementById("menuseparator_properties");
|
||||
showItem.hidden = selectionCount != 1;
|
||||
launchItem.hidden = selectionCount != 1;
|
||||
launchSep.hidden = selectionCount != 1;
|
||||
propsItem.hidden = selectionCount != 1;
|
||||
propsSep.hidden = selectionCount != 1;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/content/downloads/downloadmanager.css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/downloads/downloadmanager.css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % downloadManagerDTD SYSTEM "chrome://browser/locale/downloads/downloadmanager.dtd">
|
||||
%downloadManagerDTD;
|
||||
]>
|
||||
|
||||
<page xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="Startup();" onunload="Shutdown();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/downloads/downloadPanel.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<commandset id="commandUpdate_Downloads"
|
||||
commandupdater="true"
|
||||
events="focus,list-select"
|
||||
oncommandupdate="downloadViewController.onCommandUpdate()"/>
|
||||
|
||||
<command id="cmd_properties"
|
||||
oncommand="goDoCommand('cmd_properties');"/>
|
||||
<command id="cmd_remove"
|
||||
oncommand="goDoCommand('cmd_remove');"/>
|
||||
<command id="cmd_openfile"
|
||||
oncommand="goDoCommand('cmd_openfile');"/>
|
||||
<command id="cmd_showinshell"
|
||||
oncommand="goDoCommand('cmd_showinshell');"/>
|
||||
|
||||
<keyset>
|
||||
<key id="key_remove" keycode="VK_DELETE" command="cmd_remove"/>
|
||||
</keyset>
|
||||
|
||||
<popup id="downloadHistoryPopup" onpopupshowing="return buildContextMenu();">
|
||||
<menuitem id="menuitem_launch" label="&cmd.openfile.label;" default="true"
|
||||
accesskey="&cmd.openfile.accesskey;" command="cmd_openfile"/>
|
||||
<menuitem id="menuitem_show" label="&cmd.show.label;" accesskey="&cmd.show.accesskey;"
|
||||
command="cmd_showinshell"/>
|
||||
<menuseparator id="menuseparator_launch"/>
|
||||
<menuitem id="menuitem_remove" label="&cmd.remove.label;" accesskey="&cmd.remove.accesskey;"
|
||||
command="cmd_remove"/>
|
||||
<menuseparator id="menuseparator_properties"/>
|
||||
<menuitem id="menuitem_properties" label="&cmd.properties.label;" accesskey="&cmd.properties.accesskey;"
|
||||
command="cmd_properties"/>
|
||||
</popup>
|
||||
|
||||
<vbox flex="1">
|
||||
<vbox id="downloadView" flex="3" style="overflow: auto;"
|
||||
datasources="rdf:null" ref="NC:DownloadsRoot"
|
||||
ondragdrop="nsDragAndDrop.drop(event, downloadDNDObserver);">
|
||||
<template>
|
||||
<rule nc:DownloadState="0" parsetype="Integer">
|
||||
<download uri="rdf:*"
|
||||
image="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"
|
||||
target="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
file="rdf:http://home.netscape.com/NC-rdf#File"/>
|
||||
</rule>
|
||||
</template>
|
||||
</vbox>
|
||||
<splitter id="download-splitter" style="min-height: 3px; height: 3px;"/>
|
||||
<vbox flex="1">
|
||||
<sidebarheader align="center">
|
||||
<label value="&finishedDownloads.label;"/>
|
||||
</sidebarheader>
|
||||
<listbox id="downloadHistoryView" flex="1" class="plain" seltype="multiple"
|
||||
datasources="rdf:null" ref="NC:DownloadsRoot" flags="dont-test-empty"
|
||||
ondblclick="if (isValidLeftClick(event,'listitem')) goDoCommand('cmd_openfile');"
|
||||
onselect="onSelect(event);" context="downloadHistoryPopup">
|
||||
<listcols>
|
||||
<listcol id="Name" primary="true"
|
||||
label="&name.label;"
|
||||
width="3*" flex="3"
|
||||
persist="width"/>
|
||||
</listcols>
|
||||
<template>
|
||||
<rule nc:DownloadState="1" parsetype="Integer">
|
||||
<listitem uri="rdf:*">
|
||||
<listrow>
|
||||
<listcell>
|
||||
<image src="moz-icon:rdf:http://home.netscape.com/NC-rdf#File"/>
|
||||
<label value="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
</listcell>
|
||||
</listrow>
|
||||
</listitem>
|
||||
</rule>
|
||||
</template>
|
||||
</listbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</page>
|
|
@ -1,43 +0,0 @@
|
|||
function Startup()
|
||||
{
|
||||
const NC_NS = "http://home.netscape.com/NC-rdf#";
|
||||
const rdfSvcContractID = "@mozilla.org/rdf/rdf-service;1";
|
||||
const rdfSvcIID = Components.interfaces.nsIRDFService;
|
||||
var rdfService = Components.classes[rdfSvcContractID].getService(rdfSvcIID);
|
||||
|
||||
const dlmgrContractID = "@mozilla.org/download-manager;1";
|
||||
const dlmgrIID = Components.interfaces.nsIDownloadManager;
|
||||
var downloadMgr = Components.classes[dlmgrContractID].getService(dlmgrIID);
|
||||
var ds = downloadMgr.datasource;
|
||||
|
||||
const dateTimeContractID = "@mozilla.org/intl/scriptabledateformat;1";
|
||||
const dateTimeIID = Components.interfaces.nsIScriptableDateFormat;
|
||||
var dateTimeService = Components.classes[dateTimeContractID].getService(dateTimeIID);
|
||||
|
||||
var resource = rdfService.GetUnicodeResource(window.arguments[0]);
|
||||
var dateStartedRes = rdfService.GetResource(NC_NS + "DateStarted");
|
||||
var dateEndedRes = rdfService.GetResource(NC_NS + "DateEnded");
|
||||
var sourceRes = rdfService.GetResource(NC_NS + "URL");
|
||||
|
||||
var dateStartedField = document.getElementById("dateStarted");
|
||||
var dateEndedField = document.getElementById("dateEnded");
|
||||
var pathField = document.getElementById("path");
|
||||
var sourceField = document.getElementById("source");
|
||||
|
||||
var dateStarted = ds.GetTarget(resource, dateStartedRes, true).QueryInterface(Components.interfaces.nsIRDFDate).Value;
|
||||
var dateEnded = ds.GetTarget(resource, dateEndedRes, true).QueryInterface(Components.interfaces.nsIRDFDate).Value;
|
||||
dateStarted = new Date(dateStarted/1000);
|
||||
dateStarted = dateTimeService.FormatDateTime("", dateTimeService.dateFormatShort, dateTimeService.timeFormatSeconds, dateStarted.getFullYear(), dateStarted.getMonth()+1, dateStarted.getDate(), dateStarted.getHours(), dateStarted.getMinutes(), dateStarted.getSeconds());
|
||||
dateEnded = new Date(dateEnded/1000);
|
||||
dateEnded = dateTimeService.FormatDateTime("", dateTimeService.dateFormatShort, dateTimeService.timeFormatSeconds, dateEnded.getFullYear(), dateEnded.getMonth()+1, dateEnded.getDate(), dateEnded.getHours(), dateEnded.getMinutes(), dateEnded.getSeconds());
|
||||
|
||||
var source = ds.GetTarget(resource, sourceRes, true).QueryInterface(Components.interfaces.nsIRDFResource).Value;
|
||||
|
||||
dateStartedField.setAttribute("value", dateStarted);
|
||||
dateEndedField.setAttribute("value", dateEnded);
|
||||
pathField.value = window.arguments[0];
|
||||
sourceField.value = source;
|
||||
|
||||
document.documentElement.getButton("accept").focus();
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/downloads/downloadmanager.css"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % downloadPropertiesDTD SYSTEM "chrome://browser/locale/downloads/downloadProperties.dtd">
|
||||
%downloadPropertiesDTD;
|
||||
]>
|
||||
|
||||
<dialog xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&window.title;"
|
||||
onload="Startup();"
|
||||
width="400"
|
||||
height="170"
|
||||
buttons="accept">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://browser/content/downloads/downloadProperties.js"/>
|
||||
|
||||
<grid flex="1">
|
||||
<columns>
|
||||
<column/>
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row align="center">
|
||||
<hbox pack="end">
|
||||
<label value="&downloadedFrom.label;" class="bold"/>
|
||||
</hbox>
|
||||
<textbox id="source" readonly="true"/>
|
||||
</row>
|
||||
<spacer flex="1"/>
|
||||
<row align="center">
|
||||
<hbox pack="end">
|
||||
<label value="&path.label;" class="bold"/>
|
||||
</hbox>
|
||||
<textbox id="path" readonly="true"/>
|
||||
</row>
|
||||
<spacer flex="1"/>
|
||||
<row align="center">
|
||||
<hbox pack="end">
|
||||
<label value="&dateStarted.label;" class="bold"/>
|
||||
</hbox>
|
||||
<hbox flex="1">
|
||||
<label id="dateStarted"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&dateEnded.label;" class="bold"/>
|
||||
<label id="dateEnded"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<separator class="groove"/>
|
||||
</dialog>
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
download {
|
||||
-moz-binding: url('chrome://browser/content/downloads/download-bindings.xml#download');
|
||||
-moz-box-orient: vertical;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
browser.jar:
|
||||
* content/browser/downloads/downloadPanel.js (content/downloadPanel.js)
|
||||
content/browser/downloads/downloadPanel.xul (content/downloadPanel.xul)
|
||||
* content/browser/downloads/download-bindings.xml (content/download-bindings.xml)
|
||||
content/browser/downloads/downloadmanager.css (content/downloadmanager.css)
|
||||
content/browser/downloads/downloadProperties.xul (content/downloadProperties.xul)
|
||||
content/browser/downloads/downloadProperties.js (content/downloadProperties.js)
|
||||
|
||||
classic.jar:
|
||||
skin/classic/browser/downloads/downloadmanager.css (skin/downloadmanager.css)
|
||||
|
||||
en-US.jar:
|
||||
locale/en-US/browser/downloads/downloadmanager.dtd (locale/downloadmanager.dtd)
|
||||
locale/en-US/browser/downloads/downloadmanager.properties (locale/downloadmanager.properties)
|
||||
locale/en-US/browser/downloads/downloadProperties.dtd (locale/downloadProperties.dtd)
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<!ENTITY dateStarted.label "Started:">
|
||||
<!ENTITY dateEnded.label "Finished:">
|
||||
<!ENTITY window.title "Properties">
|
||||
<!ENTITY downloadedFrom.label "From:">
|
||||
<!ENTITY path.label "To:">
|
|
@ -1,37 +0,0 @@
|
|||
<!ENTITY name.label "Name">
|
||||
<!ENTITY progress.label "Progress">
|
||||
<!ENTITY status.label "Status">
|
||||
<!ENTITY timeremaining.label "Time Remaining">
|
||||
<!ENTITY transferred.label "Transferred">
|
||||
<!ENTITY transferrate.label "Speed">
|
||||
<!ENTITY timeelapsed.label "Time Elapsed">
|
||||
<!ENTITY status.label "Status">
|
||||
<!--<!ENTITY progresstext.label "%">-->
|
||||
<!ENTITY source.label "Source">
|
||||
|
||||
<!ENTITY done.label "Done">
|
||||
<!ENTITY cancel.label "Cancel">
|
||||
<!ENTITY cancelled.label "Cancelled">
|
||||
<!ENTITY launch.label "Launch">
|
||||
<!ENTITY divider.label "-">
|
||||
<!ENTITY show.label "Show">
|
||||
<!ENTITY failed.label "Failed">
|
||||
<!ENTITY finishedDownloads.label "Finished Downloads">
|
||||
|
||||
<!ENTITY downloadManager.title "Download Manager">
|
||||
|
||||
<!ENTITY cmd.properties.label "Properties">
|
||||
<!ENTITY cmd.properties.accesskey "i">
|
||||
<!ENTITY cmd.pause.label "Pause">
|
||||
<!ENTITY cmd.pause.accesskey "p">
|
||||
<!ENTITY cmd.remove.label "Remove">
|
||||
<!ENTITY cmd.remove.accesskey "r">
|
||||
<!ENTITY cmd.cancel.label "Cancel">
|
||||
<!ENTITY cmd.cancel.accesskey "c">
|
||||
<!ENTITY cmd.openfile.label "Open">
|
||||
<!ENTITY cmd.openfile.accesskey "O">
|
||||
<!ENTITY cmd.show.label "Show">
|
||||
<!ENTITY cmd.show.accesskey "S">
|
||||
<!ENTITY confirmCancel "Are you sure you want to cancel the saving of this file?">
|
||||
<!ENTITY progressMsgNoRate "#1KB of #2KB">
|
||||
<!ENTITY rateMsg "#1KB/sec">
|
|
@ -1,16 +0,0 @@
|
|||
transferred=%1SKB of %2SKB
|
||||
downloading=Downloading
|
||||
notStarted=Not Started
|
||||
failed=Failed
|
||||
finished=Finished
|
||||
canceled=Canceled
|
||||
alertTitle=Download Error
|
||||
|
||||
showInShellLabelWin=Show in Explorer
|
||||
showInShellAccesskeyWin=E
|
||||
|
||||
showInShellLabelMac=Show in Finder
|
||||
showInShellAccesskeyMac=F
|
||||
|
||||
showInShellLabelUnix=Show in Browser
|
||||
showInShellAccesskeyUnix=B
|
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,35 +0,0 @@
|
|||
#
|
||||
# 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 = downloads
|
||||
|
||||
XPIDLSRCS = nsIDownloadManager.idl \
|
||||
nsIDownloadProgressListener.idl \
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blaker@netscape.com>
|
||||
* Ben Goodger <ben@netscape.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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Keeps track of ongoing downloads, in the form of nsIDownload's.
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIURI;
|
||||
interface nsILocalFile;
|
||||
interface nsIDownload;
|
||||
interface nsIWebBrowserPersist;
|
||||
interface nsIMIMEInfo;
|
||||
interface nsIRDFDataSource;
|
||||
|
||||
[scriptable, uuid(9be66cc0-1dd1-11b2-8617-e3a3ed26e3b0)]
|
||||
interface nsIDownloadManager : nsISupports {
|
||||
|
||||
// Methods called by clients to carry out various managing functions
|
||||
|
||||
/**
|
||||
* Creates an nsIDownload and adds it to be managed by the download manager.
|
||||
*
|
||||
* @param aSource The source (nsIURI) of the download.
|
||||
*
|
||||
* @param aTarget The local file to which the download is being saved.
|
||||
*
|
||||
* @param aDisplayName The user-readable description of the download.
|
||||
*
|
||||
* @param aPersist The "persist" used to transfer the download. If set,
|
||||
* the manager will set its listener to the download item
|
||||
* and use it for cancellation. If not set, the client
|
||||
* is expected to set the download item as the listener on
|
||||
* whatever transfer component is being used, and to
|
||||
* set an observer on the download item that listens for
|
||||
* the "oncancel" topic and cancels the download.
|
||||
*
|
||||
* @return The newly created download item with the passed-in properties.
|
||||
*/
|
||||
|
||||
nsIDownload addDownload(in nsIURI aSource,
|
||||
in nsILocalFile aTarget,
|
||||
in wstring aDisplayName,
|
||||
in nsIMIMEInfo aMIMEInfo,
|
||||
in long long startTime,
|
||||
in nsIWebBrowserPersist aPersist);
|
||||
|
||||
/**
|
||||
* Retrieves an in-progress download managed by the download manager.
|
||||
*
|
||||
* @param aPersistentDescriptor The unique identifier used to describe a
|
||||
* a download, and an attribute of nsILocalFile.
|
||||
* On Windows and Linux, this is just the path
|
||||
* of the target, but on Mac this is guaranteed
|
||||
* to be unique.
|
||||
*
|
||||
* @return The download with the specified persistent descriptor.
|
||||
*/
|
||||
|
||||
nsIDownload getDownload(in wstring aPersistentDescriptor);
|
||||
|
||||
/**
|
||||
* Cancels the download with the specified persistent descriptor if it's
|
||||
* currently in progress. If a "persist" was specified for the download,
|
||||
* nsIWebBrowserPersist::CancelSave will be called. If an observer was set
|
||||
* on the nsIDownload, it will be notified with the "oncancel" topic. Clients
|
||||
* that don't provide a "persist" must listen for this topic and cancel the
|
||||
* download.
|
||||
*
|
||||
* @param aPersistentDescriptor The persistent descriptor of the download to
|
||||
* be cancelled.
|
||||
*/
|
||||
|
||||
void cancelDownload(in wstring aPersistentDescriptor);
|
||||
|
||||
/**
|
||||
* Removes the download with the specified persistent descriptor if it's not
|
||||
* currently in progress. Whereas cancelDownload simply cancels the transfer
|
||||
* but retains information about it, removeDownload removes all knowledge of it.
|
||||
*
|
||||
* @param aPersistentDescriptor The persistent descriptor of the download to
|
||||
* be removed.
|
||||
*/
|
||||
|
||||
void removeDownload(in wstring aPersistentDescriptor);
|
||||
|
||||
// UI-related methods
|
||||
|
||||
/**
|
||||
* Opens an individual progress dialog displaying progress for the download.
|
||||
*
|
||||
* @param aPersistentDescriptor The persistent descriptor of the download to
|
||||
* display progress for.
|
||||
*
|
||||
* @param aParent The parent, or opener, of the front end (optional).
|
||||
*/
|
||||
|
||||
void openProgressDialogFor(in wstring aPersistentDescriptor, in nsIDOMWindow aParent);
|
||||
|
||||
/**
|
||||
* Indicate that a batch update (e.g. mass removal) is about to start.
|
||||
*/
|
||||
|
||||
void startBatchUpdate();
|
||||
|
||||
/**
|
||||
* Indicate that a batch update is ending.
|
||||
*/
|
||||
|
||||
void endBatchUpdate();
|
||||
|
||||
readonly attribute nsIRDFDataSource datasource;
|
||||
};
|
||||
|
||||
|
||||
%{C++
|
||||
#define NS_DOWNLOADMANAGER_CONTRACTID "@mozilla.org/download-manager;1"
|
||||
#define NS_DOWNLOADMANAGER_CLASSNAME "Mozilla Download Manager"
|
||||
// {EDB0490E-1DD1-11B2-83B8-DBF8D85906A6}
|
||||
#define NS_DOWNLOADMANAGER_CID \
|
||||
{ 0xedb0490e, 0x1dd1, 0x11b2, { 0x83, 0xb8, 0xdb, 0xf8, 0xd8, 0x59, 0x06, 0xa6 } }
|
||||
%}
|
|
@ -1,95 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blaker@netscape.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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* A minimally extended progress listener used by download manager
|
||||
* to update its default UI. This is implemented in nsDownloadProgressListener.js.
|
||||
* See nsIWebProgressListener for documentation, and use its constants. This isn't
|
||||
* too pretty, but the alternative is having this extend nsIWebProgressListener and
|
||||
* adding an |item| attribute, which would mean a separate nsIDownloadProgressListener
|
||||
* for every nsIDownloadItem, which is a waste...
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIWebProgress;
|
||||
interface nsIRequest;
|
||||
interface nsIURI;
|
||||
interface nsIDownload;
|
||||
interface nsIDOMDocument;
|
||||
|
||||
[scriptable, uuid(09cddbea-1dd2-11b2-aa15-c41ffea19d79)]
|
||||
interface nsIDownloadProgressListener : nsISupports {
|
||||
|
||||
/**
|
||||
* document
|
||||
* The document of the download manager frontend.
|
||||
*/
|
||||
|
||||
attribute nsIDOMDocument document;
|
||||
|
||||
void onStateChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in unsigned long aStateFlags,
|
||||
in nsresult aStatus,
|
||||
in nsIDownload aDownload);
|
||||
|
||||
void onProgressChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in long aCurSelfProgress,
|
||||
in long aMaxSelfProgress,
|
||||
in long aCurTotalProgress,
|
||||
in long aMaxTotalProgress,
|
||||
in nsIDownload aDownload);
|
||||
|
||||
void onStatusChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in nsresult aStatus,
|
||||
in wstring aMessage,
|
||||
in nsIDownload aDownload);
|
||||
|
||||
void onLocationChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in nsIURI aLocation,
|
||||
in nsIDownload aDownload);
|
||||
|
||||
void onSecurityChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in unsigned long aState,
|
||||
in nsIDownload aDownload);
|
||||
|
||||
};
|
|
@ -1,54 +0,0 @@
|
|||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#downloadView {
|
||||
background-color: Window;
|
||||
padding: 10px 0px 10px 10px;
|
||||
}
|
||||
|
||||
download {
|
||||
padding: 3px 0px 3px 3px;
|
||||
min-height: 25px;
|
||||
}
|
||||
|
||||
#downloadHistoryView > treechildren::-moz-tree-image(Name) {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.indented {
|
||||
margin-left: 17px;
|
||||
}
|
||||
|
||||
listcell {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.link {
|
||||
text-decoration: underline;
|
||||
color: blue;
|
||||
cursor: pointer;
|
||||
-moz-user-focus: normal;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.link:hover:active {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.link:focus {
|
||||
border: 1px dotted black;
|
||||
}
|
||||
|
||||
#download-splitter {
|
||||
border: none;
|
||||
border-bottom: 1px solid ThreeDLightShadow;
|
||||
-moz-appearance: toolbox;
|
||||
}
|
||||
|
||||
#close-button {
|
||||
list-style-image: url("chrome://global/skin/icons/Close.gif");
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,59 +0,0 @@
|
|||
#! gmake
|
||||
#
|
||||
# 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 mozilla.org code
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stuart Parmenter <pavlov@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = downloads
|
||||
LIBRARY_NAME = download_s
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
rdf \
|
||||
uriloader \
|
||||
mimetype \
|
||||
necko \
|
||||
progressDlg \
|
||||
intl \
|
||||
windowwatcher \
|
||||
webbrowserpersist \
|
||||
appshell \
|
||||
dom \
|
||||
$(NULL)
|
||||
CPPSRCS = \
|
||||
nsDownloadManager.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_COMPONENTS = nsDownloadProgressListener.js
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,150 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blaker@netscape.com>
|
||||
* Ben Goodger <ben@netscape.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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef downloadmanager___h___
|
||||
#define downloadmanager___h___
|
||||
|
||||
#include "nsIDownloadManager.h"
|
||||
#include "nsIDownloadProgressListener.h"
|
||||
#include "nsIDownload.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFRemoteDataSource.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIRDFContainerUtils.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebBrowserPersist.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIProgressDialog.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
enum DownloadState { NOTSTARTED = -1, DOWNLOADING, FINISHED, FAILED, CANCELED };
|
||||
|
||||
class nsDownloadManager : public nsIDownloadManager,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOWNLOADMANAGER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
nsresult Init();
|
||||
|
||||
nsDownloadManager();
|
||||
virtual ~nsDownloadManager();
|
||||
|
||||
static PRInt32 PR_CALLBACK CancelAllDownloads(nsHashKey* aKey, void* aData, void* aClosure);
|
||||
nsresult DownloadEnded(const PRUnichar* aPersistentDescriptor, const PRUnichar* aMessage);
|
||||
|
||||
protected:
|
||||
nsresult GetDownloadsContainer(nsIRDFContainer** aResult);
|
||||
nsresult GetProfileDownloadsFileURL(nsCString& aDownloadsFileURL);
|
||||
nsresult GetDataSource(nsIRDFDataSource** aDataSource);
|
||||
nsresult DownloadStarted(const PRUnichar* aPersistentDescriptor);
|
||||
nsresult AssertProgressInfoFor(const PRUnichar* aPersistentDescriptor);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIRDFDataSource> mDataSource;
|
||||
nsCOMPtr<nsIRDFContainer> mDownloadsContainer;
|
||||
nsCOMPtr<nsIRDFContainerUtils> mRDFContainerUtils;
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
PRInt32 mBatches;
|
||||
nsHashtable mCurrDownloads;
|
||||
|
||||
friend class nsDownload;
|
||||
};
|
||||
|
||||
class nsDownload : public nsIDownload,
|
||||
public nsIWebProgressListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSIDOWNLOAD
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsDownload();
|
||||
virtual ~nsDownload();
|
||||
|
||||
protected:
|
||||
nsresult SetDownloadManager(nsDownloadManager* aDownloadManager);
|
||||
nsresult SetDialogListener(nsIWebProgressListener* aInternalListener);
|
||||
nsresult GetDialogListener(nsIWebProgressListener** aInternalListener);
|
||||
nsresult SetDialog(nsIProgressDialog* aDialog);
|
||||
nsresult GetDialog(nsIProgressDialog** aDialog);
|
||||
nsresult SetPersist(nsIWebBrowserPersist* aPersist);
|
||||
nsresult SetTarget(nsILocalFile* aTarget);
|
||||
nsresult SetSource(nsIURI* aSource);
|
||||
nsresult GetTransferInformation(PRInt32* aCurr, PRInt32* aMax);
|
||||
nsresult GetDownloadState(DownloadState* aState);
|
||||
nsresult SetDownloadState(DownloadState aState);
|
||||
nsresult SetMIMEInfo(nsIMIMEInfo* aMIMEInfo);
|
||||
nsresult SetStartTime(PRInt64 aStartTime);
|
||||
nsDownloadManager* mDownloadManager;
|
||||
nsCOMPtr<nsILocalFile> mTarget;
|
||||
|
||||
private:
|
||||
nsString mDisplayName;
|
||||
|
||||
nsCOMPtr<nsIURI> mSource;
|
||||
nsCOMPtr<nsIWebProgressListener> mListener;
|
||||
nsCOMPtr<nsIWebProgressListener> mDialogListener;
|
||||
nsCOMPtr<nsIWebBrowserPersist> mPersist;
|
||||
nsCOMPtr<nsIRequest> mRequest;
|
||||
nsCOMPtr<nsIProgressDialog> mDialog;
|
||||
nsCOMPtr<nsIObserver> mObserver;
|
||||
nsCOMPtr<nsIMIMEInfo> mMIMEInfo;
|
||||
|
||||
DownloadState mDownloadState;
|
||||
|
||||
PRInt32 mPercentComplete;
|
||||
PRInt32 mCurrBytes;
|
||||
PRInt32 mMaxBytes;
|
||||
PRInt64 mStartTime;
|
||||
PRTime mLastUpdate;
|
||||
|
||||
friend class nsDownloadManager;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,319 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blaker@netscape.com> (Original Author)
|
||||
*
|
||||
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gStrings = new Array;
|
||||
const interval = 500; // Update every 500 milliseconds.
|
||||
|
||||
function nsDownloadProgressListener() {
|
||||
}
|
||||
|
||||
nsDownloadProgressListener.prototype = {
|
||||
elapsed: 0,
|
||||
rateChanges: 0,
|
||||
rateChangeLimit: 0,
|
||||
priorRate: 0,
|
||||
lastUpdate: -500,
|
||||
doc: null,
|
||||
get document() {
|
||||
return this.doc;
|
||||
},
|
||||
set document(newval) {
|
||||
return this.doc = newval;
|
||||
},
|
||||
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus, aDownload)
|
||||
{
|
||||
if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
|
||||
{
|
||||
var aDownloadID = aDownload.target.persistentDescriptor;
|
||||
var elt = this.doc.getElementById(aDownloadID).firstChild.firstChild;
|
||||
|
||||
var timeRemainingCol = elt.nextSibling.nextSibling.nextSibling;
|
||||
timeRemainingCol.setAttribute("label", "");
|
||||
|
||||
var speedCol = timeRemainingCol.nextSibling.nextSibling;
|
||||
speedCol.setAttribute("label", "");
|
||||
|
||||
var elapsedCol = speedCol.nextSibling;
|
||||
elapsedCol.setAttribute("label", "");
|
||||
}
|
||||
},
|
||||
|
||||
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress, aDownload)
|
||||
{
|
||||
var overallProgress = aCurTotalProgress;
|
||||
// Get current time.
|
||||
var now = ( new Date() ).getTime();
|
||||
// If interval hasn't elapsed, ignore it.
|
||||
if ( now - this.lastUpdate < interval && aMaxTotalProgress != "-1" && parseInt(aCurTotalProgress) < parseInt(aMaxTotalProgress) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update this time.
|
||||
this.lastUpdate = now;
|
||||
|
||||
// Update download rate.
|
||||
this.elapsed = now - (aDownload.startTime / 1000);
|
||||
var rate; // aCurTotalProgress/sec
|
||||
if ( this.elapsed )
|
||||
rate = ( aCurTotalProgress * 1000 ) / this.elapsed;
|
||||
else
|
||||
rate = 0;
|
||||
|
||||
var aDownloadID = aDownload.target.persistentDescriptor;
|
||||
var elt = this.doc.getElementById(aDownloadID).firstChild.firstChild;
|
||||
if (this.doc.getElementById("TimeElapsed").getAttribute("hidden") != "true") {
|
||||
elapsedCol = elt.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;
|
||||
// Update elapsed time display.
|
||||
elapsedCol.setAttribute("label", formatSeconds( this.elapsed / 1000, this.doc ));
|
||||
}
|
||||
// Calculate percentage.
|
||||
var percent;
|
||||
var progressCol = elt.nextSibling;
|
||||
if ( aMaxTotalProgress > 0)
|
||||
{
|
||||
percent = Math.floor((overallProgress*100.0)/aMaxTotalProgress);
|
||||
if ( percent > 100 )
|
||||
percent = 100;
|
||||
|
||||
// Advance progress meter.
|
||||
progressCol.setAttribute( "value", percent );
|
||||
|
||||
progressCol.setAttribute("mode", "normal");
|
||||
}
|
||||
else
|
||||
{
|
||||
percent = -1;
|
||||
|
||||
// Progress meter should be barber-pole in this case.
|
||||
progressCol.setAttribute( "mode", "undetermined" );
|
||||
}
|
||||
|
||||
// now that we've set the progress and the time, update # bytes downloaded...
|
||||
// Update status (nnK of mmK bytes at xx.xK aCurTotalProgress/sec)
|
||||
var status = getString( "progressMsgNoRate", this.doc );
|
||||
|
||||
// Insert 1 is the number of kilobytes downloaded so far.
|
||||
status = replaceInsert( status, 1, parseInt( overallProgress/1024 + .5 ) );
|
||||
|
||||
// Insert 2 is the total number of kilobytes to be downloaded (if known).
|
||||
if ( aMaxTotalProgress != "-1" )
|
||||
status = replaceInsert( status, 2, parseInt( aMaxTotalProgress/1024 + .5 ) );
|
||||
else
|
||||
status = replaceInsert( status, 2, "??" );
|
||||
|
||||
var rateMsg = getString( "rateMsg", this.doc );
|
||||
if ( rate )
|
||||
{
|
||||
// rate is bytes/sec
|
||||
var kRate = rate / 1024; // K bytes/sec;
|
||||
kRate = parseInt( kRate * 10 + .5 ); // xxx (3 digits)
|
||||
// Don't update too often!
|
||||
if ( kRate != this.priorRate )
|
||||
{
|
||||
if ( this.rateChanges++ == this.rateChangeLimit )
|
||||
{
|
||||
// Time to update download rate.
|
||||
this.priorRate = kRate;
|
||||
this.rateChanges = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Stick with old rate for a bit longer.
|
||||
kRate = this.priorRate;
|
||||
}
|
||||
}
|
||||
else
|
||||
this.rateChanges = 0;
|
||||
|
||||
var fraction = kRate % 10;
|
||||
kRate = parseInt( ( kRate - fraction ) / 10 );
|
||||
|
||||
// Insert 3 is the download rate (in kilobytes/sec).
|
||||
rateMsg = replaceInsert( rateMsg, 1, kRate + "." + fraction );
|
||||
}
|
||||
else
|
||||
rateMsg = replaceInsert( rateMsg, 1, "??.?" );
|
||||
|
||||
var timeRemainingCol = elt.nextSibling.nextSibling.nextSibling;
|
||||
|
||||
// Update status msg.
|
||||
var statusCol = timeRemainingCol.nextSibling;
|
||||
statusCol.setAttribute("label", status);
|
||||
|
||||
var speedCol = statusCol.nextSibling;
|
||||
speedCol.setAttribute("label", rateMsg);
|
||||
// Update percentage label on progress meter.
|
||||
if (this.doc.getElementById("ProgressPercent").getAttribute("hidden") != "true") {
|
||||
var progressText = elt.nextSibling.nextSibling;
|
||||
if (percent < 0)
|
||||
progressText.setAttribute("label", "");
|
||||
else {
|
||||
var percentMsg = getString( "percentMsg", this.doc );
|
||||
percentMsg = replaceInsert( percentMsg, 1, percent );
|
||||
progressText.setAttribute("label", percentMsg);
|
||||
}
|
||||
}
|
||||
// Update time remaining.
|
||||
if ( rate && (aMaxTotalProgress > 0) )
|
||||
{
|
||||
var rem = ( aMaxTotalProgress - aCurTotalProgress ) / rate;
|
||||
rem = parseInt( rem + .5 );
|
||||
timeRemainingCol.setAttribute("label", formatSeconds( rem, this.doc ));
|
||||
}
|
||||
else
|
||||
timeRemainingCol.setAttribute("label", getString( "unknownTime", this.doc ));
|
||||
},
|
||||
onLocationChange: function(aWebProgress, aRequest, aLocation, aDownload)
|
||||
{
|
||||
},
|
||||
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage, aDownload)
|
||||
{
|
||||
},
|
||||
onSecurityChange: function(aWebProgress, aRequest, state, aDownload)
|
||||
{
|
||||
},
|
||||
QueryInterface : function(iid)
|
||||
{
|
||||
if (iid.equals(Components.interfaces.nsIDownloadProgressListener) ||
|
||||
iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
var nsDownloadProgressListenerFactory = {
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
return (new nsDownloadProgressListener()).QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
|
||||
var nsDownloadProgressListenerModule = {
|
||||
|
||||
registerSelf: function (compMgr, fileSpec, location, type)
|
||||
{
|
||||
var compReg = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
compReg.registerFactoryLocation(Components.ID("{09cddbea-1dd2-11b2-aa15-c41ffea19d79}"),
|
||||
"Download Progress Listener",
|
||||
"@mozilla.org/download-manager/listener;1", fileSpec,
|
||||
location, type);
|
||||
},
|
||||
canUnload: function(compMgr)
|
||||
{
|
||||
return true;
|
||||
},
|
||||
|
||||
getClassObject: function (compMgr, cid, iid) {
|
||||
if (!cid.equals(Components.ID("{09cddbea-1dd2-11b2-aa15-c41ffea19d79}")))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
return nsDownloadProgressListenerFactory;
|
||||
}
|
||||
};
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return nsDownloadProgressListenerModule;
|
||||
}
|
||||
|
||||
function replaceInsert( text, index, value ) {
|
||||
var result = text;
|
||||
var regExp = new RegExp( "#"+index );
|
||||
result = result.replace( regExp, value );
|
||||
return result;
|
||||
}
|
||||
|
||||
function getString( stringId, doc ) {
|
||||
// Check if we've fetched this string already.
|
||||
if ( !gStrings[ stringId ] ) {
|
||||
// Try to get it.
|
||||
var elem = doc.getElementById( "strings."+stringId );
|
||||
try {
|
||||
if ( elem
|
||||
&&
|
||||
elem.childNodes
|
||||
&&
|
||||
elem.childNodes[0]
|
||||
&&
|
||||
elem.childNodes[0].nodeValue ) {
|
||||
gStrings[ stringId ] = elem.childNodes[0].nodeValue;
|
||||
} else {
|
||||
// If unable to fetch string, use an empty string.
|
||||
gStrings[ stringId ] = "";
|
||||
}
|
||||
} catch (e) { gStrings[ stringId ] = ""; }
|
||||
}
|
||||
return gStrings[ stringId ];
|
||||
}
|
||||
|
||||
function formatSeconds( secs, doc )
|
||||
{
|
||||
// Round the number of seconds to remove fractions.
|
||||
secs = parseInt( secs + .5 );
|
||||
var hours = parseInt( secs/3600 );
|
||||
secs -= hours*3600;
|
||||
var mins = parseInt( secs/60 );
|
||||
secs -= mins*60;
|
||||
var result;
|
||||
if ( hours )
|
||||
result = getString( "longTimeFormat", doc );
|
||||
else
|
||||
result = getString( "shortTimeFormat", doc );
|
||||
|
||||
if ( hours < 10 )
|
||||
hours = "0" + hours;
|
||||
if ( mins < 10 )
|
||||
mins = "0" + mins;
|
||||
if ( secs < 10 )
|
||||
secs = "0" + secs;
|
||||
|
||||
// Insert hours, minutes, and seconds into result string.
|
||||
result = replaceInsert( result, 1, hours );
|
||||
result = replaceInsert( result, 2, mins );
|
||||
result = replaceInsert( result, 3, secs );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blaker@netscape.com> (Original Author)
|
||||
*
|
||||
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef downloadproxy___h___
|
||||
#define downloadproxy___h___
|
||||
|
||||
#include "nsIDownload.h"
|
||||
#include "nsIDownloadManager.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
|
||||
#define USE_PROGRESS_DIALOGS_PREF "browser.download.useProgressDialogs"
|
||||
|
||||
class nsDownloadProxy : public nsIDownload,
|
||||
public nsIWebProgressListener
|
||||
{
|
||||
public:
|
||||
|
||||
nsDownloadProxy() { }
|
||||
virtual ~nsDownloadProxy() { };
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHODIMP Init(nsIURI* aSource,
|
||||
nsILocalFile* aTarget,
|
||||
const PRUnichar* aDisplayName,
|
||||
nsIMIMEInfo *aMIMEInfo,
|
||||
PRInt64 aStartTime,
|
||||
nsIWebBrowserPersist* aPersist) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDownloadManager> dm = do_GetService("@mozilla.org/download-manager;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = dm->AddDownload(aSource, aTarget, aDisplayName, aMIMEInfo, aStartTime, aPersist, getter_AddRefs(mInner));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
|
||||
|
||||
PRBool useProgressDialogs = PR_TRUE;
|
||||
branch->GetBoolPref(USE_PROGRESS_DIALOGS_PREF, &useProgressDialogs);
|
||||
if (useProgressDialogs) {
|
||||
nsAutoString path;
|
||||
rv = aTarget->GetPath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return dm->OpenProgressDialogFor(path.get(), nsnull);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP GetDisplayName(PRUnichar** aDisplayName)
|
||||
{
|
||||
return mInner->GetDisplayName(aDisplayName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SetDisplayName(const PRUnichar* aDisplayName)
|
||||
{
|
||||
return mInner->SetDisplayName(aDisplayName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetMIMEInfo(nsIMIMEInfo** aMIMEInfo)
|
||||
{
|
||||
return mInner->GetMIMEInfo(aMIMEInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetSource(nsIURI** aSource)
|
||||
{
|
||||
return mInner->GetSource(aSource);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetTarget(nsILocalFile** aTarget)
|
||||
{
|
||||
return mInner->GetTarget(aTarget);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetStartTime(PRInt64* aStartTime)
|
||||
{
|
||||
return mInner->GetStartTime(aStartTime);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetPercentComplete(PRInt32* aPercentComplete)
|
||||
{
|
||||
return mInner->GetPercentComplete(aPercentComplete);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetListener(nsIWebProgressListener** aListener)
|
||||
{
|
||||
return mInner->GetListener(aListener);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SetListener(nsIWebProgressListener* aListener)
|
||||
{
|
||||
return mInner->SetListener(aListener);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetObserver(nsIObserver** aObserver)
|
||||
{
|
||||
return mInner->GetObserver(aObserver);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP SetObserver(nsIObserver* aObserver)
|
||||
{
|
||||
return mInner->SetObserver(aObserver);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetPersist(nsIWebBrowserPersist** aPersist)
|
||||
{
|
||||
return mInner->GetPersist(aPersist);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest, PRUint32 aStateFlags,
|
||||
PRUint32 aStatus)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(mInner);
|
||||
if (listener)
|
||||
return listener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP OnStatusChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsresult aStatus,
|
||||
const PRUnichar *aMessage)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(mInner);
|
||||
if (listener)
|
||||
return listener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsIURI *aLocation)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(mInner);
|
||||
if (listener)
|
||||
return listener->OnLocationChange(aWebProgress, aRequest, aLocation);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(mInner);
|
||||
if (listener)
|
||||
return listener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress,
|
||||
aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRUint32 aState)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(mInner);
|
||||
if (listener)
|
||||
return listener->OnSecurityChange(aWebProgress, aRequest, aState);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDownload> mInner;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsDownloadProxy, nsIDownload, nsIWebProgressListener)
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче