Bug 1515701 show addons disabled doorhanger in private browsing, r=Gijs,flod

Differential Revision: https://phabricator.services.mozilla.com/D15445

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Shane Caraveo 2019-01-29 01:39:37 +00:00
Родитель 6631a3b4df
Коммит e8915eda78
7 изменённых файлов: 102 добавлений и 0 удалений

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

@ -1749,6 +1749,11 @@ var gBrowserInit = {
gBrowserThumbnails.init();
});
// Show the addons private browsing panel the first time a private window.
scheduleIdleTask(() => {
ExtensionsUI.showPrivateBrowsingNotification(window);
});
scheduleIdleTask(() => {
// Initialize the download manager some time after the app starts so that
// auto-resume downloads begin (such as after crashing or quitting with

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

@ -160,6 +160,24 @@
<description>&addonPostInstallMessage.label;</description>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="appMenu-addon-private-browsing-notification"
popupid="addon-private-browsing"
label="&addonPrivateBrowsing.header.label;"
closebuttonhidden="true"
secondarybuttonhidden="false"
buttonlabel="&addonPrivateBrowsing.manageButton.label;"
buttonaccesskey="&addonPrivateBrowsing.manageButton.accesskey;"
secondarybuttonlabel="&addonPrivateBrowsing.okButton.label;"
secondarybuttonaccesskey="&addonPrivateBrowsing.okButton.accesskey;"
dropmarkerhidden="true"
checkboxhidden="true"
buttonhighlight="true"
hidden="true">
<popupnotificationcontent class="addon-private-browsing-notification-content" orient="vertical">
<description>&addonPrivateBrowsing.body.label;</description>
</popupnotificationcontent>
</popupnotification>
</panel>
<menupopup id="customizationPaletteItemContextMenu"

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

@ -1125,3 +1125,10 @@ you can use these alternative items. Otherwise, their values should be empty. -
The first <image> tag is replaced with the icon for the add-ons menu.
The second <image> tag is replaced with the icon for the toolbar menu. -->
<!ENTITY addonPostInstallMessage.label "Manage your add-ons by clicking <image class='addon-addon-icon'/> in the <image class='addon-toolbar-icon'/> menu.">
<!ENTITY addonPrivateBrowsing.header.label "Extensions in Private Windows">
<!ENTITY addonPrivateBrowsing.body.label "Extensions are not allowed to run by default in Private Windows. They wont work while private browsing, and they wont have access to your online activities. You can allow each extension to run in Private Windows by managing your settings.">
<!ENTITY addonPrivateBrowsing.okButton.label "Okay, Got It">
<!ENTITY addonPrivateBrowsing.okButton.accesskey "O">
<!ENTITY addonPrivateBrowsing.manageButton.label "Manage Extensions">
<!ENTITY addonPrivateBrowsing.manageButton.accesskey "M">

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

@ -14,11 +14,16 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AMTelemetry: "resource://gre/modules/AddonManager.jsm",
AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.jsm",
ExtensionData: "resource://gre/modules/Extension.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
Services: "resource://gre/modules/Services.jsm",
});
XPCOMUtils.defineLazyPreferenceGetter(this, "WEBEXT_PERMISSION_PROMPTS",
"extensions.webextPermissionPrompts", false);
XPCOMUtils.defineLazyPreferenceGetter(this, "allowPrivateBrowsingByDefault",
"extensions.allowPrivateBrowsingByDefault", true);
XPCOMUtils.defineLazyPreferenceGetter(this, "privateNotificationShown",
"extensions.privatebrowsing.notification", false);
const DEFAULT_EXTENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
@ -432,6 +437,43 @@ var ExtensionsUI = {
AppMenuNotifications.showNotification("addon-installed", action, null, options);
});
},
promisePrivateBrowsingNotification(window) {
return new Promise(resolve => {
let action = {
callback: resolve,
dismiss: false,
};
let manage = {
callback: () => {
window.BrowserOpenAddonsMgr("addons://list/extension");
resolve();
},
dismiss: false,
};
let options = {
popupIconURL: "chrome://browser/skin/addons/addon-private-browsing.svg",
onDismissed: () => {
AppMenuNotifications.removeNotification("addon-private-browsing");
resolve();
},
};
AppMenuNotifications.showNotification("addon-private-browsing", manage, action, options);
});
},
showPrivateBrowsingNotification(window) {
// Show the addons private browsing panel the first time a private window
// is opened.
if (!allowPrivateBrowsingByDefault && !privateNotificationShown &&
PrivateBrowsingUtils.isWindowPrivate(window)) {
ExtensionsUI.promisePrivateBrowsingNotification(window).then(() => {
Services.prefs.setBoolPref("extensions.privatebrowsing.notification", true);
});
}
},
};
EventEmitter.decorate(ExtensionsUI);

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

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 52.5 (67469) - http://www.bohemiancoding.com/sketch -->
<title>Icon / Extensions</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M15.40625,8.5 C14.3745625,8.5 14.34375,9.5625 13.546875,9.5625 C13.1103334,9.55402108 12.7584789,9.2021666 12.75,8.765625 L12.75,5.3125 C12.75,4.72569745 12.2743025,4.25 11.6875,4.25 L8.234375,4.25 C7.7978334,4.24152108 7.44597892,3.8896666 7.4375,3.453125 C7.4375,2.65625 8.5,2.6254375 8.5,1.59375 C8.5,0.6746875 7.54375,0 6.375,0 C5.20625,0 4.25,0.6746875 4.25,1.59375 C4.25,2.6254375 5.3125,2.65625 5.3125,3.453125 C5.30402108,3.8896666 4.9521666,4.24152108 4.515625,4.25 L1.0625,4.25 C0.475697453,4.25 1.62102901e-16,4.72569745 9.02403152e-17,5.3125 L9.02403152e-17,7.703125 C0.00847891858,8.1396666 0.360333404,8.49152108 0.796875,8.5 C1.59375,8.5 1.6245625,7.4375 2.65625,7.4375 C3.5753125,7.4375 4.25,8.39375 4.25,9.5625 C4.25,10.73125 3.5753125,11.6875 2.65625,11.6875 C1.6245625,11.6875 1.59375,10.625 0.796875,10.625 C0.360333404,10.6334789 0.00847891858,10.9853334 0,11.421875 L0,15.9375 C4.41417049e-17,16.5243025 0.475697453,17 1.0625,17 L4.515625,17 C4.9521666,16.9915211 5.30402108,16.6396666 5.3125,16.203125 C5.3125,15.40625 4.25,15.3754375 4.25,14.34375 C4.25,13.4246875 5.20625,12.75 6.375,12.75 C7.54375,12.75 8.5,13.4246875 8.5,14.34375 C8.5,15.3754375 7.4375,15.40625 7.4375,16.203125 C7.44597892,16.6396666 7.7978334,16.9915211 8.234375,17 L11.6875,17 C12.2743025,17 12.75,16.5243025 12.75,15.9375 L12.75,12.484375 C12.7584789,12.0478334 13.1103334,11.6959789 13.546875,11.6875 C14.34375,11.6875 14.3745625,12.75 15.40625,12.75 C16.3253125,12.75 17,11.79375 17,10.625 C17,9.45625 16.3253125,8.5 15.40625,8.5 Z" id="path-1"/>
</defs>
<g id="Yep" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="4---doorhanger" transform="translate(-846.000000, -103.000000)">
<g id="Icon-/-Extensions" transform="translate(846.000000, 103.000000)">
<g id="private-browsing">
<circle id="Oval" fill="#8D20AE" cx="16" cy="16" r="16"/>
<g id="Icons-/-Extensions-16" transform="translate(8.533333, 6.400000)">
<rect id="bouding-box" x="0" y="0" width="17" height="17"/>
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"/>
</mask>
<g id="Shape" fill-rule="nonzero"/>
<g id="Color-/-Photon-/-Primary---Grey-90-80%" mask="url(#mask-2)" fill="#F9F9FA" fill-rule="evenodd">
<rect id="Rectangle" x="0" y="0" width="17" height="17"/>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

