Bug 847626 - Add a "learn more" link to the Metro geolocation notification [r=ally]

This commit is contained in:
Matt Brubeck 2013-03-11 16:48:54 -07:00
parent 8d67ce29d1
commit d75a61cb2b
4 changed files with 33 additions and 10 deletions

View File

@ -39,17 +39,20 @@ ContentPermissionPrompt.prototype = {
return chromeWin;
},
getChromeWindowForRequest: function getChromeWindowForRequest(aRequest) {
if (aRequest.window)
return this.getChromeWindow(aRequest.window.top).wrappedJSObject :
return aRequest.element.ownerDocument.defaultView;
},
getNotificationBoxForRequest: function getNotificationBoxForRequest(request) {
let notificationBox = null;
let chromeWin = this.getChromeWindowForRequest(request);
if (request.window) {
let requestingWindow = request.window.top;
let chromeWin = this.getChromeWindow(requestingWindow).wrappedJSObject;
let windowID = request.window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
let browser = chromeWin.Browser.getBrowserForWindowId(windowID);
return chromeWin.getNotificationBox(browser);
}
let chromeWin = request.element.ownerDocument.defaultView;
return chromeWin.Browser.getNotificationBox(request.element);
},
@ -113,6 +116,20 @@ ContentPermissionPrompt.prototype = {
icon,
notificationBox.PRIORITY_WARNING_MEDIUM,
buttons);
if (request.type == "geolocation") {
// Add the "learn more" link.
let link = newBar.ownerDocument.createElement("label");
link.setAttribute("value", browserBundle.GetStringFromName("geolocation.learnMore"));
link.setAttribute("class", "text-link notification-link");
newBar.insertBefore(link, newBar.firstChild);
let win = this.getChromeWindowForRequest(request);
link.addEventListener("click", function() {
let url = Services.urlFormatter.formatURLPref("browser.geolocation.warning.infoURL");
win.BrowserUI.newTab(url, win.Browser.selectedTab);
});
}
}
};

View File

@ -50,6 +50,8 @@ contentPermissions.neverForSite=Never for this Site
geolocation2.allow=Share Location
geolocation2.wantsTo=Share your location with %S?
geolocation.learnMore=Learn more…
# Error Console
typeError=Error:
typeWarning=Warning:

View File

@ -644,11 +644,6 @@ flyoutpanel > settings:first-child {
background-position: right bottom;
}
#about-flyoutpanel label.text-link {
text-decoration: none;
color: #1167bd;
}
#about-product-label {
font-weight: bold;
}

View File

@ -16,6 +16,11 @@
font-size: @font_normal@;
}
.text-link {
text-decoration: none;
color: #1167bd;
}
textbox,
menulist {
-moz-appearance: none;
@ -44,7 +49,6 @@ menulist:not([disabled]):hover:active {
background: @field_foreground_color@;
}
/* Button ------------------------------------------------------------------ */
button {
@ -433,6 +437,11 @@ notification {
-moz-image-region: rect(0, 120px, 40px, 80px);
}
.notification-link {
/* Make the link take up all the space before the buttons. */
-moz-box-flex: 9999;
}
/* Rich Grid ---------------------------------------------------------------- */