Bug 595810 Part 4: implement geolocation doorhanger r=IanN

This commit is contained in:
Neil Rashbrook 2010-10-05 12:09:20 +01:00
Родитель b52917ea63
Коммит e605a9572f
18 изменённых файлов: 219 добавлений и 2 удалений

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

@ -106,6 +106,9 @@ pref("browser.download.saveLinkAsFilenameTimeout", 1000);
// Use the findbar instead of the dialog box
pref("browser.findbar.enabled", true);
// Use doorhanger notifications instead of the notification bar
pref("browser.doorhanger.enabled", true);
// search engines URL
pref("browser.search.searchEnginesURL", "https://addons.mozilla.org/%LOCALE%/%APP%/search-engines/");

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

@ -61,6 +61,17 @@ panel[for="urlbar"] {
overflow: hidden;
}
/* notification anchors should only be visible when their associated
notifications are */
.notification-anchor-icon {
display: none;
-moz-user-focus: normal;
}
#notification-popup-box[anchorid="geo-notification-icon"] > #geo-notification-icon {
display: -moz-box;
}
#toolbar-menubar[autohide="true"][inactive="true"]
{
min-height: 0px !important;

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

@ -612,6 +612,18 @@ function Startup()
// initialize the session-restore service
setTimeout(InitSessionStoreCallback, 0);
if (Services.prefs.getBoolPref("browser.doorhanger.enabled")) {
XPCOMUtils.defineLazyGetter(window, "PopupNotifications", function() {
var tmp = {};
Components.utils.import("resource://gre/modules/PopupNotifications.jsm", tmp);
return XULBrowserWindow.popupNotifications = new tmp.PopupNotifications(
getBrowser(),
document.getElementById("notification-popup"),
document.getElementById("notification-popup-box"));
});
getBrowser().setAttribute("popupnotification", "true");
}
}
function UpdateNavBar()

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

@ -164,6 +164,8 @@
<!-- Bookmarks and history tooltip -->
<tooltip id="bhTooltip"/>
<panel id="notification-popup" position="after_start" noautofocus="true" hidden="true"/>
<menupopup id="popupBlockerMenu"
oncommand="popupBlockerMenuCommand(event.target);"
onpopupshowing="return popupBlockerMenuShowing(event)"/>
@ -306,6 +308,9 @@
onfocus="URLBarFocusHandler(event);"
onmousedown="URLBarMouseDownHandler(event);"
onclick="URLBarClickHandler(event);">
<box id="notification-popup-box" hidden="true" align="center">
<image id="geo-notification-icon" class="notification-anchor-icon" role="button"/>
</box>
<deck id="page-proxy-deck"
class="urlbar-icons"
onclick="handlePageProxyClick(event);">

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

@ -51,6 +51,7 @@ nsBrowserStatusHandler.prototype =
jsDefaultStatus : "",
overLink : "",
feeds : [],
popupNotifications : null,
QueryInterface : function(aIID)
{
@ -351,6 +352,13 @@ nsBrowserStatusHandler.prototype =
SetPageProxyState("invalid", null);
}
// Only dismiss notifications if this onLocationChange represents an
// actual load (or an error page).
if (this.popupNotifications &&
(aWebProgress.isLoadingDocument ||
(aRequest && !Components.isSuccessCode(aRequest.status))))
this.popupNotifications.locationChange();
PlacesStarButton.updateState();
this.feedsMenu.setAttribute("disabled", "true");

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

@ -120,7 +120,7 @@
</xul:tabs>
</xul:hbox>
<xul:tabpanels flex="1" class="plain" selectedIndex="0" anonid="panelcontainer">
<xul:notificationbox class="browser-notificationbox">
<xul:notificationbox class="browser-notificationbox" xbl:inherits="popup=popupnotification">
<xul:browser flex="1" type="content-primary" xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup"/>
</xul:notificationbox>
</xul:tabpanels>
@ -1389,6 +1389,7 @@
var n = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"notificationbox");
n.setAttribute("class", "browser-notificationbox");
n.setAttribute("popup", this.getAttribute("popupnotification"));
n.appendChild(b);
this.mPanelContainer.appendChild(n);

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

