mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 444642 - Hookup geolocation prompt to notification prompt. r=gavin/mconnor
This commit is contained in:
parent
3af8616720
commit
1e7d4167ba
@ -910,6 +910,61 @@ function prepareForStartup() {
|
|||||||
gBrowser.addEventListener("DOMLinkAdded", DOMLinkHandler, false);
|
gBrowser.addEventListener("DOMLinkAdded", DOMLinkHandler, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupGeolocationPrompt()
|
||||||
|
{
|
||||||
|
var geolocationService = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationService);
|
||||||
|
|
||||||
|
if (geolocationService.prompt)
|
||||||
|
return;
|
||||||
|
|
||||||
|
geolocationService.prompt = function(request) {
|
||||||
|
|
||||||
|
function getChromeWindow(aWindow) {
|
||||||
|
var chromeWin = aWindow
|
||||||
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
|
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||||
|
.rootTreeItem
|
||||||
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIDOMWindow)
|
||||||
|
.QueryInterface(Ci.nsIDOMChromeWindow);
|
||||||
|
return chromeWin;
|
||||||
|
}
|
||||||
|
|
||||||
|
var requestingWindow = request.requestingWindow.top;
|
||||||
|
var tabbrowser = getChromeWindow(requestingWindow).wrappedJSObject.gBrowser;
|
||||||
|
var browser = tabbrowser.getBrowserForDocument(requestingWindow.document);
|
||||||
|
var notificationBox = tabbrowser.getNotificationBox(browser);
|
||||||
|
|
||||||
|
var notification = notificationBox.getNotificationWithValue("geolocation");
|
||||||
|
if (!notification) {
|
||||||
|
|
||||||
|
var buttons = [{
|
||||||
|
label: gNavigatorBundle.getString("geolocation.exactLocation"),
|
||||||
|
accessKey: gNavigatorBundle.getString("geolocation.exactLocationKey"),
|
||||||
|
callback: function() request.allow() ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: gNavigatorBundle.getString("geolocation.neighborhoodLocation"),
|
||||||
|
accessKey: gNavigatorBundle.getString("geolocation.neighborhoodLocationKey"),
|
||||||
|
callback: function() request.allowButFuzz() ,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: gNavigatorBundle.getString("geolocation.nothingLocation"),
|
||||||
|
accessKey: gNavigatorBundle.getString("geolocation.nothingLocationKey"),
|
||||||
|
callback: function() request.cancel() ,
|
||||||
|
}];
|
||||||
|
|
||||||
|
var message = gNavigatorBundle.getFormattedString("geolocation.requestMessage", [request.requestingURI.spec]);
|
||||||
|
notificationBox.appendNotification(message,
|
||||||
|
"geolocation",
|
||||||
|
"chrome://browser/skin/Info.png",
|
||||||
|
notificationBox.PRIORITY_INFO_HIGH,
|
||||||
|
buttons);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
||||||
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||||
os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
|
os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
|
||||||
@ -1105,6 +1160,10 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
|||||||
placesContext.addEventListener("popupshowing", updateEditUIVisibility, false);
|
placesContext.addEventListener("popupshowing", updateEditUIVisibility, false);
|
||||||
placesContext.addEventListener("popuphiding", updateEditUIVisibility, false);
|
placesContext.addEventListener("popuphiding", updateEditUIVisibility, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// hook up the geolocation prompt to our notificationBox
|
||||||
|
setupGeolocationPrompt();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function BrowserShutdown()
|
function BrowserShutdown()
|
||||||
|
@ -135,3 +135,12 @@ editBookmarkPanel.pageBookmarkedTitle=Page Bookmarked
|
|||||||
editBookmarkPanel.pageBookmarkedDescription=%S will always remember this page for you.
|
editBookmarkPanel.pageBookmarkedDescription=%S will always remember this page for you.
|
||||||
editBookmarkPanel.bookmarkedRemovedTitle=Bookmark Removed
|
editBookmarkPanel.bookmarkedRemovedTitle=Bookmark Removed
|
||||||
editBookmarkPanel.editBookmarkTitle=Edit This Bookmark
|
editBookmarkPanel.editBookmarkTitle=Edit This Bookmark
|
||||||
|
|
||||||
|
# Geolocation UI
|
||||||
|
geolocation.exactLocation=Exact Location (within 10 feet)
|
||||||
|
geolocation.exactLocationKey=E
|
||||||
|
geolocation.neighborhoodLocation=Neighborhood (within 1 mile)
|
||||||
|
geolocation.neighborhoodLocationKey=N
|
||||||
|
geolocation.nothingLocation=Nothing
|
||||||
|
geolocation.nothingLocationKey=o
|
||||||
|
geolocation.requestMessage=%S wants to know where you are. Tell them:
|
||||||
|
Loading…
Reference in New Issue
Block a user