Bug 911636 - Webapp Runtime migration to Downloads.jsm. r=myk, r=paolo

--HG--
rename : toolkit/mozapps/downloads/content/download.xml => webapprt/content/downloads/download.xml
rename : toolkit/mozapps/downloads/content/downloads.css => webapprt/content/downloads/downloads.css
rename : toolkit/mozapps/downloads/content/downloads.xul => webapprt/content/downloads/downloads.xul
rename : toolkit/locales/en-US/chrome/mozapps/downloads/downloads.dtd => webapprt/locales/en-US/webapprt/downloads/downloads.dtd
rename : toolkit/themes/linux/mozapps/downloads/downloadIcon.png => webapprt/themes/linux/downloads/downloadIcon.png
rename : toolkit/themes/linux/mozapps/downloads/downloads.css => webapprt/themes/linux/downloads/downloads.css
rename : toolkit/themes/osx/mozapps/downloads/buttons.png => webapprt/themes/osx/downloads/buttons.png
rename : toolkit/themes/osx/mozapps/downloads/downloadIcon.png => webapprt/themes/osx/downloads/downloadIcon.png
rename : toolkit/themes/osx/mozapps/downloads/downloads.css => webapprt/themes/osx/downloads/downloads.css
rename : toolkit/themes/windows/mozapps/downloads/downloadButtons-aero.png => webapprt/themes/windows/downloads/downloadButtons-aero.png
rename : toolkit/themes/windows/mozapps/downloads/downloadButtons.png => webapprt/themes/windows/downloads/downloadButtons.png
rename : toolkit/themes/windows/mozapps/downloads/downloadIcon-aero.png => webapprt/themes/windows/downloads/downloadIcon-aero.png
rename : toolkit/themes/windows/mozapps/downloads/downloadIcon.png => webapprt/themes/windows/downloads/downloadIcon.png
rename : toolkit/themes/windows/mozapps/downloads/downloads-aero.css => webapprt/themes/windows/downloads/downloads-aero.css
rename : toolkit/themes/windows/mozapps/downloads/downloads.css => webapprt/themes/windows/downloads/downloads.css
This commit is contained in:
Marco Castelluccio 2014-08-19 08:50:00 -04:00
parent a37c54985b
commit 29b6632367
40 changed files with 2615 additions and 41 deletions

View File

@ -1385,8 +1385,7 @@ const kTransferContractId = "@mozilla.org/transfer;1";
// Override Toolkit's nsITransfer implementation with the one from the
// JavaScript API for downloads. This will eventually be removed when
// nsIDownloadManager will not be available anymore (bug 851471). The
// old code in this module will be removed in bug 899110.
// nsIDownloadManager will not be available anymore (bug 851471).
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.registerFactory(kTransferCid, "",
kTransferContractId, null);

View File

@ -816,6 +816,7 @@ bin/libfreebl_32int64_3.so
@BINPATH@/webapprt/components/PaymentUIGlue.js
@BINPATH@/webapprt/components/components.manifest
@BINPATH@/webapprt/defaults/preferences/prefs.js
@BINPATH@/webapprt/modules/DownloadView.jsm
@BINPATH@/webapprt/modules/Startup.jsm
@BINPATH@/webapprt/modules/WebappRT.jsm
@BINPATH@/webapprt/modules/WebappManager.jsm

View File

@ -945,31 +945,13 @@ nsDownloadManager::Init()
// When MOZ_JSDOWNLOADS is undefined, we still check the preference that can
// be used to enable the JavaScript API during the migration process.
mUseJSTransfer = Preferences::GetBool(PREF_BD_USEJSTRANSFER, false);
#else
nsAutoCString appID;
nsCOMPtr<nsIXULAppInfo> info = do_GetService("@mozilla.org/xre/app-info;1");
if (info) {
rv = info->GetID(appID);
NS_ENSURE_SUCCESS(rv, rv);
}
// The webapp runtime doesn't use the new JS downloads API yet.
// The conversion of the webapp runtime to use the JavaScript API for
// downloads is tracked in bug 911636.
if (appID.EqualsLiteral("webapprt@mozilla.org")) {
mUseJSTransfer = false;
} else {
#if !defined(XP_WIN)
mUseJSTransfer = true;
#else
#elif defined(XP_WIN)
// When MOZ_JSDOWNLOADS is defined on Windows, this component is disabled
// unless we are running in Windows Metro. The conversion of Windows Metro
// to use the JavaScript API for downloads is tracked in bug 906042.
mUseJSTransfer = !IsRunningInWindowsMetro();
#endif
}
#else
mUseJSTransfer = true;
#endif
if (mUseJSTransfer)

35
webapprt/DownloadView.jsm Normal file
View File

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = ["DownloadView"];
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Downloads.jsm");
this.DownloadView = {
init: function() {
Downloads.getList(Downloads.ALL)
.then(list => list.addView(this))
.catch(Cu.reportError);
},
onDownloadAdded: function(aDownload) {
let dmWindow = Services.wm.getMostRecentWindow("Download:Manager");
if (dmWindow) {
dmWindow.focus();
} else {
Services.ww.openWindow(null,
"chrome://webapprt/content/downloads/downloads.xul",
"Download:Manager",
"chrome,dialog=no,resizable",
null);
}
},
};
DownloadView.init();

View File