@ -783,6 +783,68 @@
</handlers>
</binding>
<binding id="popup-notification"
extends="chrome://communicator/content/bindings/notification.xml#browser-notificationbox">
<implementation>
<method name="showGeolocationPrompt">
<parameter name="file"/>
<parameter name="site"/>
<parameter name="image"/>
<parameter name="allowCallback"/>
<parameter name="cancelCallback"/>
<body>
<![CDATA[
var type = "geolocation";
var mainAction = {
label: this._stringBundle.GetStringFromName(type + ".shareLocation"),
accessKey: this._stringBundle.GetStringFromName(type + ".shareLocation.accesskey"),
callback: function(aNotification) {
allowCallback(false);
}
};
var secondaryActions = [{
label: this._stringBundle.GetStringFromName(type + ".dontShareLocation"),
accessKey: this._stringBundle.GetStringFromName(type + ".dontShareLocation.accesskey"),
callback: function (aNotification) {
cancelCallback(false);
}
}, {
label: this._stringBundle.GetStringFromName(type + ".neverShareLocation"),
accessKey: this._stringBundle.GetStringFromName(type + ".neverShareLocation.accesskey"),
callback: function (aNotification) {
cancelCallback(true);
}
}, {
label: this._stringBundle.GetStringFromName(type + ".alwaysShareLocation"),
accessKey: this._stringBundle.GetStringFromName(type + ".alwaysShareLocation.accesskey"),
callback: function (aNotification) {
allowCallback(true);
}
}];
var message;
if (site) {
message = this._stringBundle
.formatStringFromName(type + ".siteWantsToKnow",
[site], 1);
} else {
message = this._stringBundle
.formatStringFromName(type + ".fileWantsToKnow",
[file], 1);
secondaryActions.length = 1;
}
PopupNotifications.show(this.activeBrowser,
"geolocation", message,
"geo-notification-icon", mainAction,
secondaryActions);
]]>
</body>
</method>
</implementation>
</binding>
<binding id="sidebar-notification"
extends="chrome://global/content/bindings/notification.xml#notification">
<content>

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

@ -51,6 +51,10 @@ toolbar[printpreview="true"] {
-moz-binding: url("chrome://communicator/content/bindings/notification.xml#browser-notificationbox");
}
.browser-notificationbox[popup="true"] {
-moz-binding: url("chrome://communicator/content/bindings/notification.xml#popup-notification");
}
/* ::::: toolbaritem ::::: */
toolbaritem {
-moz-binding: url("chrome://global/content/bindings/general.xml#basecontrol");

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

@ -23,12 +23,16 @@ xpinstallDisabledButton=Enable
xpinstallDisabledButton.accesskey=n
# Geolocation UI
# LOCALIZATION NOTE (geolocation.shareLocation geolocation.dontShareLocation):
# LOCALIZATION NOTE (geolocation.shareLocation geolocation.dontShareLocation geolocation.alwaysShare geolocation.neverShare):
#If you're having trouble with the word Share, please use Allow and Block in your language.
geolocation.shareLocation=Share Location
geolocation.shareLocation.accesskey=a
geolocation.dontShareLocation=Don't Share
geolocation.dontShareLocation.accesskey=o
geolocation.alwaysShareLocation=Always Share
geolocation.alwaysShareLocation.accesskey=A
geolocation.neverShareLocation=Never Share
geolocation.neverShareLocation.accesskey=N
geolocation.siteWantsToKnow=%S wants to know your location.
geolocation.fileWantsToKnow=The file %S wants to know your location.
# LOCALIZATION NOTE (geolocation.learnMore): Use the unicode ellipsis char, \u2026,

Двоичные данные
suite/themes/classic/communicator/icons/geolocation-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 704 B

Двоичные данные
suite/themes/classic/communicator/icons/geolocation-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.2 KiB

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

@ -37,6 +37,8 @@ classic.jar:
skin/classic/communicator/sidebar/sidebar.css (mac/communicator/sidebar/sidebar.css)
skin/classic/communicator/icons/communicatoricons.png (mac/communicator/icons/communicatoricons.png)
skin/classic/communicator/icons/communicatoricons-small.png (mac/communicator/icons/communicatoricons-small.png)
skin/classic/communicator/icons/geolocation-16.png (mac/communicator/icons/geolocation-16.png)
skin/classic/communicator/icons/geolocation-64.png (mac/communicator/icons/geolocation-64.png)
skin/classic/communicator/toolbar/toolbar-gradient22.png (mac/communicator/toolbar/toolbar-gradient22.png)
skin/classic/communicator/toolbar/toolbar-gradient34.png (mac/communicator/toolbar/toolbar-gradient34.png)
#else
@ -66,6 +68,8 @@ classic.jar:
skin/classic/communicator/sidebar/sidebar.css (communicator/sidebar/sidebar.css)
skin/classic/communicator/icons/communicatoricons.png (communicator/icons/communicatoricons.png)
skin/classic/communicator/icons/communicatoricons-small.png (communicator/icons/communicatoricons-small.png)
skin/classic/communicator/icons/geolocation-16.png (communicator/icons/geolocation-16.png)
skin/classic/communicator/icons/geolocation-64.png (communicator/icons/geolocation-64.png)
skin/classic/communicator/icons/loading.gif (communicator/icons/loading.gif)
#endif
skin/classic/communicator/brand.css (communicator/brand.css)

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

@ -293,6 +293,41 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-icon {
opacity: 0.75;
}
/* ::::: notification popups ::::: */
#notification-popup {
-moz-appearance: menupopup;
color: MenuText;
padding: 10px;
margin-top: 3px;
}
.popup-notification-icon {
width: 64px;
height: 64px;
-moz-margin-end: 10px;
}
.popup-notification-icon[popupid="geolocation"] {
list-style-image: url("chrome://communicator/skin/icons/geolocation-64.png");
}
/* Notification icon box */
#notification-popup-box {
margin: 0 3px;
}
.notification-anchor-icon:-moz-focusring {
-moz-box-shadow: 0 0 3px 1px -moz-mac-focusring inset,
0 0 3px 2px -moz-mac-focusring;
}
#geo-notification-icon {
list-style-image: url("chrome://communicator/skin/icons/geolocation-16.png");
width: 16px;
height: 16px;
}
/* ::::: page proxy icon ::::: */
#page-proxy-deck,

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

