use preference for browser chrome url (aka navigator.xul). bug 31867

This commit is contained in:
danm%netscape.com 2000-04-26 02:25:28 +00:00
Родитель da1fe4fe1c
Коммит 45273d5ee3
13 изменённых файлов: 84 добавлений и 27 удалений

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

@ -1116,9 +1116,8 @@ function EditorPreview()
// CheckAndSave doesn't tell us if the user said "Don't Save",
// so make sure we have a url:
if (fileurl != "" && fileurl != "about:blank")
{
window.openDialog("chrome://navigator/content/navigator.xul",
if (fileurl != "" && fileurl != "about:blank") {
window.openDialog(getBrowserURL(),
"EditorPreview",
"chrome,all,dialog=no",
fileurl );

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

@ -433,7 +433,7 @@ function ViewPageSource(messages)
url += "?header=src";
// Use a browser window to view source
window.openDialog( "chrome://navigator/content/navigator.xul",
window.openDialog( getBrowserURL(),
"_blank",
"chrome,menubar,status,dialog=no,resizable",
url,

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

@ -47,6 +47,7 @@
#include "nsIWindowMediator.h"
#include "nsIScreenManager.h"
#include "nsIScreen.h"
#include "nsIPref.h"
// XXX Get rid of this
#pragma message("WARNING: XXX bad include, remove it.")
@ -58,6 +59,7 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
//*****************************************************************************
@ -1117,13 +1119,29 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(PRInt32 aChromeFlags,
nsEventQueueStack queuePusher;
NS_ENSURE_SUCCESS(queuePusher.Success(), NS_ERROR_FAILURE);
char * urlStr = "chrome://navigator/content/navigator.xul";
nsCOMPtr<nsIIOService> service(do_GetService(kIOServiceCID));
NS_ENSURE_TRUE(service, NS_ERROR_FAILURE);
nsCOMPtr<nsIURI> uri;
service->NewURI(urlStr, nsnull, getter_AddRefs(uri));
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
if (prefs) {
char *urlStr;
PRBool strAllocated = PR_TRUE;
nsresult prefres;
prefres = prefs->CopyCharPref("browser.chromeURL", &urlStr);
if (NS_SUCCEEDED(prefres) && urlStr[0] == '\0') {
PL_strfree(urlStr);
prefres = NS_ERROR_FAILURE;
}
if (NS_FAILED(prefres)) {
urlStr = "chrome://navigator/content/navigator.xul";
strAllocated = PR_FALSE;
}
nsCOMPtr<nsIIOService> service(do_GetService(kIOServiceCID));
if (service)
service->NewURI(urlStr, nsnull, getter_AddRefs(uri));
if (strAllocated)
PL_strfree(urlStr);
}
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
nsCOMPtr<nsIXULWindow> newWindow;

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

@ -656,7 +656,7 @@ function Shutdown()
// Check if we have a browser window
if ( window.content == null )
{
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
}
else
{
@ -833,7 +833,7 @@ function RevealSearchPanel()
}
function openNewWindowWith( url ) {
var newWin = window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url );
var newWin = window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
// Fix new window.
newWin.saveFileAndPos = true;

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

@ -89,7 +89,7 @@ function open()
break;
case "1":
dump("*** foopy\n");
window.opener.delayedOpenWindow( "chrome://navigator/content/navigator.xul", "all,dialog=no", dialog.input.value );
window.opener.delayedOpenWindow( getBrowserURL(), "all,dialog=no", dialog.input.value );
break;
case "2":
window.opener.delayedOpenWindow( "chrome://editor/content", "chrome,all,dialog=no", dialog.input.value );

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

@ -68,7 +68,6 @@
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsIURL.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsIWidget.h"
#include "plevent.h"
@ -103,9 +102,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsNetUtil.h"
#include "nsICmdLineHandler.h"
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
// Interface for "unknown content type handler" component/service.
#include "nsIUnkContentTypeHandler.h"
@ -116,6 +112,11 @@ static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
#include "nsINameSpaceManager.h"
#include "nsFileStream.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID);
static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
#ifdef DEBUG
#ifndef DEBUG_pavlov
@ -1840,7 +1841,27 @@ nsBrowserContentHandler::~nsBrowserContentHandler()
{
}
CMDLINEHANDLER2_IMPL(nsBrowserContentHandler,"-chrome","general.startup.browser","chrome://navigator/content/navigator.xul","Start with browser.",NS_BROWSERSTARTUPHANDLER_PROGID,"Browser Startup Handler", PR_TRUE, PR_FALSE)
CMDLINEHANDLER_OTHERS_IMPL(nsBrowserContentHandler,"-chrome","general.startup.browser","Start with browser.",NS_BROWSERSTARTUPHANDLER_PROGID,"Browser Startup Handler", PR_TRUE, PR_FALSE)
NS_IMETHODIMP nsBrowserContentHandler::GetChromeUrlForTask(char **aChromeUrlForTask) {
if (!aChromeUrlForTask)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
if (prefs) {
rv = prefs->CopyCharPref("browser.chromeURL", aChromeUrlForTask);
if (NS_SUCCEEDED(rv) && (*aChromeUrlForTask)[0] == '\0') {
PL_strfree(*aChromeUrlForTask);
rv = NS_ERROR_FAILURE;
}
}
if (NS_FAILED(rv))
*aChromeUrlForTask = PL_strdup("chrome://navigator/content/navigator.xul");
return NS_OK;
}
NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
{

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

@ -209,7 +209,7 @@ function OpenURL(event, node, root)
return(false);
// get right sized window
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
return(true);
}

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

@ -75,7 +75,7 @@ function OpenBookmarkURL(node, datasources)
// Check if we have a browser window
if (window.content == null)
{
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
}
else
{

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

@ -485,7 +485,7 @@ function OpenURL(event, node, root)
return(false);
// get right sized window
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
return(true);
}

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

@ -92,6 +92,6 @@ function OpenURL(event, node)
}
// window.open(url,'history');
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url ); // get right sized window
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url ); // get right sized window
return(true);
}

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

@ -775,7 +775,7 @@ function sidebarOpenURL(event, treeitem, root)
if ( window.content )
window.content.location = id;
else {
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", id );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", id );
}
}

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

