Bug 1381401 - Add location, camera and microphone permissions along with their settings under the 'Permissions' heading in Firefox Preferences. r=johannh

MozReview-Commit-ID: PdcUyUKAcN

--HG--
extra : rebase_source : 316a207405b0263349f18c240392136b5357291f
This commit is contained in:
Prathiksha 2017-07-30 13:06:49 +05:30
Родитель 39ee5f1bc5
Коммит 45b152f637
10 изменённых файлов: 224 добавлений и 26 удалений

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

@ -14,6 +14,7 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/search.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/containers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/privacy.css"?>
<!DOCTYPE page [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">

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

@ -160,8 +160,14 @@ var gPrivacyPane = {
this.updateCacheSizeInputField();
this.updateActualCacheSize();
setEventListener("notificationsPolicyButton", "command",
setEventListener("notificationSettingsButton", "command",
gPrivacyPane.showNotificationExceptions);
setEventListener("locationSettingsButton", "command",
gPrivacyPane.showLocationExceptions);
setEventListener("cameraSettingsButton", "command",
gPrivacyPane.showCameraExceptions);
setEventListener("microphoneSettingsButton", "command",
gPrivacyPane.showMicrophoneExceptions);
setEventListener("popupPolicyButton", "command",
gPrivacyPane.showPopupExceptions);
setEventListener("notificationsDoNotDisturb", "command",
@ -221,7 +227,7 @@ var gPrivacyPane = {
let notificationInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";
document.getElementById("notificationsPolicyLearnMore").setAttribute("href",
document.getElementById("notificationPermissionsLearnMore").setAttribute("href",
notificationInfoURL);
let drmInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
@ -267,10 +273,22 @@ var gPrivacyPane = {
bundlePrefs.getString("popuppermissionstitle2"),
bundlePrefs.getString("popuppermissionstext"),
]);
appendSearchKeywords("notificationsPolicyButton", [
appendSearchKeywords("notificationSettingsButton", [
bundlePrefs.getString("notificationspermissionstitle2"),
bundlePrefs.getString("notificationspermissionstext5"),
]);
appendSearchKeywords("locationSettingsButton", [
bundlePrefs.getString("locationpermissionstitle"),
bundlePrefs.getString("locationpermissionstext"),
]);
appendSearchKeywords("cameraSettingsButton", [
bundlePrefs.getString("camerapermissionstitle"),
bundlePrefs.getString("camerapermissionstext"),
]);
appendSearchKeywords("microphoneSettingsButton", [
bundlePrefs.getString("microphonepermissionstitle"),
bundlePrefs.getString("microphonepermissionstext"),
]);
appendSearchKeywords("addonExceptions", [
bundlePrefs.getString("addons_permissions_title2"),
bundlePrefs.getString("addonspermissionstext"),
@ -798,6 +816,54 @@ var gPrivacyPane = {
AlertsServiceDND.manualDoNotDisturb = event.target.checked;
},
// GEOLOCATION
/**
* Displays the location exceptions dialog where specific site location
* preferences can be set.
*/
showLocationExceptions() {
let bundlePreferences = document.getElementById("bundlePreferences");
let params = { permissionType: "geo"};
params.windowTitle = bundlePreferences.getString("locationpermissionstitle");
params.introText = bundlePreferences.getString("locationpermissionstext");
gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
"resizable=yes", params);
},
// CAMERA
/**
* Displays the camera exceptions dialog where specific site camera
* preferences can be set.
*/
showCameraExceptions() {
let bundlePreferences = document.getElementById("bundlePreferences");
let params = { permissionType: "camera"};
params.windowTitle = bundlePreferences.getString("camerapermissionstitle");
params.introText = bundlePreferences.getString("camerapermissionstext");
gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
"resizable=yes", params);
},
// MICROPHONE
/**
* Displays the microphone exceptions dialog where specific site microphone
* preferences can be set.
*/
showMicrophoneExceptions() {
let bundlePreferences = document.getElementById("bundlePreferences");
let params = { permissionType: "microphone"};
params.windowTitle = bundlePreferences.getString("microphonepermissionstitle");
params.introText = bundlePreferences.getString("microphonepermissionstext");
gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
"resizable=yes", params);
},
// NOTIFICATIONS
/**

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

@ -540,17 +540,73 @@
<column/>
</columns>
<rows>
<row id="notificationsPolicyRow" align="center">
<row id="locationSettingsRow" align="center">
<description flex="1">
<label id="notificationsPolicy">&notificationsPolicyDesc4.label;</label>
<label id="notificationsPolicyLearnMore"
class="learnMore text-link">&notificationsPolicyLearnMore.label;</label>
<image class="geo-icon permission-icon" />
<separator orient="vertical" class="thin"/>
<label id="locationPermissionsLabel">&locationPermissions.label;</label>
</description>
<hbox pack="end">
<button id="notificationsPolicyButton"
<button id="locationSettingsButton"
class="accessory-button"
label="&notificationsPolicyButton.label;"
accesskey="&notificationsPolicyButton.accesskey;"
label="&permissionSettingsButton.label;"
accesskey="&locationSettingsButton.accesskey;"
searchkeywords="&removepermission2.label;
&removeallpermissions2.label;
&button.cancel.label;
&button.ok.label;"/>
</hbox>
</row>
<row id="cameraSettingsRow" align="center">
<description flex="1">
<image class="camera-icon permission-icon" />
<separator orient="vertical" class="thin"/>
<label id="cameraPermissionsLabel">&cameraPermissions.label;</label>
</description>
<hbox pack="end">
<button id="cameraSettingsButton"
class="accessory-button"
label="&permissionSettingsButton.label;"
accesskey="&cameraSettingsButton.accesskey;"
searchkeywords="&removepermission2.label;
&removeallpermissions2.label;
&button.cancel.label;
&button.ok.label;"/>
</hbox>
</row>
<row id="microphoneSettingsRow" align="center">
<description flex="1">
<image class="microphone-icon permission-icon" />
<separator orient="vertical" class="thin"/>
<label id="microphonePermissionsLabel">&microphonePermissions.label;</label>
</description>
<hbox pack="end">
<button id="microphoneSettingsButton"
class="accessory-button"
label="&permissionSettingsButton.label;"
accesskey="&microphoneSettingsButton.accesskey;"
searchkeywords="&removepermission2.label;
&removeallpermissions2.label;
&button.cancel.label;
&button.ok.label;"/>
</hbox>
</row>
<row id="notificationSettingsRow" align="center">
<description flex="1">
<image class="desktop-notification-icon permission-icon" />
<separator orient="vertical" class="thin"/>
<label id="notificationPermissionsLabel">&notificationPermissions.label;</label>
<label id="notificationPermissionsLearnMore"
class="learnMore text-link">&notificationPermissionsLearnMore.label;</label>
</description>
<hbox pack="end">
<button id="notificationSettingsButton"
class="accessory-button"
label="&permissionSettingsButton.label;"
accesskey="&notificationSettingsButton.accesskey;"
searchkeywords="&removepermission2.label;
&removeallpermissions2.label;
&button.cancel.label;
@ -559,6 +615,9 @@
</row>
</rows>
</grid>
<separator flex="1"/>
<vbox id="notificationsDoNotDisturbBox" hidden="true">
<checkbox id="notificationsDoNotDisturb" label="&notificationsDoNotDisturb.label;"
accesskey="&notificationsDoNotDisturb.accesskey;"/>

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

@ -27,7 +27,7 @@ async function openPermissionsDialog() {
await ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
let doc = content.document;
let settingsButton = doc.getElementById("notificationsPolicyButton");
let settingsButton = doc.getElementById("notificationSettingsButton");
settingsButton.click();
});

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

@ -45,12 +45,3 @@ add_task(async function() {
evaluateSearchResults("open pop-up windows", "permissionsGroup");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
/**
* Test for searching for the "Notification Permissions" subdialog.
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
evaluateSearchResults("send notifications", "permissionsGroup");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

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

@ -15,3 +15,39 @@ add_task(async function() {
evaluateSearchResults("updates have been installed", "updateApp");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
/**
* Test for searching for the "Location Permissions" subdialog.
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
evaluateSearchResults("set location permissions", "permissionsGroup");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
/**
* Test for searching for the "Camera Permissions" subdialog.
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
evaluateSearchResults("set camera permissions", "permissionsGroup");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
/**
* Test for searching for the "Microphone Permissions" subdialog.
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
evaluateSearchResults("set microphone permissions", "permissionsGroup");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
/**
* Test for searching for the "Notification Permissions" subdialog.
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
evaluateSearchResults("set notifications permissions", "permissionsGroup");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

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

@ -7,16 +7,27 @@
<!ENTITY blockPopups.label "Block pop-up windows">
<!ENTITY blockPopups.accesskey "B">
<!ENTITY notificationsPolicyLearnMore.label "Learn more">
<!ENTITY notificationsPolicyDesc4.label "Choose which websites are allowed to send you notifications">
<!ENTITY notificationsPolicyButton.accesskey "h">
<!ENTITY notificationsPolicyButton.label "Choose…">
<!ENTITY notificationsDoNotDisturb.label "Do not disturb me">
<!ENTITY notificationsDoNotDisturb.accesskey "n">
<!ENTITY notificationsDoNotDisturbDetails.value "No notification will be shown until you restart &brandShortName;">
<!ENTITY popupExceptions.label "Exceptions…">
<!ENTITY popupExceptions.accesskey "E">
<!ENTITY popupExceptions.label "Exceptions…">
<!ENTITY popupExceptions.accesskey "E">
<!ENTITY permissionSettingsButton.label "Settings">
<!ENTITY notificationPermissions.label "Notifications">
<!ENTITY notificationSettingsButton.accesskey "n">
<!ENTITY notificationPermissionsLearnMore.label "Learn more">
<!ENTITY locationPermissions.label "Location">
<!ENTITY locationSettingsButton.accesskey "l">
<!ENTITY cameraPermissions.label "Camera">
<!ENTITY cameraSettingsButton.accesskey "c">
<!ENTITY microphonePermissions.label "Microphone">
<!ENTITY microphoneSettingsButton.accesskey "m">
<!ENTITY fontsAndColors.label "Fonts &amp; Colors">

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

@ -29,6 +29,12 @@ popuppermissionstext=You can specify which websites are allowed to open pop-up w
popuppermissionstitle2=Allowed Websites - Pop-ups
notificationspermissionstext5=The following websites have requested to send you notifications. You can specify which websites are allowed to send you notifications.
notificationspermissionstitle2=Settings - Notification Permissions
locationpermissionstext=The following websites have requested to access your location. You can specify which websites are allowed to access your location.
locationpermissionstitle=Settings - Location Permissions
camerapermissionstext=The following websites have requested to access your camera. You can specify which websites are allowed to access your camera.
camerapermissionstitle=Settings - Camera Permissions
microphonepermissionstext=The following websites have requested to access your microphone. You can specify which websites are allowed to access your microphone.
microphonepermissionstitle=Settings - Microphone Permissions
invalidURI=Please enter a valid hostname
invalidURITitle=Invalid Hostname Entered
savedLoginsExceptions_title=Exceptions - Saved Logins

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

@ -0,0 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.permission-icon {
max-height: 20px;
max-width: 20px;
vertical-align: middle;
-moz-context-properties: fill;
fill: currentColor;
}
.geo-icon {
list-style-image: url(chrome://browser/skin/notification-icons.svg#geo-linux);
}
.camera-icon {
list-style-image: url(chrome://browser/skin/notification-icons.svg#camera);
}
.microphone-icon {
list-style-image: url(chrome://browser/skin/notification-icons.svg#microphone);
}
.desktop-notification-icon {
list-style-image: url(chrome://browser/skin/notification-icons.svg#desktop-notification);
}

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

@ -85,6 +85,7 @@
skin/classic/browser/preferences/in-content-new/search.css (../shared/incontentprefs/search.css)
skin/classic/browser/preferences/in-content-new/search.svg (../shared/incontentprefs/search.svg)
skin/classic/browser/preferences/in-content-new/siteDataSettings.css (../shared/incontentprefs/siteDataSettings.css)
skin/classic/browser/preferences/in-content-new/privacy.css (../shared/incontentprefs/privacy.css)
skin/classic/browser/preferences/in-content-new/sync.svg (../shared/incontentprefs/sync.svg)
* skin/classic/browser/preferences/in-content-new/containers.css (../shared/incontentprefs/containers.css)
skin/classic/browser/preferences/in-content/icons.svg (../shared/incontentprefs-old/icons.svg)