@ -322,6 +322,40 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-icon {
display: none;
}
/* ::::: notification popups ::::: */
#notification-popup {
-moz-appearance: menupopup;
color: MenuText;
padding: 10px;
margin-top: 3px;
}
.popup-notification-icon {
width: 64px;
height: 64px;
-moz-margin-end: 10px;
}
.popup-notification-icon[popupid="geolocation"] {
list-style-image: url("chrome://communicator/skin/icons/geolocation-64.png");
}
/* Notification icon box */
#notification-popup-box {
margin: 0 3px;
}
.notification-anchor-icon:-moz-focusring {
outline: 1px dotted -moz-DialogText;
}
#geo-notification-icon {
list-style-image: url("chrome://communicator/skin/icons/geolocation-16.png");
width: 16px;
height: 16px;
}
/* ::::: page proxy icon ::::: */
#page-proxy-deck,

Двоичные данные
suite/themes/modern/communicator/icons/geolocation-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 606 B

Двоичные данные
suite/themes/modern/communicator/icons/geolocation-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.9 KiB

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

@ -70,6 +70,8 @@ modern.jar:
skin/modern/communicator/icons/feedIcon.png (communicator/icons/feedIcon.png)
skin/modern/communicator/icons/feedIcon16.png (communicator/icons/feedIcon16.png)
skin/modern/communicator/icons/geo.png (communicator/icons/geo.png)
skin/modern/communicator/icons/geolocation-16.png (communicator/icons/geolocation-16.png)
skin/modern/communicator/icons/geolocation-64.png (communicator/icons/geolocation-64.png)
skin/modern/communicator/icons/identity.png (communicator/icons/identity.png)
skin/modern/communicator/icons/loading.gif (communicator/icons/loading.gif)
skin/modern/communicator/icons/lock-broken.png (communicator/icons/lock-broken.png)

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

@ -508,6 +508,38 @@ toolbar[mode="icons"] #search-button > .button-box > .button-text {
background: #E8DB99;
}
/* ::::: notification popups ::::: */
#notification-popup {
padding: 10px;
margin-top: 3px;
}
.popup-notification-icon {
width: 64px;
height: 64px;
-moz-margin-end: 10px;
}
.popup-notification-icon[popupid="geolocation"] {
list-style-image: url("chrome://communicator/skin/icons/geolocation-64.png");
}
/* Notification icon box */
#notification-popup-box {
-moz-margin-end: 3px;
}
.notification-anchor-icon:-moz-focusring {
outline: 1px dotted;
}
#geo-notification-icon {
list-style-image: url("chrome://communicator/skin/icons/geolocation-16.png");
width: 16px;
height: 16px;
}
/* ::::: page proxy icon ::::: */
#page-proxy-deck,