Bug 512843: add partially-complete custom about:fennec page, r=mfinkle

--HG--
rename : mobile/components/aboutFirstrun.js => mobile/components/AboutRedirector.js
This commit is contained in:
Gavin Sharp 2009-09-03 14:04:50 -04:00
Родитель 5bd3826ac7
Коммит 323ac8874e
10 изменённых файлов: 215 добавлений и 18 удалений

Просмотреть файл

@ -342,3 +342,7 @@ pref("browser.ui.kinetic.decelerationRate", 15);
// Disable default plugin
pref("plugin.default_plugin_disabled", true);
// product URLs
pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/%APP%/%VERSION%/releasenotes/");
pref("app.support.baseURL", "http://support.mozilla.com/1/%APP%/%VERSION%/%OS%/%LOCALE%/");

Просмотреть файл

@ -42,7 +42,11 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DEFINES += -DAB_CD=$(MOZ_UI_LOCALE) -DPACKAGE=browser
DEFINES += -DAB_CD=$(MOZ_UI_LOCALE) \
-DPACKAGE=browser \
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
$(NULL)
ifdef ENABLE_TESTS
DIRS += tests

Просмотреть файл

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD;
<!ENTITY % aboutDTD SYSTEM "chrome://global/locale/about.dtd" >
%aboutDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % fennecDTD SYSTEM "chrome://browser/locale/about.dtd">
%fennecDTD;
]>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1998-1999
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Henrik Gemal <mozilla@gemal.dk>
- Daniel Veditz <dveditz@netscape.com>
- Alexey Chernyak <alexeyc@bigfoot.com>
- Steffen Wilberg <steffen.wilberg@web.de>
- Gavin Sharp <gavin@gavinsharp.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the GPL or the LGPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&aboutPage.title;</title>
<link rel="stylesheet" href="chrome://global/skin/about.css" type="text/css"/>
<style>
/* XXX clean up styling */
#aboutLogoContainer {
float: left;
}
#aboutDetails {
}
#aboutLinks {
clear: both;
}
#aboutLinks > a {
display: block;
margin: 5px;
border: 1px solid black;
-moz-border-radius: 5px;
padding: 5px;
}
</style>
</head>
<body dir="&locale.dir;">
<div id="aboutLogoContainer">
<img src="about:logo" alt="&brandShortName;"/>
#expand <p id="version">&about.version; __MOZ_APP_VERSION__</p>
</div>
<div id="aboutLinks">
<a id="faqURL">&aboutPage.faq.label;</a>
<a id="supportURL">&aboutPage.support.label;</a>
<a id="privacyURL">&aboutPage.privacyPolicy.label;</a>
<a href="about:rights">&aboutPage.rights.label;</a>
<a id="releaseNotesURL">&aboutPage.relNotes.label;</a>
<!-- XXX wrong credits - these should point to the fennec specific ones, wherever those end up -->
<a href="about:credits">&aboutPage.credits.label;</a>
</div>
<div id="aboutDetails">
<p id="copyright">&aboutPage.copyrightInfo1;<a href="about:license">&aboutPage.licenseLink;</a>&aboutPage.copyrightInfo2; &logoCopyright;</p>
<p id="aboutUA"/>
</div>
<script type="application/javascript">
// get release notes URL from prefs
try {
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Components.interfaces.nsIURLFormatter);
var releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL");
var relnotes = document.getElementById("releaseNotesURL");
relnotes.setAttribute("href", releaseNotesURL);
var supportURL = formatter.formatURLPref("app.support.baseURL");
var support = document.getElementById("supportURL");
support.setAttribute("href", supportURL);
//faqURL - ???
//privacyURL - hardcoded to http://www.mozilla.com/legal/privacy/ ?
//fennec-specific web credits?
}
catch (ex) { alert(ex); /* no release notes and vendor URL for you without bug 349985 being fixed */ }
var ua = navigator.userAgent;
if (ua) {
var uaP = document.getElementById("aboutUA");
uaP.appendChild(document.createTextNode(ua));
}
</script>
</body>
</html>

Просмотреть файл

@ -362,7 +362,7 @@
<richlistbox id="prefs-list" seltype="single" flex="1">
<richpref title="&about.title;" type="button">
&about.description;
<button id="prefs-about-button" label="&about.button;" oncommand="Browser.addTab('about:', true);"/>
<button id="prefs-about-button" label="&about.button;" oncommand="Browser.addTab('about:fennec', true);"/>
</richpref>
<vbox class="prefsection" id="prefs-content">
<label value="&content.title;" crop="end" flex="1"/>

Просмотреть файл

