Bug 1121678 Ability to open a bookmark into a new private window r=Ratty

CLOSED TREE
This commit is contained in:
Neil Rashbrook 2015-01-29 21:31:12 +00:00
Родитель 3f4b7f1788
Коммит c01bc5dc61
4 изменённых файлов: 37 добавлений и 12 удалений

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

@ -42,10 +42,12 @@
oncommandupdate="goUpdatePlacesCommands();">
<command id="placesCmd_open"
oncommand="goDoPlacesCommand('placesCmd_open');"/>
<command id="placesCmd_open:window"
oncommand="goDoPlacesCommand('placesCmd_open:window');"/>
<command id="placesCmd_open:tab"
oncommand="goDoPlacesCommand('placesCmd_open:tab');"/>
<command id="placesCmd_open:window"
oncommand="goDoPlacesCommand('placesCmd_open:window');"/>
<command id="placesCmd_open:privatewindow"
oncommand="goDoPlacesCommand('placesCmd_open:privatewindow');"/>
<command id="placesCmd_new:bookmark"
oncommand="goDoPlacesCommand('placesCmd_new:bookmark');"/>
@ -137,6 +139,13 @@
label="&cmd.open_window.label;"
accesskey="&cmd.open_window.accesskey;"
selectiontype="single"
selection="link"
hideifprivatebrowsing="true"/>
<menuitem id="placesContext_open:newprivatewindow"
command="placesCmd_open:privatewindow"
label="&cmd.open_private.label;"
accesskey="&cmd.open_private.accesskey;"
selectiontype="single"
selection="link"/>
<menuitem id="placesContext_openContainer:tabs"
oncommand="var view = PlacesUIUtils.getViewForNode(document.popupNode);

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

@ -163,8 +163,9 @@ PlacesController.prototype = {
}
return false;
case "placesCmd_open":
case "placesCmd_open:window":
case "placesCmd_open:tab":
case "placesCmd_open:window":
case "placesCmd_open:privatewindow":
var selectedNode = this._view.selectedNode;
return selectedNode && PlacesUtils.nodeIsURI(selectedNode);
case "placesCmd_new:folder":
@ -238,11 +239,14 @@ PlacesController.prototype = {
case "placesCmd_open":
PlacesUIUtils.openNodeIn(this._view.selectedNode, "current");
break;
case "placesCmd_open:tab":
PlacesUIUtils.openNodeIn(this._view.selectedNode, "tab");
break;
case "placesCmd_open:window":
PlacesUIUtils.openNodeIn(this._view.selectedNode, "window");
break;
case "placesCmd_open:tab":
PlacesUIUtils.openNodeIn(this._view.selectedNode, "tab");
case "placesCmd_open:privatewindow":
PlacesUIUtils.openNodeIn(this._view.selectedNode, "private");
break;
case "placesCmd_new:folder":
this.newItem("folder");
@ -559,9 +563,11 @@ PlacesController.prototype = {
* separated with the | character.
* 5) The "hideifnoinsertionpoint" attribute may be set on a menu-item to
* true if it should be hidden when there's no insertion point
* 6) The visibility state of a menu-item is unchanged if none of these
* 6) The "hideifprivatebrowsing" attribute may be set on a menu-item to
* true if it should be hidden in a private window
* 7) The visibility state of a menu-item is unchanged if none of these
* attribute are set.
* 7) These attributes should not be set on separators for which the
* 8) These attributes should not be set on separators for which the
* visibility state is "auto-detected."
* @param aPopup
* The menupopup to build children into.
@ -579,9 +585,10 @@ PlacesController.prototype = {
var item = aPopup.childNodes[i];
if (item.localName != "menuseparator") {
// We allow pasting into tag containers, so special case that.
var hideIfNoIP = item.getAttribute("hideifnoinsertionpoint") == "true" &&
var hideIfNoIP = item.hasAttribute("hideifnoinsertionpoint") &&
noIp && !(ip && ip.isTag && item.id == "placesContext_paste");
item.hidden = hideIfNoIP ||
var hideIfPrivate = item.hasAttribute("hideifprivatebrowsing") && top.gPrivate;
item.hidden = hideIfNoIP || hideIfPrivate ||
!this._shouldShowMenuItem(item, metadata);
if (!item.hidden) {
@ -1546,8 +1553,9 @@ function goUpdatePlacesCommands() {
}
updatePlacesCommand("placesCmd_open");
updatePlacesCommand("placesCmd_open:window");
updatePlacesCommand("placesCmd_open:tab");
updatePlacesCommand("placesCmd_open:window");
updatePlacesCommand("placesCmd_open:privatewindow");
updatePlacesCommand("placesCmd_new:folder");
updatePlacesCommand("placesCmd_new:bookmark");
updatePlacesCommand("placesCmd_new:livemark");

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

@ -1514,6 +1514,12 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
return null;
}
if (where == "private") {
window.openDialog(getBrowserURL(), "_blank", "private,chrome,all,dialog=no",
url, null, null, aPostData, aAllowThirdPartyFixup, aIsUTF8);
return null;
}
var w = getTopWin();
if (!w || where == "window") {

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

@ -48,10 +48,12 @@
<!ENTITY cmd.open.label "Open">
<!ENTITY cmd.open.accesskey "O">
<!ENTITY cmd.open_window.label "Open in a New Window">
<!ENTITY cmd.open_window.accesskey "N">
<!ENTITY cmd.open_tab.label "Open in a New Tab">
<!ENTITY cmd.open_tab.accesskey "w">
<!ENTITY cmd.open_window.label "Open in a New Window">
<!ENTITY cmd.open_window.accesskey "N">
<!ENTITY cmd.open_private.label "Open in a Private Window">
<!ENTITY cmd.open_private.accesskey "v">
<!ENTITY cmd.open_all_in_tabs.label "Open All in Tabs">
<!ENTITY cmd.open_all_in_tabs.accesskey "O">