@ -1,5 +1,24 @@
var goPrefWindow = 0;
function getBrowserURL() {
try {
var prefs = Components.classes["component://netscape/preferences"];
if (prefs) {
prefs = prefs.getService();
if (prefs)
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
if (prefs) {
var url = prefs.CopyCharPref("browser.chromeURL");
if (url)
return url;
}
} catch(e) {
}
return "chrome://navigator/content/navigator.xul";
}
function goPageSetup()
{
}
@ -140,7 +159,7 @@ function goHelpMenu( url )
{
/* note that this chrome url should probably change to not have all of the navigator controls */
/* also, do we want to limit the number of help windows that can be spawned? */
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
}
@ -166,7 +185,7 @@ function openTopWin( url )
else
{
dump(" No browser window. Should be disabling this button \n");
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", url );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
}
}
@ -185,7 +204,7 @@ function goAboutDialog()
if( defaultAboutState )
window.openDialog("chrome:global/content/about.xul", "About", "modal,chrome,resizable=yes,height=450,width=550");
else
window.openDialog( "chrome://navigator/content/navigator.xul", "_blank", "chrome,all,dialog=no", 'chrome://global/content/about.html' );
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", 'chrome://global/content/about.html' );
}

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

@ -1,7 +1,7 @@
function toNavigator()
{
CycleWindow('navigator:browser', 'chrome://navigator/content/navigator.xul');
CycleWindow('navigator:browser', getBrowserURL());
}
function toMessengerWindow()