@ -142,11 +142,19 @@ this.startup = function(window) {
// Wait for XUL window loading
yield deferredWindowLoad.promise;
// Override Toolkit's nsITransfer implementation with the one from the
// JavaScript API for downloads. This will eventually be removed when
// nsIDownloadManager will not be available anymore (bug 851471).
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.registerFactory(Components.ID("{1b4c85df-cbdd-4bb6-b04e-613caece083c}"),
"", "@mozilla.org/transfer;1", null);
// Load these modules here because they aren't needed right at startup,
// but they need to be loaded to perform some initialization steps.
Cu.import("resource://gre/modules/Payment.jsm");
Cu.import("resource://gre/modules/AlarmService.jsm");
Cu.import("resource://webapprt/modules/WebRTCHandler.jsm");
Cu.import("resource://webapprt/modules/DownloadView.jsm");
// Get the <browser> element in the webapp.xul window.
let appBrowser = window.document.getElementById("content");

View File

@ -0,0 +1,328 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE bindings [
<!ENTITY % downloadDTD SYSTEM "chrome://webapprt/locale/downloads/downloads.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">
<binding id="download-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<resources>
<stylesheet src="chrome://webapprt/skin/downloads/downloads.css"/>
</resources>
<implementation>
<property name="paused">
<getter>
<![CDATA[
return parseInt(this.getAttribute("state")) == Components.interfaces.nsIDownloadManager.DOWNLOAD_PAUSED;
]]>
</getter>
</property>
<property name="openable">
<getter>
<![CDATA[
return parseInt(this.getAttribute("state")) == Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED;
]]>
</getter>
</property>
<property name="inProgress">
<getter>
<![CDATA[
var state = parseInt(this.getAttribute("state"));
const dl = Components.interfaces.nsIDownloadManager;
return state == dl.DOWNLOAD_NOTSTARTED ||
state == dl.DOWNLOAD_QUEUED ||
state == dl.DOWNLOAD_DOWNLOADING ||
state == dl.DOWNLOAD_PAUSED ||
state == dl.DOWNLOAD_SCANNING;
]]>
</getter>
</property>
<property name="removable">
<getter>
<![CDATA[
var state = parseInt(this.getAttribute("state"));
const dl = Components.interfaces.nsIDownloadManager;
return state == dl.DOWNLOAD_FINISHED ||
state == dl.DOWNLOAD_CANCELED ||
state == dl.DOWNLOAD_BLOCKED_PARENTAL ||
state == dl.DOWNLOAD_BLOCKED_POLICY ||
state == dl.DOWNLOAD_DIRTY ||
state == dl.DOWNLOAD_FAILED;
]]>
</getter>
</property>
<property name="buttons">
<getter>
<![CDATA[
var startEl = document.getAnonymousNodes(this);
if (!startEl.length) {
startEl = [this];
}
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
return startEl[0].getElementsByTagNameNS(XULNS, "button");
]]>
</getter>
</property>
</implementation>
</binding>
<binding id="download-starting" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon" validate="always"
xbl:inherits="src=image"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" class="name"/>
<xul:progressmeter mode="normal" value="0" flex="1"
anonid="progressmeter"/>
<xul:label value="&starting.label;" class="status"/>
<xul:spacer flex="1"/>
</xul:vbox>
<xul:vbox pack="center">
<xul:button class="cancel mini-button" tooltiptext="&cmd.cancel.label;"
cmd="cmd_cancel" ondblclick="event.stopPropagation();"
oncommand="gDownloadList.performCommand('cmd_cancel', this);"/>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-downloading" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1" class="downloadContentBox">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon" validate="always"
xbl:inherits="src=image"/>
</xul:vbox>
<xul:vbox flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="2" class="name"/>
<xul:hbox>
<xul:vbox flex="1">
<xul:progressmeter mode="normal" value="0" flex="1"
anonid="progressmeter"
xbl:inherits="value=progress,mode=progressmode"/>
</xul:vbox>
<xul:button class="pause mini-button" tooltiptext="&cmd.pause.label;"
cmd="cmd_pause" ondblclick="event.stopPropagation();"
oncommand="gDownloadList.performCommand('cmd_pause', this);"/>
<xul:button class="cancel mini-button" tooltiptext="&cmd.cancel.label;"
cmd="cmd_cancel" ondblclick="event.stopPropagation();"
oncommand="gDownloadList.performCommand('cmd_cancel', this);"/>
</xul:hbox>
<xul:label xbl:inherits="value=status,tooltiptext=statusTip" flex="1"
crop="right" class="status"/>
<xul:spacer flex="1"/>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-paused" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon" validate="always"
xbl:inherits="src=image"/>
</xul:vbox>
<xul:vbox flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="2" class="name"/>
<xul:hbox>
<xul:vbox flex="1">
<xul:progressmeter mode="normal" value="0" flex="1"
anonid="progressmeter"
xbl:inherits="value=progress,mode=progressmode"/>
</xul:vbox>
<xul:button class="resume mini-button" tooltiptext="&cmd.resume.label;"
cmd="cmd_resume" ondblclick="event.stopPropagation();"
oncommand="gDownloadList.performCommand('cmd_resume', this);"/>
<xul:button class="cancel mini-button" tooltiptext="&cmd.cancel.label;"
cmd="cmd_cancel" ondblclick="event.stopPropagation();"
oncommand="gDownloadList.performCommand('cmd_cancel', this);"/>
</xul:hbox>
<xul:label xbl:inherits="value=status,tooltiptext=statusTip" flex="1"
crop="right" class="status"/>
<xul:spacer flex="1"/>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-done" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon" validate="always"
xbl:inherits="src=image"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="1" class="name"/>
<xul:label xbl:inherits="value=dateTime,tooltiptext=dateTimeTip"
class="dateTime"/>
</xul:hbox>
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=status,tooltiptext=statusTip"
crop="end" flex="1" class="status"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-canceled" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon" validate="always"
xbl:inherits="src=image"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="1" class="name"/>
<xul:label xbl:inherits="value=dateTime,tooltiptext=dateTimeTip"
class="dateTime"/>
</xul:hbox>
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=status,tooltiptext=statusTip"
crop="end" flex="1" class="status"/>
<xul:button class="retry mini-button" tooltiptext="&cmd.retry.label;"
cmd="cmd_retry" ondblclick="event.stopPropagation();"
oncommand="gDownloadList.performCommand('cmd_retry', this);"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-failed" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon" validate="always"
xbl:inherits="src=image"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="1" class="name"/>
<xul:label xbl:inherits="value=dateTime,tooltiptext=dateTimeTip"
class="dateTime"/>
</xul:hbox>
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=status,tooltiptext=statusTip"
crop="end" flex="1" class="status"/>
<xul:button class="retry mini-button" tooltiptext="&cmd.retry.label;"
cmd="cmd_retry" ondblclick="event.stopPropagation();"
oncommand="gDownloadList.performCommand('cmd_retry', this);"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-blocked-parental" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon blockedIcon"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="1" class="name"/>
<xul:label xbl:inherits="value=dateTime,tooltiptext=dateTimeTip"
class="dateTime"/>
</xul:hbox>
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=status,tooltiptext=statusTip"
crop="end" flex="1" class="status"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-blocked-policy" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon blockedIcon"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="1" class="name"/>
<xul:label xbl:inherits="value=dateTime,tooltiptext=dateTimeTip"
class="dateTime"/>
</xul:hbox>
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=status,tooltiptext=statusTip"
crop="end" flex="1" class="status"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-scanning" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon" validate="always"
xbl:inherits="src=image"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="2" class="name"/>
<xul:hbox>
<xul:vbox flex="1">
<xul:progressmeter mode="undetermined" flex="1" />
</xul:vbox>
</xul:hbox>
<xul:label value="&scanning.label;" class="status"/>
<xul:spacer flex="1"/>
</xul:vbox>
</xul:hbox>
</content>
</binding>
<binding id="download-dirty" extends="chrome://webapprt/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
<xul:vbox pack="center">
<xul:image class="downloadTypeIcon blockedIcon"/>
</xul:vbox>
<xul:vbox pack="start" flex="1">
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=target,tooltiptext=target"
crop="center" flex="1" class="name"/>
<xul:label xbl:inherits="value=dateTime,tooltiptext=dateTimeTip"
class="dateTime"/>
</xul:hbox>
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=status,tooltiptext=statusTip"
crop="end" flex="1" class="status"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
</binding>
</bindings>

View File

@ -0,0 +1,50 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
richlistitem[type="download"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-starting');
-moz-box-orient: vertical;
}
richlistitem[type="download"][state="0"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-downloading');
}
richlistitem[type="download"][state="1"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-done');
}
richlistitem[type="download"][state="2"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-failed');
}
richlistitem[type="download"][state="3"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-canceled');
}
richlistitem[type="download"][state="4"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-paused');
}
richlistitem[type="download"][state="6"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-blocked-parental');
}
richlistitem[type="download"][state="7"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-scanning');
}
richlistitem[type="download"][state="8"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-dirty');
}
richlistitem[type="download"][state="9"] {
-moz-binding: url('chrome://webapprt/content/downloads/download.xml#download-blocked-policy');
}
/* Only focus buttons in the selected item*/
richlistitem[type="download"]:not([selected="true"]) button {
-moz-user-focus: none;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifdef XP_UNIX
#ifndef XP_MACOSX
#define XP_GNOME 1
#endif
#endif
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://webapprt/content/downloads/downloads.css"?>
<?xml-stylesheet href="chrome://webapprt/skin/downloads/downloads.css"?>
<!DOCTYPE window [
<!ENTITY % downloadManagerDTD SYSTEM "chrome://webapprt/locale/downloads/downloads.dtd">
%downloadManagerDTD;
<!ENTITY % editMenuOverlayDTD SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
%editMenuOverlayDTD;
]>
<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="downloadManager" windowtype="Download:Manager"
orient="vertical" title="&downloads.title;" statictitle="&downloads.title;"
width="&window.width2;" height="&window.height;" screenX="10" screenY="10"
persist="width height screenX screenY sizemode"
onload="Startup();" onunload="Shutdown();"
onclose="return closeWindow(false);">
<script type="application/javascript" src="chrome://webapprt/content/downloads/downloads.js"/>
<script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<stringbundleset id="downloadSet">
<stringbundle id="brandStrings" src="chrome://branding/locale/brand.properties"/>
<stringbundle id="downloadStrings" src="chrome://mozapps/locale/downloads/downloads.properties"/>
</stringbundleset>
<!-- Use this commandset for command which do not depened on focus or selection -->
<commandset id="generalCommands">
<command id="cmd_findDownload" oncommand="gDownloadList.setSearchboxFocus();"/>
<command id="cmd_selectAllDownloads" oncommand="gDownloadList.selectAll();"/>
<command id="cmd_clearList" oncommand="gDownloadList.clearList();"/>
</commandset>
<keyset id="downloadKeys">
<key keycode="VK_RETURN" oncommand="gDownloadList.doDefaultForSelected();"/>
<key id="key_pauseResume" key=" " oncommand="gDownloadList.performCommand('cmd_pauseResume');"/>
<key id="key_removeFromList" keycode="VK_DELETE" oncommand="gDownloadList.performCommand('cmd_removeFromList');"/>
#ifdef XP_MACOSX
<key id="key_removeFromList2" keycode="VK_BACK" oncommand="gDownloadList.performCommand('cmd_removeFromList');"/>
#endif
<key id="key_close" key="&cmd.close.commandKey;" oncommand="closeWindow(true);" modifiers="accel"/>
#ifdef XP_GNOME
<key id="key_close2" key="&cmd.close2Unix.commandKey;" oncommand="closeWindow(true);" modifiers="accel,shift"/>
#else
<key id="key_close2" key="&cmd.close2.commandKey;" oncommand="closeWindow(true);" modifiers="accel"/>
#endif
<key keycode="VK_ESCAPE" oncommand="closeWindow(true);"/>
<key id="key_findDownload"
key="&cmd.find.commandKey;"
modifiers="accel"
command="cmd_findDownload"/>
<key id="key_findDownload2"
key="&cmd.search.commandKey;"
modifiers="accel"
command="cmd_findDownload"/>
<key id="key_selectAllDownloads"
key="&selectAllCmd.key;"
modifiers="accel"
command="cmd_selectAllDownloads"/>
<key id="pasteKey"
key="V"
modifiers="accel"
oncommand="gDownloadList.pasteHandler();"/>
</keyset>
<vbox id="contextMenuPalette" hidden="true">
<menuitem id="menuitem_pause"
label="&cmd.pause.label;" accesskey="&cmd.pause.accesskey;"
oncommand="gDownloadList.performCommand('cmd_pause');"
cmd="cmd_pause"/>
<menuitem id="menuitem_resume"
label="&cmd.resume.label;" accesskey="&cmd.resume.accesskey;"
oncommand="gDownloadList.performCommand('cmd_resume');"
cmd="cmd_resume"/>
<menuitem id="menuitem_cancel"
label="&cmd.cancel.label;" accesskey="&cmd.cancel.accesskey;"
oncommand="gDownloadList.performCommand('cmd_cancel');"
cmd="cmd_cancel"/>
<menuitem id="menuitem_open" default="true"
label="&cmd.open.label;" accesskey="&cmd.open.accesskey;"
oncommand="gDownloadList.performCommand('cmd_open');"
cmd="cmd_open"/>
<menuitem id="menuitem_show"
#ifdef XP_MACOSX
label="&cmd.showMac.label;"
accesskey="&cmd.showMac.accesskey;"
#else
label="&cmd.show.label;"
accesskey="&cmd.show.accesskey;"
#endif
oncommand="gDownloadList.performCommand('cmd_show');"
cmd="cmd_show"/>
<menuitem id="menuitem_retry" default="true"
label="&cmd.retry.label;" accesskey="&cmd.retry.accesskey;"
oncommand="gDownloadList.performCommand('cmd_retry');"
cmd="cmd_retry"/>
<menuitem id="menuitem_removeFromList"
label="&cmd.removeFromList.label;" accesskey="&cmd.removeFromList.accesskey;"
oncommand="gDownloadList.performCommand('cmd_removeFromList');"
cmd="cmd_removeFromList"/>
<menuseparator id="menuseparator"/>
<menuitem id="menuitem_openReferrer"
label="&cmd.goToDownloadPage.label;"
accesskey="&cmd.goToDownloadPage.accesskey;"
oncommand="gDownloadList.performCommand('cmd_openReferrer');"
cmd="cmd_openReferrer"/>
<menuitem id="menuitem_copyLocation"
label="&cmd.copyDownloadLink.label;"
accesskey="&cmd.copyDownloadLink.accesskey;"
oncommand="gDownloadList.performCommand('cmd_copyLocation');"
cmd="cmd_copyLocation"/>
<menuitem id="menuitem_selectAll"
label="&selectAllCmd.label;"
accesskey="&selectAllCmd.accesskey;"
command="cmd_selectAllDownloads"/>
</vbox>
<menupopup id="downloadContextMenu" onpopupshowing="return gDownloadList.buildContextMenu(event);"/>
<richlistbox id="downloadView" seltype="multiple" flex="1"
context="downloadContextMenu"
ondblclick="gDownloadList.onDownloadDblClick(event);"
ondragstart="gDownloadList.onDragStart(event);"
ondragover="gDownloadList.onDragOver(event);"
ondrop="gDownloadList.onDrop(event)">
</richlistbox>
<windowdragbox id="search" align="center">
<button id="clearListButton" command="cmd_clearList"
label="&cmd.clearList.label;"
accesskey="&cmd.clearList.accesskey;"
tooltiptext="&cmd.clearList.tooltip;"/>
<spacer flex="1"/>
<textbox type="search" id="searchbox" class="compact"
aria-controls="downloadView"
oncommand="gDownloadList.buildList();" placeholder="&searchBox.label;"/>
</windowdragbox>
</window>

View File

@ -12,3 +12,7 @@ webapprt.jar:
content/mochitest.js (content/mochitest.js)
content/mochitest.xul (content/mochitest.xul)
content/dbg-webapp-actors.js (content/dbg-webapp-actors.js)
* content/downloads/downloads.xul (content/downloads/downloads.xul)
content/downloads/downloads.js (content/downloads/downloads.js)
content/downloads/downloads.css (content/downloads/downloads.css)
content/downloads/download.xml (content/downloads/download.xml)

View File

@ -0,0 +1,52 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- LOCALIZATION NOTE (window.width2, window.height): These values should be
close to the golden ratio (1.618:1) while making sure it's wide enough for long
file names and tall enough to hint that there are more downloads in the list -->
<!ENTITY window.width2 "485">
<!ENTITY window.height "300">
<!ENTITY starting.label "Starting…">
<!ENTITY scanning.label "Scanning for viruses…">
<!ENTITY downloads.title "Downloads">
<!ENTITY cmd.pause.label "Pause">
<!ENTITY cmd.pause.accesskey "P">
<!ENTITY cmd.resume.label "Resume">
<!ENTITY cmd.resume.accesskey "R">
<!ENTITY cmd.cancel.label "Cancel">
<!ENTITY cmd.cancel.accesskey "C">
<!ENTITY cmd.show.label "Open Containing Folder">
<!ENTITY cmd.show.accesskey "F">
<!ENTITY cmd.showMac.label "Show in Finder">
<!ENTITY cmd.showMac.accesskey "F">
<!ENTITY cmd.open.label "Open">
<!ENTITY cmd.open.accesskey "O">
<!ENTITY cmd.openWith.label "Open With…">
<!ENTITY cmd.openWith.accesskey "h">
<!ENTITY cmd.retry.label "Retry">
<!ENTITY cmd.retry.accesskey "R">
<!ENTITY cmd.goToDownloadPage.label "Go to Download Page">
<!ENTITY cmd.goToDownloadPage.accesskey "G">
<!ENTITY cmd.copyDownloadLink.label "Copy Download Link">
<!ENTITY cmd.copyDownloadLink.accesskey "L">
<!ENTITY cmd.removeFromList.label "Remove From List">
<!ENTITY cmd.removeFromList.accesskey "e">
<!ENTITY cmd.close.commandKey "w">
<!ENTITY cmd.close2.commandKey "j">
<!ENTITY cmd.close2Unix.commandKey "y">
<!ENTITY cmd.clearList.label "Clear List">
<!ENTITY cmd.clearList.tooltip "Removes completed, canceled, and failed downloads from the list">
<!ENTITY cmd.clearList.accesskey "C">
<!ENTITY cmd.find.commandKey "f">
<!ENTITY cmd.search.commandKey "k">
<!ENTITY closeWhenDone.label "Close when downloads complete">
<!ENTITY closeWhenDone.tooltip "Closes the Downloads window when all files are done downloading">
<!ENTITY showFolder.label "Show this Folder">
<!ENTITY searchBox.label "Search…">

View File

@ -8,8 +8,10 @@
locale/webapprt/webapp.dtd (%webapprt/webapp.dtd)
locale/webapprt/webapp.properties (%webapprt/webapp.properties)
locale/webapprt/getUserMediaDialog.dtd (%webapprt/getUserMediaDialog.dtd)
locale/webapprt/appstrings.properties (%webapprt/overrides/appstrings.properties)
locale/webapprt/dom.properties (%webapprt/overrides/dom.properties)
locale/webapprt/appstrings.properties (%webapprt/overrides/appstrings.properties)
locale/webapprt/dom.properties (%webapprt/overrides/dom.properties)
locale/webapprt/downloads/downloads.dtd (%webapprt/downloads/downloads.dtd)
% locale branding @AB_CD@ resource://webappbranding/

View File

@ -11,7 +11,10 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
elif CONFIG['MOZ_ENABLE_GTK']:
DIRS += ['gtk']
DIRS += ['locales']
DIRS += [
'locales',
'themes',
]
EXTRA_COMPONENTS += [
'CommandLineHandler.js',
@ -22,6 +25,7 @@ EXTRA_COMPONENTS += [
]
EXTRA_JS_MODULES += [
'DownloadView.jsm',
'RemoteDebugger.jsm',
'Startup.jsm',
'WebappManager.jsm',
@ -29,7 +33,10 @@ EXTRA_JS_MODULES += [
'WebRTCHandler.jsm',
]
MOCHITEST_WEBAPPRT_CHROME_MANIFESTS += ['test/chrome/webapprt.ini']
MOCHITEST_WEBAPPRT_CHROME_MANIFESTS += [
'test/chrome/downloads/webapprt.ini',
'test/chrome/webapprt.ini',
]
MOCHITEST_MANIFESTS += ['test/content/mochitest.ini']
# Place webapprt resources in a separate app dir

View File

@ -1,4 +1,31 @@
Cu.import("resource://gre/modules/Services.jsm");
let { Downloads } = Cu.import("resource://gre/modules/Downloads.jsm", {});
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
function getFile(aFilename) {
// The download database may contain targets stored as file URLs or native
// paths. This can still be true for previously stored items, even if new
// items are stored using their file URL. See also bug 239948 comment 12.
if (aFilename.startsWith("file:")) {
// Assume the file URL we obtained from the downloads database or from the
// "spec" property of the target has the UTF-8 charset.
let fileUrl = NetUtil.newURI(aFilename).QueryInterface(Ci.nsIFileURL);
return fileUrl.file.clone();
}
// The downloads database contains a native path. Try to create a local
// file, though this may throw an exception if the path is invalid.
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(aFilename);
return file;
}
let fileDownloaded = false;
let download = new DummyDownload("download.test");
download.state = 1;
download.percentComplete = 100;
let winObserver = function(win, topic) {
if (topic == "domwindowopened") {
@ -9,11 +36,20 @@ let winObserver = function(win, topic) {
"chrome://mozapps/content/downloads/unknownContentType.xul") {
ok(true, "Download dialog shown");
setTimeout(() => {
executeSoon(() => {
let button = win.document.documentElement.getButton("accept");
button.disabled = false;
win.document.documentElement.acceptDialog();
}, 0);
});
} else if (win.document.documentURI ==
"chrome://webapprt/content/downloads/downloads.xul") {
ok(true, "Download manager window shown");
ok(fileDownloaded, "File downloaded");
waitDownloadListPopulation(win).then(() => {
test_downloadList(win, [download]);
finish();
});
}
}, false);
}
@ -23,36 +59,67 @@ Services.ww.registerNotification(winObserver);
let MockFilePicker = SpecialPowers.MockFilePicker;
MockFilePicker.init(window);
MockFilePicker.useAnyFile();
MockFilePicker.returnFiles = [download.file];
MockFilePicker.showCallback = function() {
ok(true, "File picker shown");
return MockFilePicker.returnOK;
}
let downloadListener = {
onDownloadStateChange: function(aState, aDownload) {
if (aDownload.state == Services.downloads.DOWNLOAD_FINISHED) {
ok(aDownload.targetFile.exists(), "Download completed");
is(aDownload.targetFile.fileSize, 154, "Downloaded file has correct size");
onDownloadAdded: function(aDownload) {
if (aDownload.succeeded) {
let downloadedFile = getFile(aDownload.target.path);
ok(downloadedFile.exists(), "Download completed");
is(downloadedFile.fileSize, 10, "Downloaded file has correct size");
fileDownloaded = true;
try {
downloadedFile.remove(true);
} catch (ex) {
}
}
},
finish();
onDownloadChanged: function(aDownload) {
if (aDownload.succeeded) {
let downloadedFile = getFile(aDownload.target.path);
ok(downloadedFile.exists(), "Download completed");
is(downloadedFile.fileSize, 10, "Downloaded file has correct size");
fileDownloaded = true;
try {
downloadedFile.remove(true);
} catch (ex) {
}
}
},
};
Services.downloads.addListener(downloadListener);
let downloadList;
registerCleanupFunction(function() {
Services.wm.getMostRecentWindow("Download:Manager").close();
Services.ww.unregisterNotification(winObserver);
MockFilePicker.cleanup();
Services.downloads.removeListener(downloadListener);
if (downloadList) {
return downloadList.removeView(downloadListener);
}
});
function test() {
waitForExplicitFinish();
loadWebapp("download.webapp", undefined, function onLoad() {
gAppBrowser.contentDocument.getElementById("download").click();
Task.spawn(function*() {
downloadList = yield Downloads.getList(Downloads.ALL);
yield downloadList.addView(downloadListener);
gAppBrowser.contentDocument.getElementById("download").click();
}).catch(function(e) {
ok(false, "Error during test: " + e);
SimpleTest.finish();
});
});
}

View File

@ -6,6 +6,6 @@
</head>
<body>
<h1>Download Test App</h1>
<a id="download" href="http://mochi.test:8888//webapprtChrome/webapprt/test/chrome/download.webapp">Download</a>
<a id="download" href="http://mochi.test:8888//webapprtChrome/webapprt/test/chrome/download.test">Download</a>
</body>
</html>

View File

@ -0,0 +1 @@
TEST FILE

View File

@ -0,0 +1,44 @@
Cu.import("resource://gre/modules/Services.jsm");
let list = MockDownloadsModule();
let downloadsInList = [
new DummyDownload("test1"),
new DummyDownload("test2"),
];
let winObserver = function(win, topic) {
if (topic == "domwindowopened") {
win.addEventListener("load", function onLoadWindow() {
win.removeEventListener("load", onLoadWindow, false);
if (win.document.documentURI ==
"chrome://webapprt/content/downloads/downloads.xul") {
ok(true, "Download manager window shown");
waitDownloadListPopulation(win).then(() => {
test_downloadList(win, downloadsInList);
finish();
});
}
}, false);
}
}
Services.ww.registerNotification(winObserver);
registerCleanupFunction(function() {
Services.ww.unregisterNotification(winObserver);
Services.wm.getMostRecentWindow("Download:Manager").close();
});
function test() {
waitForExplicitFinish();
loadWebapp("download.webapp", undefined, function onLoad() {
for each (let download in downloadsInList) {
list.addDownload(download);
}
});
}

View File

@ -0,0 +1,45 @@
Cu.import("resource://gre/modules/Services.jsm");
let list = MockDownloadsModule();
let download = new DummyDownload("test");
let removedDownload = new DummyDownload("removed");
let winObserver = function(win, topic) {
if (topic == "domwindowopened") {
win.addEventListener("load", function onLoadWindow() {
win.removeEventListener("load", onLoadWindow, false);
if (win.document.documentURI ==
"chrome://webapprt/content/downloads/downloads.xul") {
ok(true, "Download manager window shown");
waitDownloadListPopulation(win).then(() => {
test_downloadList(win, [download, removedDownload]);
list.removeDownload(removedDownload);
executeSoon(() => {
test_downloadList(win, [download]);
finish();
});
});
}
}, false);
}
}
Services.ww.registerNotification(winObserver);
registerCleanupFunction(function() {
Services.ww.unregisterNotification(winObserver);
Services.wm.getMostRecentWindow("Download:Manager").close();
});
function test() {
waitForExplicitFinish();
loadWebapp("download.webapp", undefined, function onLoad() {
list.addDownload(download);
list.addDownload(removedDownload);
});
}

View File

@ -0,0 +1,6 @@
[DEFAULT]
support-files =
../head.js
[browser_add_download.js]
[browser_remove_download.js]

View File

@ -40,7 +40,195 @@ function loadWebapp(manifest, parameters, onLoad) {
let { DOMApplicationRegistry } = Cu.import("resource://gre/modules/Webapps.jsm", {});
return new Promise(function(resolve, reject) {
DOMApplicationRegistry.uninstall(url.spec, resolve, reject);
DOMApplicationRegistry.uninstall(url.spec, () => {
// Load another page in the browser element, this is needed for tests
// that use the same app (that have the same URL).
gAppBrowser.setAttribute("src", "about:blank");
resolve();
}, reject);
});
});
}
// Utilities for the downloads tests
let MockDownloadList = function() {
};
MockDownloadList.prototype = {
downloads: new Set(),
views: new Set(),
addView: function(aView) {
this.views.add(aView);
for (let download of this.downloads) {
for (let view of this.views) {
view.onDownloadAdded(download);
}
}
},
removeView: function(aView) {
this.views.delete(aView);
},
addDownload: function(aDownload) {
this.downloads.add(aDownload);
for (let view of this.views) {
view.onDownloadAdded(aDownload);
}
},
changeDownload: function(aDownload) {
for (let view of this.views) {
if (view.onDownloadChanged) {
view.onDownloadChanged(aDownload);
}
}
},
removeDownload: function(aDownload) {
this.downloads.delete(aDownload);
for (let view of this.views) {
if (view.onDownloadRemoved) {
view.onDownloadRemoved(aDownload);
}
}
},
}
function MockDownloadsModule() {
let { DownloadView } = Cu.import("resource://webapprt/modules/DownloadView.jsm", {});
let list = new MockDownloadList();
let { Downloads } = Cu.import("resource://gre/modules/Downloads.jsm", {});
let oldDownloadsGetList = Downloads.getList;
Downloads.getList = function(aKind) {
return new Promise(function(resolve, reject) {
resolve(list);
});
};
registerCleanupFunction(function() {
list.removeView(DownloadView);
Downloads.getList = oldDownloadsGetList;
});
// Reinitialize DownloadView because it's already initialized
// when the webapprt test starts.
// We need to reinitialize it so that it gets associated to the
// MockDownloadList object that we've created.
DownloadView.init();
return list;
}
function DummyDownload(aFileName) {
this.file = Services.dirsvc.get("ProfD", Ci.nsIFile);
this.file.append(aFileName);
this.file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
this.startTime = Date.now();
this.source = {
url: "http://mochi.test:8888//webapprtChrome/webapprt/test/chrome/download.webapp",
isPrivate: false,
referrer: null,
};
this.target = {
path: this.file.path,
partFilePath: this.file.path + ".part",
}
};
DummyDownload.prototype = {
succeeded: false,
canceled: false,
stopped: false,
hasPartialData: false,
hasProgress: false,
progress: 0,
currentBytes: 0,
totalBytes: 0,
error: null,
// Attributes needed to test the download item in the richlistbox
state: 0,
percentComplete: -1,
};
function waitDownloadListPopulation(aWin) {
return new Promise(function(resolve, reject) {
let disconnected = false;
var observer = new MutationObserver(function(aMutations) {
for each (let mutation in aMutations) {
if (mutation.addedNodes) {
for each (let node in mutation.addedNodes) {
if (node.id == "downloadView") {
observer.disconnect();
disconnected = true;
// Wait for the resolution of the Downloads.getList promise.
executeSoon(() => {
resolve();
});
}
}
}
}
});
observer.observe(aWin.document, {
childList: true,
subtree: true,
attributes: false,
characterData: false
});
registerCleanupFunction(function() {
if (!disconnected) {
observer.disconnect();
}
});
});
}
function test_downloadList(aWin, aDownloadList) {
let richlistbox = aWin.document.getElementById("downloadView");
is(richlistbox.children.length, aDownloadList.length,
"There is the correct number of richlistitems");
for (let i = 0; i < richlistbox.children.length; i++) {
let elm = richlistbox.children[i];
let name = elm.getAttribute("target");
let download = null;
for (let d = 0; d < aDownloadList.length; d++) {
if (aDownloadList[d].file.leafName == name) {
download = aDownloadList[d];
aDownloadList.splice(d, 1);
}
}
if (!download) {
ok(false, "Download item unexpected");
} else {
ok(true, "Download item expected");
is(elm.getAttribute("state"), download.state, "Download state correct");
is(elm.getAttribute("progress"), download.percentComplete,
"Download progress correct");
}
}
is(aDownloadList.length, 0,
"All the downloads expected to be in the list were in the list");
}

View File

@ -45,7 +45,7 @@ support-files =
download.html
download.webapp
download.webapp^headers^
download.test
[browser_sample.js]
[browser_window-title.js]

2
webapprt/themes/LICENSE Normal file
View File

@ -0,0 +1,2 @@
All files in this directory are assumed to be licensed under the MPL 2 license
which is used throughout this codebase.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,112 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#downloadManager {
background-color: ThreeDFace;
}
/* Download View */
#downloadView {
-moz-appearance: none !important;
margin: 0;
border-bottom: 2px solid;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
}
/* Download View Items */
richlistitem[type="download"] {
padding: 4px 8px 4px 4px;
min-height: 46px;
}
richlistitem[type="download"]:not([selected="true"]):nth-child(odd) {
background-color: -moz-oddtreerow;
}
richlistitem[type="download"] .name {
font-size: larger;
}
richlistitem[type="download"] .dateTime {
font-size: smaller;
}
.mini-button {
-moz-appearance: none;
background-color: transparent;
border: none;
padding: 0;
margin: 0;
min-width: 0;
min-height: 0;
}
.mini-button > .button-box {
padding: 0 !important;
}
menuitem:not([type]) {
-moz-binding: url("chrome://global/content/bindings/menu.xml#menuitem-iconic");
}
.cancel,
#menuitem_cancel {
list-style-image: url("moz-icon://stock/gtk-cancel?size=menu");
}
#menuitem_open {
list-style-image: url("moz-icon://stock/gtk-open?size=menu");
}
#menuitem_open[disabled="true"] {
list-style-image: url("moz-icon://stock/gtk-open?size=menu&state=disabled");
}
.pause,
#menuitem_pause {
list-style-image: url("moz-icon://stock/gtk-media-pause?size=menu");
}
.pause[disabled="true"],
#menuitem_pause[disabled="true"] {
list-style-image: url("moz-icon://stock/gtk-media-pause?size=menu&state=disabled");
}
.resume,
#menuitem_resume {
list-style-image: url("moz-icon://stock/gtk-media-play?size=menu");
}
.retry,
#menuitem_retry {
list-style-image: url("moz-icon://stock/gtk-redo?size=menu");
}
#menuitem_removeFromList {
list-style-image: url("moz-icon://stock/gtk-remove?size=menu");
}
#menuitem_copyLocation {
list-style-image: url("moz-icon://stock/gtk-copy?size=menu");
}
.blockedIcon {
list-style-image: url("moz-icon://stock/gtk-dialog-error?size=dialog");
width: 32px;
height: 32px;
}
/* prevent flickering when changing states */
.downloadTypeIcon {
min-height: 32px;
min-width: 32px;
}
#clearListButton {
list-style-image: url(moz-icon://stock/gtk-clear?size=button);
margin-top: 3px;
}
#clearListButton[disabled="true"] {
list-style-image: url(moz-icon://stock/gtk-clear?size=button&state=disabled);
}

