Adding protocol icon support.

This commit is contained in:
dougt%netscape.com 1999-08-27 21:39:40 +00:00
parent 6361c09f47
commit 8fdac273fb

View File

@ -1579,6 +1579,38 @@ nsBrowserAppCore::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL,
//Disable the reload button
setAttribute(mWebShell, "canReload", "disabled", "true");
//Set the "at-work" protocol icon.
char* scheme;
aURL->GetScheme(&scheme);
nsIFileSpec* chrome = NS_LocateFileOrDirectory( nsSpecialFileSpec::App_ChromeDirectory);
if (chrome)
{
chrome->AppendRelativeUnixPath("netwerk/content/default/");
chrome->AppendRelativeUnixPath(scheme);
PRBool exists;
chrome->Exists(&exists);
if (exists)
{
nsAutoString iconURIString;
iconURIString.SetString("chrome://netwerk/content/default/");
iconURIString.Append(scheme);
iconURIString.Append("/working.gif");
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", iconURIString);
}
else
{
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", "");
}
NS_RELEASE(chrome);
}
return NS_OK;
}
@ -1704,6 +1736,42 @@ end:
//Enable the reload button
setAttribute(mWebShell, "canReload", "disabled", "");
//Set the protocol icon.
char* scheme;
aUrl->GetScheme(&scheme);
nsIFileSpec* chrome = NS_LocateFileOrDirectory( nsSpecialFileSpec::App_ChromeDirectory);
if (chrome)
{
chrome->AppendRelativeUnixPath("netwerk/content/default/");
chrome->AppendRelativeUnixPath(scheme);
PRBool exists;
chrome->Exists(&exists);
if (exists)
{
char* scheme;
aUrl->GetScheme(&scheme);
nsAutoString iconURIString;
iconURIString.SetString("chrome://netwerk/content/default/");
iconURIString.Append(scheme);
if (NS_SUCCEEDED(aStatus))
iconURIString.Append("/successful.gif");
else
iconURIString.Append("/failure.gif");
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", iconURIString);
}
else
{
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", "");
}
NS_RELEASE(chrome);
}
//Update the go menu with history entries. Not ready yet
//UpdateGoMenu();
#ifdef NECKO