@ -2,6 +2,7 @@
chrome.jar:
% content browser %content/
* content/about.xhtml (content/about.xhtml)
* content/browser.xul (content/browser.xul)
* content/browser.js (content/browser.js)
content/browser-ui.js (content/browser-ui.js)

Просмотреть файл

@ -40,35 +40,77 @@ const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
function AboutFirstRun() {}
AboutFirstRun.prototype = {
classDescription: "About FirstRun",
contractID: "@mozilla.org/network/protocol/about;1?what=firstrun",
classID: Components.ID("{077ea23e-0f22-4168-a744-8e444b560197}"),
let modules = {
fennec: {
uri: "chrome://browser/content/about.xhtml",
privileged: true
},
firstrun: {
uri: "chrome://firstrun/content/firstrun.html",
privileged: false
},
rights: {
uri: "chrome://global/content/aboutRights.xhtml",
privileged: false
}
}
function AboutGeneric() {}
AboutGeneric.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
_getModuleInfo: function (aURI) {
let moduleName = aURI.path.replace(/[?#].*/, "").toLowerCase();
return modules[moduleName];
},
// nsIAboutModule
getURIFlags: function(aURI) {
return (Ci.nsIAboutModule.ALLOW_SCRIPT |
Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT);
return Ci.nsIAboutModule.ALLOW_SCRIPT;
},
newChannel: function(aURI) {
let moduleInfo = this._getModuleInfo(aURI);
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
getService(Ci.nsIScriptSecurityManager);
var channel = ios.newChannel("chrome://firstrun/content/firstrun.html",
null, null);
var principal = secMan.getCodebasePrincipal(aURI);
var channel = ios.newChannel(moduleInfo.uri, null, null);
if (!moduleInfo.privileged) {
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
getService(Ci.nsIScriptSecurityManager);
let principal = secMan.getCodebasePrincipal(aURI);
channel.owner = principal;
}
channel.originalURI = aURI;
channel.owner = principal;
return channel;
}
};
function AboutFirstrun() {}
AboutFirstrun.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Firstrun",
contractID: "@mozilla.org/network/protocol/about;1?what=firstrun",
classID: Components.ID("{077ea23e-0f22-4168-a744-8e444b560197}")
}
function AboutFennec() {}
AboutFennec.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Fennec",
contractID: "@mozilla.org/network/protocol/about;1?what=fennec",
classID: Components.ID("{842a6d11-b369-4610-ba66-c3b5217e82be}")
}
function AboutRights() {}
AboutRights.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Rights",
contractID: "@mozilla.org/network/protocol/about;1?what=rights",
classID: Components.ID("{3b988fbf-ec97-4e1c-a5e4-573d999edc9c}")
}
function NSGetModule(compMgr, fileSpec)
XPCOMUtils.generateModule([AboutFirstRun]);
XPCOMUtils.generateModule([AboutFirstrun, AboutFennec, AboutRights]);

Просмотреть файл

@ -50,7 +50,7 @@ XPIDL_MODULE = browsercompsbase
# $(NULL)
EXTRA_COMPONENTS = \
aboutFirstrun.js \
AboutRedirector.js \
geolocationPrompt.js \
alertsService.js \
xpiDialogService.js \

Просмотреть файл

@ -0,0 +1,14 @@
<!ENTITY aboutPage.title "About &brandShortName;">
<!ENTITY aboutPage.faq.label "FAQ">
<!ENTITY aboutPage.support.label "Support">
<!ENTITY aboutPage.privacyPolicy.label "Privacy Policy">
<!ENTITY aboutPage.rights.label "Know Your Rights">
<!ENTITY aboutPage.relNotes.label "Release Notes">
<!ENTITY aboutPage.credits.label "Credits">
<!-- LOCALIZATION NOTE:
These strings are concatenated in order. Unneeded strings may be left blank.
-->
<!ENTITY aboutPage.copyrightInfo1 "&#169;1998-2009 Contributors. All rights reserved. (">
<!ENTITY aboutPage.licenseLink "Licensing information">
<!ENTITY aboutPage.copyrightInfo2 ").">

Просмотреть файл

@ -1,2 +1,3 @@
<!ENTITY brandShortName "Fennec">
<!ENTITY brandFullName "Fennec">
<!ENTITY logoCopyright "">

Просмотреть файл

@ -2,6 +2,7 @@
@AB_CD@.jar:
% locale browser @AB_CD@ %locale/@AB_CD@/browser/
locale/@AB_CD@/browser/about.dtd (%chrome/about.dtd)
locale/@AB_CD@/browser/browser.dtd (%chrome/browser.dtd)
locale/@AB_CD@/browser/browser.properties (%chrome/browser.properties)
locale/@AB_CD@/browser/search.properties (%chrome/search.properties)