View File

@ -0,0 +1,7 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
webapprt.jar:
+ skin/classic/webapprt/downloads/downloadIcon.png (downloads/downloadIcon.png)
+ skin/classic/webapprt/downloads/downloads.css (downloads/downloads.css)

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']

22
webapprt/themes/moz.build Normal file
View File

@ -0,0 +1,22 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Theme Selection
#
# MacOS X osx (toolkit/themes/osx)
# Windows windows (toolkit/themes/windows)
# GNOME/Linux windows (toolkit/themes/windows) +
# linux overrides (toolkit/themes/linux)
toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
if toolkit == 'cocoa':
DIRS += ['osx']
else:
DIRS += ['windows']
if toolkit in ('gtk2', 'gtk3', 'qt'):
DIRS += ['linux']

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,121 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#downloadView {
-moz-appearance: none;
margin: 0;
padding: 0;
border-width: 0;
}
/* Download View Items */
richlistitem[type="download"] {
padding: 5px;
min-height: 44px !important;
border: 1px solid transparent;
}
richlistitem[type="download"]:not([selected="true"]):nth-child(odd) {
background-color: -moz-oddtreerow;
}
richlistitem[type="download"] .dateTime,
richlistitem[type="download"] .status {
font-size: smaller;
color: #555;
}
richlistitem[selected="true"][type="download"] {
outline: none;
}
richlistbox:focus > richlistitem[selected="true"][type="download"] .dateTime,
richlistbox:focus > richlistitem[selected="true"][type="download"] .status {
color: highlighttext;
}
richlistitem[type="download"] button {
-moz-appearance: none;
min-height: 16px;
min-width: 16px;
max-height: 16px;
max-width: 16px;
padding: 0;
margin: 0 1px 0 1px;
}
/**
* Images for buttons in the interface
*/
richlistitem[type="download"] button {
list-style-image: url(chrome://webapprt/skin/downloads/buttons.png);
}
.cancel {
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
.cancel:hover {
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
.cancel:hover:active {
-moz-image-region: rect(0px, 48px, 16px, 32px);
}
.pause {
-moz-image-region: rect(48px, 16px, 64px, 0px);
}
.pause:hover {
-moz-image-region: rect(48px, 32px, 64px, 16px);
}
.pause:not([disabled="true"]):hover:active {
-moz-image-region: rect(48px, 48px, 64px, 32px);
}
.pause[disabled="true"] {
-moz-image-region: rect(48px, 16px, 64px, 0px);
}
.resume {
-moz-image-region: rect(16px, 16px, 32px, 0px);
}
.resume:hover {
-moz-image-region: rect(16px, 32px, 32px, 16px);
}
.resume:hover:active {
-moz-image-region: rect(16px, 48px, 32px, 32px);
}
.retry {
-moz-image-region: rect(32px, 16px, 48px, 0px);
}
.retry:hover {
-moz-image-region: rect(32px, 32px, 48px, 16px);
}
.retry:hover:active {
-moz-image-region: rect(32px, 48px, 48px, 32px);
}
.blockedIcon {
list-style-image: url(chrome://global/skin/icons/Error.png);
}
/* prevent flickering when changing states */
.downloadTypeIcon {
height: 32px;
width: 32px;
-moz-padding-end: 2px;
}
#search {
-moz-box-pack: end;
-moz-padding-end: 4px;
-moz-appearance: statusbar;
}
#clearListButton {
-moz-appearance: toolbarbutton;
min-height: 18px;
min-width: 0;
margin: 0 6px;
text-shadow: 0 1px rgba(255, 255, 255, .4);
}

View File

@ -0,0 +1,9 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
webapprt.jar:
% skin webapprt classic/1.0 %skin/classic/webapprt/
skin/classic/webapprt/downloads/buttons.png (downloads/buttons.png)
skin/classic/webapprt/downloads/downloadIcon.png (downloads/downloadIcon.png)
skin/classic/webapprt/downloads/downloads.css (downloads/downloads.css)

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
%include downloads.css
@media (-moz-windows-compositor) {
#downloadManager {
-moz-appearance: -moz-win-glass;
background: transparent;
}
#downloadView {
/* Clamp glass bounds to the rich list so our glass haze stays constant. */
-moz-appearance: -moz-win-exclude-glass;
border: none;
}
windowdragbox {
-moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
}
#clearListButton {
-moz-margin-start: 0;
margin-bottom: 0;
}
#searchbox {
-moz-margin-end: 0;
margin-bottom: 0;
}
}

