mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Adding protocol icon support.
This commit is contained in:
parent
6361c09f47
commit
8fdac273fb
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user