После

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

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

@ -22,6 +22,7 @@
skin/classic/browser/addons/addon-install-error.svg (../shared/addons/addon-install-error.svg)
skin/classic/browser/addons/addon-install-installed.svg (../shared/addons/addon-install-installed.svg)
skin/classic/browser/addons/addon-install-warning.svg (../shared/addons/addon-install-warning.svg)
skin/classic/browser/addons/addon-private-browsing.svg (../shared/addons/addon-private-browsing.svg)
skin/classic/browser/controlcenter/3rdpartycookies.svg (../shared/controlcenter/3rdpartycookies.svg)
skin/classic/browser/controlcenter/3rdpartycookies-disabled.svg (../shared/controlcenter/3rdpartycookies-disabled.svg)
skin/classic/browser/controlcenter/conn-not-secure.svg (../shared/controlcenter/conn-not-secure.svg)

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

@ -134,6 +134,7 @@ user_pref("extensions.update.background.url", "http://{server}/extensions-dummy/
user_pref("extensions.update.url", "http://{server}/extensions-dummy/updateURL");
// Make sure opening about:addons won't hit the network
user_pref("extensions.webservice.discoverURL", "http://{server}/extensions-dummy/discoveryURL");
user_pref("extensions.privatebrowsing.notification", true);
user_pref("findbar.highlightAll", false);
user_pref("findbar.modalHighlight", false);
// Existing tests assume there is no font size inflation.