View File

@ -0,0 +1,112 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#downloadManager {
background-color: ThreeDFace;
}
/* Download View */
@media not all and (-moz-windows-classic) {
#downloadView {
-moz-appearance: none;
margin: 0;
border-bottom: 2px solid;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
}
}
/* Download View Items */
richlistitem[type="download"] {
padding: 4px 8px 4px 4px;
min-height: 46px;
border-bottom: 1px solid ThreeDLightShadow;
}
richlistitem[type="download"] .name {
font-size: larger;
}
richlistitem[type="download"] .dateTime {
font-size: smaller;
}
.mini-button {
-moz-appearance: none;
list-style-image: url(chrome://webapprt/skin/downloads/downloadButtons.png);
background-color: transparent;
border: none;
padding: 0;
margin: 0;
min-width: 0;
min-height: 0;
}
.mini-button > .button-box {
padding: 0 !important;
}
.cancel {
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
.cancel:hover {
-moz-image-region: rect(16px, 32px, 32px, 16px);
}
.cancel:active {
-moz-image-region: rect(32px, 32px, 48px, 16px);
}
.cancel[disabled="true"] {
-moz-image-region: rect(48px, 32px, 64px, 16px);
}
.pause {
-moz-image-region: rect(0px, 48px, 16px, 32px);
}
.pause:hover {
-moz-image-region: rect(16px, 48px, 32px, 32px);
}
.pause:active {
-moz-image-region: rect(32px, 48px, 48px, 32px);
}
.pause[disabled="true"] {
-moz-image-region: rect(48px, 48px, 64px, 32px);
}
.resume {
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
.resume:hover {
-moz-image-region: rect(16px, 16px, 32px, 0px);
}
.resume:active {
-moz-image-region: rect(32px, 16px, 48px, 0px);
}
.resume[disabled="true"] {
-moz-image-region: rect(48px, 16px, 64px, 0px);
}
.retry {
-moz-image-region: rect(0px, 64px, 16px, 48px);
}
.retry:hover {
-moz-image-region: rect(16px, 64px, 32px, 48px);
}
.retry:active {
-moz-image-region: rect(32px, 64px, 48px, 48px);
}
.retry[disabled="true"] {
-moz-image-region: rect(48px, 64px, 64px, 48px);
}
.blockedIcon {
list-style-image: url(chrome://global/skin/icons/Error.png);
}
/* prevent flickering when changing states */
.downloadTypeIcon {
min-height: 32px;
min-width: 32px;
}
#clearListButton {
min-height: 0;
min-width: 0;
margin-top: 3px;
}

View File

@ -0,0 +1,20 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
webapprt.jar:
% skin webapprt classic/1.0 %skin/classic/webapprt/ os=WINNT osversion<6
% skin webapprt classic/1.0 %skin/classic/webapprt/ os!=WINNT
# NOTE: If you add a new file here, you'll need to add it to the aero
# section at the bottom of this file
skin/classic/webapprt/downloads/downloadButtons.png (downloads/downloadButtons.png)
skin/classic/webapprt/downloads/downloadIcon.png (downloads/downloadIcon.png)
skin/classic/webapprt/downloads/downloads.css (downloads/downloads.css)
#ifdef XP_WIN
webapprt.jar:
% skin webapprt classic/1.0 %skin/classic/aero/webapprt/ os=WINNT osversion>=6
skin/classic/aero/webapprt/downloads/downloadButtons.png (downloads/downloadButtons-aero.png)
skin/classic/aero/webapprt/downloads/downloadIcon.png (downloads/downloadIcon-aero.png)
* skin/classic/aero/webapprt/downloads/downloads.css (downloads/downloads-aero.css)
#endif

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']