зеркало из https://github.com/mozilla/pjs.git
Bug 484074. Geolocation front end update. r=mfinkle
This commit is contained in:
Родитель
a4f7bdb393
Коммит
b38a322ec5
|
@ -263,9 +263,21 @@ pref("privacy.item.formdata", true);
|
|||
pref("privacy.item.downloads", true);
|
||||
pref("privacy.item.passwords", true);
|
||||
pref("privacy.item.sessions", true);
|
||||
pref("privacy.item.geolocation", true);
|
||||
pref("privacy.item.siteSettings", true);
|
||||
|
||||
|
||||
pref("plugins.enabled", true);
|
||||
|
||||
// URL to the Learn More link XXX this is the firefox one. Bug XXX fixes this.
|
||||
pref("browser.geolocation.warning.infoURL", "http://%LOCALE%.www.mozilla.com/%LOCALE%/firefox/geolocation/");
|
||||
|
||||
// base url for the wifi geolocation network provider
|
||||
pref("geo.wifi.uri", "https://www.google.com/loc/json");
|
||||
|
||||
// enable geo
|
||||
pref("geo.enabled", true);
|
||||
|
||||
#ifdef WINCE
|
||||
pref("layout.css.dpi", 96);
|
||||
#endif
|
||||
|
@ -279,3 +291,4 @@ pref("javascript.options.jit.chrome", true);
|
|||
|
||||
pref("dom.max_chrome_script_run_time", 30);
|
||||
pref("dom.max_script_run_time", 20);
|
||||
|
||||
|
|
|
@ -35,6 +35,10 @@ notification {
|
|||
-moz-binding: url("chrome://browser/content/notification.xml#notification");
|
||||
}
|
||||
|
||||
notification[type="geo"] {
|
||||
-moz-binding: url("chrome://browser/content/notification.xml#geo-notification");
|
||||
}
|
||||
|
||||
notification button {
|
||||
-moz-binding: url("chrome://browser/content/notification.xml#notification-button");
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE bindings PUBLIC "-//MOZILLA//DTD XBL V1.0//EN" "http://www.mozilla.org/xbl">
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % notificationDTD SYSTEM
|
||||
"chrome://browser/locale/notification.dtd">
|
||||
%notificationDTD;
|
||||
]>
|
||||
|
||||
<bindings
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
|
@ -32,6 +36,51 @@
|
|||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="geo-notification" extends="chrome://global/content/bindings/notification.xml#notification">
|
||||
|
||||
<resources>
|
||||
<stylesheet src="chrome://browser/skin/notification.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:vbox class="notification-inner outset" flex="1" xbl:inherits="type">
|
||||
<xul:hbox anonid="details">
|
||||
<xul:image anonid="messageImage" class="messageImage" xbl:inherits="src=image"/>
|
||||
<xul:description anonid="messageText" class="messageText" flex="1" xbl:inherits="xbl:text=label"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:label anonid="learnMore"
|
||||
class="text-link"
|
||||
value="&geolocation.learnMore;"
|
||||
onclick="Browser.addTab(this.href, true); return false;"/>
|
||||
</xul:hbox>
|
||||
|
||||
<xul:hbox pack="center"
|
||||
oncommand="document.getBindingParent(this)._doButtonCommand(event);">
|
||||
<children/>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
|
||||
var href = formatter.formatURLPref("browser.geolocation.warning.infoURL");
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "learnMore").href = href;
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<field name="_checkbox">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "rememberChoice")
|
||||
</field>
|
||||
|
||||
<property name="rememberChoice"
|
||||
onget="return this._checkbox.checked;"
|
||||
readonly="true"/>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="notification-button"
|
||||
extends="chrome://global/content/bindings/button.xml#button-base">
|
||||
<resources>
|
||||
|
|
|
@ -122,7 +122,57 @@ Sanitizer.prototype = {
|
|||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
geolocation: {
|
||||
clear: function ()
|
||||
{
|
||||
// clear any network geolocation provider sessions
|
||||
var psvc = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
try {
|
||||
var branch = psvc.getBranch("geo.wifi.access_token.");
|
||||
branch.deleteBranch("");
|
||||
|
||||
branch = psvc.getBranch("geo.request.remember.");
|
||||
branch.deleteBranch("");
|
||||
} catch (e) {dump(e);}
|
||||
},
|
||||
|
||||
get canClear()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
siteSettings: {
|
||||
clear: function ()
|
||||
{
|
||||
// Clear site-specific permissions like "Allow this site to open popups"
|
||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
pm.removeAll();
|
||||
|
||||
// Clear site-specific settings like page-zoom level
|
||||
var cps = Components.classes["@mozilla.org/content-pref/service;1"]
|
||||
.getService(Components.interfaces.nsIContentPrefService);
|
||||
cps.removeGroupedPrefs();
|
||||
|
||||
// Clear "Never remember passwords for this site", which is not handled by
|
||||
// the permission manager
|
||||
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
|
||||
.getService(Components.interfaces.nsILoginManager);
|
||||
var hosts = pwmgr.getAllDisabledHosts({})
|
||||
for each (var host in hosts) {
|
||||
pwmgr.setLoginSavingEnabled(host, true);
|
||||
}
|
||||
},
|
||||
|
||||
get canClear()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
offlineApps: {
|
||||
clear: function ()
|
||||
{
|
||||
|
|
|
@ -156,6 +156,9 @@
|
|||
<preference id="privacy.item.cache" name="privacy.item.cache" type="bool" readonly="true"/>
|
||||
<preference id="privacy.item.offlineApps" name="privacy.item.offlineApps" type="bool"/>
|
||||
<preference id="privacy.item.sessions" name="privacy.item.sessions" type="bool" readonly="true"/>
|
||||
<preference id="privacy.item.geolocation" name="privacy.item.geolocation" type="bool" readonly="true"/>
|
||||
<preference id="privacy.item.siteSettings" name="privacy.item.siteSettings" type="bool" readonly="true"/>
|
||||
|
||||
</preferences>
|
||||
|
||||
<description>&sanitizeItems.label;</description>
|
||||
|
@ -196,6 +199,13 @@
|
|||
accesskey="&itemSessions.accesskey;"
|
||||
preference="privacy.item.sessions"
|
||||
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
||||
|
||||
<checkbox label="&itemGeolocation.label;"
|
||||
accesskey="&itemGeolocation.accesskey;"
|
||||
preference="privacy.item.geolocation"
|
||||
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
||||
<checkbox label="&itemSiteSettings.label;"
|
||||
accesskey="&itemSiteSettings.accesskey;"
|
||||
preference="privacy.item.siteSettings"
|
||||
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
|
|
|
@ -5,6 +5,8 @@ const Cu = Components.utils;
|
|||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const kCountBeforeWeRemember = 5;
|
||||
|
||||
function GeolocationPrompt() {}
|
||||
|
||||
GeolocationPrompt.prototype = {
|
||||
|
@ -15,6 +17,38 @@ GeolocationPrompt.prototype = {
|
|||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationPrompt]),
|
||||
|
||||
prompt: function(request) {
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
|
||||
var result = pm.testExactPermission(request.requestingURI, "geo");
|
||||
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
request.allow();
|
||||
return;
|
||||
}
|
||||
if (result == Ci.nsIPermissionManager.DENY_ACTION) {
|
||||
request.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
function setPagePermission(uri, allow) {
|
||||
var prefService = Cc["@mozilla.org/content-pref/service;1"].getService(Ci.nsIContentPrefService);
|
||||
|
||||
if (! prefService.hasPref(request.requestingURI, "geo.request.remember"))
|
||||
prefService.setPref(request.requestingURI, "geo.request.remember", 0);
|
||||
|
||||
var count = prefService.getPref(request.requestingURI, "geo.request.remember");
|
||||
|
||||
if (allow == false)
|
||||
count--;
|
||||
else
|
||||
count++;
|
||||
|
||||
prefService.setPref(request.requestingURI, "geo.request.remember", count);
|
||||
|
||||
if (count == kCountBeforeWeRemember)
|
||||
pm.add(uri, "geo", Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
else if (count == -kCountBeforeWeRemember)
|
||||
pm.add(uri, "geo", Ci.nsIPermissionManager.DENY_ACTION);
|
||||
}
|
||||
|
||||
function getChromeWindow(aWindow) {
|
||||
var chromeWin = aWindow
|
||||
|
@ -39,23 +73,32 @@ GeolocationPrompt.prototype = {
|
|||
var browserBundle = bundleService.createBundle("chrome://browser/locale/browser.properties");
|
||||
|
||||
var buttons = [{
|
||||
label: browserBundle.GetStringFromName("geolocation.exactLocation"),
|
||||
accessKey: browserBundle.GetStringFromName("geolocation.exactLocationKey"),
|
||||
callback: function() request.allow()
|
||||
label: browserBundle.GetStringFromName("geolocation.share"),
|
||||
accessKey: browserBundle.GetStringFromName("geolocation.share.accessKey"),
|
||||
callback: function(notification) {
|
||||
setPagePermission(request.requestingURI, true);
|
||||
request.allow();
|
||||
},
|
||||
{
|
||||
label: browserBundle.GetStringFromName("geolocation.nothingLocation"),
|
||||
accessKey: browserBundle.GetStringFromName("geolocation.nothingLocationKey"),
|
||||
callback: function() request.cancel()
|
||||
}];
|
||||
},
|
||||
{
|
||||
label: browserBundle.GetStringFromName("geolocation.dontShare"),
|
||||
accessKey: browserBundle.GetStringFromName("geolocation.dontShare.accessKey"),
|
||||
callback: function(notification) {
|
||||
setPagePermission(request.requestingURI, false);
|
||||
request.cancel();
|
||||
},
|
||||
}];
|
||||
|
||||
var message = browserBundle.formatStringFromName("geolocation.requestMessage",
|
||||
[request.requestingURI.spec], 1);
|
||||
notificationBox.appendNotification(message,
|
||||
"geolocation",
|
||||
"chrome://browser/skin/Info.png",
|
||||
notificationBox.PRIORITY_INFO_HIGH,
|
||||
buttons);
|
||||
var message = browserBundle.formatStringFromName("geolocation.siteWantsToKnow",
|
||||
[request.requestingURI.host], 1);
|
||||
|
||||
var newBar = notificationBox.appendNotification(message,
|
||||
"geolocation",
|
||||
"chrome://browser/skin/images/geo-16.png",
|
||||
notificationBox.PRIORITY_WARNING_MEDIUM,
|
||||
buttons);
|
||||
// Make this a geolocation notification.
|
||||
newBar.setAttribute("type", "geo");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -61,17 +61,8 @@ identity.unknown.tooltip=This web site does not supply identity information.
|
|||
identity.ownerUnknown2=(unknown)
|
||||
|
||||
# Geolocation UI
|
||||
# LOCALIZATION NOTE (exactLocation, neighborhoodLocation): These do not have to be
|
||||
# exact value, instead approximations would be fine.
|
||||
# examples: Neighborhood (within 2 km)
|
||||
# Exact Location (within 3 m)
|
||||
#
|
||||
geolocation.exactLocation=Exact location
|
||||
geolocation.exactLocation.subLabel=within 10 feet
|
||||
geolocation.exactLocationKey=E
|
||||
geolocation.neighborhoodLocation=Neighborhood
|
||||
geolocation.neighborhoodLocation.subLabel=within 1 mile
|
||||
geolocation.neighborhoodLocationKey=N
|
||||
geolocation.nothingLocation=Nothing
|
||||
geolocation.nothingLocationKey=C
|
||||
geolocation.requestMessage=%S wants to know where you are. Tell them:
|
||||
geolocation.share=Share
|
||||
geolocation.share.accessKey=a
|
||||
geolocation.dontShare=Don't share
|
||||
geolocation.dontShare.accessKey=o
|
||||
geolocation.siteWantsToKnow=%S wants your location.
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
locale/@AB_CD@/browser/region.properties (%chrome/region.properties)
|
||||
locale/@AB_CD@/browser/preferences.dtd (%chrome/preferences.dtd)
|
||||
locale/@AB_CD@/browser/checkbox.dtd (%chrome/checkbox.dtd)
|
||||
locale/@AB_CD@/browser/notification.dtd (%chrome/notification.dtd)
|
||||
# Fennec-specific overrides of generic strings
|
||||
* locale/@AB_CD@/browser/netError.dtd (%chrome/overrides/netError.dtd)
|
||||
% override chrome://global/locale/netErrorApp.dtd chrome://browser/locale/netError.dtd
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 960 B |
|
@ -59,3 +59,4 @@ classic.jar:
|
|||
images/tab-close.png (images/tab-close.png)
|
||||
images/tag-default-30.png (images/tag-default-30.png)
|
||||
images/star-default-30.png (images/star-default-30.png)
|
||||
images/geo-16.png (images/geo-16.png)
|
||||
|
|
|
@ -3,18 +3,6 @@ notification {
|
|||
color: black;
|
||||
}
|
||||
|
||||
notification button {
|
||||
-moz-appearance: none !important;
|
||||
background: none !important;
|
||||
border: 1px solid rgb(192, 192, 160) !important;
|
||||
-moz-border-radius: 6px !important;
|
||||
-moz-border-top-colors: rgb(192, 192, 160) !important;
|
||||
-moz-border-right-colors: rgb(192, 192, 160) !important;
|
||||
-moz-border-bottom-colors: rgb(192, 192, 160) !important;
|
||||
-moz-border-left-colors: rgb(192, 192, 160) !important;
|
||||
margin: 12px 0 12px 6px;
|
||||
}
|
||||
|
||||
.sn-button-text {
|
||||
background: transparent !important;
|
||||
color: black !important;
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 960 B |
|
@ -36,3 +36,4 @@ classic.jar:
|
|||
images/reload-16.png (images/reload-16.png)
|
||||
images/go-16.png (images/go-16.png)
|
||||
images/newtab-24.png (images/newtab-24.png)
|
||||
images/geo-16.png (images/geo-16.png)
|
||||
|
|
|
@ -1,20 +1,3 @@
|
|||
notification {
|
||||
background: rgb(255, 255, 176);
|
||||
color: black;
|
||||
}
|
||||
|
||||
notification button {
|
||||
-moz-appearance: none !important;
|
||||
background: none !important;
|
||||
border: 1px solid rgb(192, 192, 160) !important;
|
||||
-moz-border-radius: 6px !important;
|
||||
-moz-border-top-colors: rgb(192, 192, 160) !important;
|
||||
-moz-border-right-colors: rgb(192, 192, 160) !important;
|
||||
-moz-border-bottom-colors: rgb(192, 192, 160) !important;
|
||||
-moz-border-left-colors: rgb(192, 192, 160) !important;
|
||||
margin: 12px 0 12px 6px;
|
||||
}
|
||||
|
||||
.sn-button-text {
|
||||
background: transparent !important;
|
||||
color: black !important;
|
||||
|
|
Загрузка…
Ссылка в новой задаче