зеркало из https://github.com/mozilla/pjs.git
API changes for embedding. b=46847, r=dougt, a=valeski
This commit is contained in:
Родитель
fc0a492c57
Коммит
c52f68cce4
|
@ -51,6 +51,8 @@ CPP_OBJS= \
|
|||
include <$(DEPTH)\config\rules.mak>
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
nsDocShell.cpp : nsDocShell.h
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
$(MAKE_INSTALL) appstrings.properties $(DIST)\bin\chrome\locales\en-US\global\locale
|
||||
|
|
|
@ -99,6 +99,8 @@ nsDocShell::nsDocShell() :
|
|||
mInitialPageLoad(PR_TRUE),
|
||||
mAllowPlugins(PR_TRUE),
|
||||
mViewMode(viewNormal),
|
||||
mLastViewMode(viewNormal),
|
||||
mRestoreViewMode(PR_FALSE),
|
||||
mEODForCurrentDocument (PR_FALSE),
|
||||
mUseExternalProtocolHandler (PR_FALSE),
|
||||
mParent(nsnull),
|
||||
|
@ -165,19 +167,28 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
|||
|
||||
if(aIID.Equals(NS_GET_IID(nsIURIContentListener)) &&
|
||||
NS_SUCCEEDED(EnsureContentListener()))
|
||||
*aSink = mContentListener;
|
||||
{
|
||||
*aSink = mContentListener;
|
||||
}
|
||||
else if(aIID.Equals(NS_GET_IID(nsIScriptGlobalObject)) &&
|
||||
NS_SUCCEEDED(EnsureScriptEnvironment()))
|
||||
{
|
||||
*aSink = mScriptGlobal;
|
||||
}
|
||||
else if(aIID.Equals(NS_GET_IID(nsIDOMWindow)) &&
|
||||
NS_SUCCEEDED(EnsureScriptEnvironment()))
|
||||
{
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mScriptGlobal->QueryInterface(NS_GET_IID(nsIDOMWindow),
|
||||
aSink), NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIDOMDocument)) &&
|
||||
NS_SUCCEEDED(EnsureContentViewer()))
|
||||
{
|
||||
mContentViewer->GetDOMDocument((nsIDOMDocument**) aSink);
|
||||
}
|
||||
else if(aIID.Equals(NS_GET_IID(nsIPrompt)))
|
||||
{
|
||||
{
|
||||
nsCOMPtr<nsIPrompt> prompter(do_GetInterface(mTreeOwner));
|
||||
if (prompter)
|
||||
{
|
||||
|
@ -204,7 +215,9 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return QueryInterface(aIID, aSink);
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(((nsISupports*)*aSink));
|
||||
return NS_OK;
|
||||
|
@ -345,12 +358,6 @@ NS_IMETHODIMP nsDocShell::StopLoad()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetDocument(nsIDOMDocument *aDOMDoc, nsIDOMElement *aRootNode)
|
||||
{
|
||||
/* XXX: This method is obsolete and will be removed. */
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetCurrentURI(nsIURI** aURI)
|
||||
{
|
||||
|
@ -1444,6 +1451,7 @@ NS_IMETHODIMP nsDocShell::Stop()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
NS_IMETHODIMP nsDocShell::SetDocument(nsIDOMDocument* aDocument,
|
||||
const PRUnichar* aContentType)
|
||||
{
|
||||
|
@ -1451,6 +1459,7 @@ NS_IMETHODIMP nsDocShell::SetDocument(nsIDOMDocument* aDocument,
|
|||
NS_ERROR("Not Yet Implemented");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
|
@ -1513,6 +1522,7 @@ NS_IMETHODIMP nsDocShell::GetSessionHistory(nsISHistory** aSessionHistory)
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIBaseWindow
|
||||
//*****************************************************************************
|
||||
|
@ -2439,7 +2449,7 @@ nsDocShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest,
|
|||
{
|
||||
// Clear the LSHE reference to indicate document loading has finished
|
||||
// one way or another.
|
||||
if ((aStateFlags & flag_stop) && (aStateFlags & flag_is_network)) {
|
||||
if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_NETWORK)) {
|
||||
LSHE = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -2828,6 +2838,29 @@ NS_IMETHODIMP nsDocShell::CreateFixupURI(const PRUnichar* aStringURI,
|
|||
nsAutoString uriString(aStringURI);
|
||||
uriString.Trim(" "); // Cleanup the empty spaces that might be on each end.
|
||||
|
||||
// XXX nasty hack to check for the view-source: prefix
|
||||
//
|
||||
// The long term way and probably CORRECT way to do this is to write a
|
||||
// protocol handler for the view-source: schema and have that feed back a
|
||||
// content type that the docshell recognizes to mean to use viewSource mode.
|
||||
//
|
||||
const char cViewSource[] = "view-source:";
|
||||
if (uriString.EqualsWithConversion(cViewSource, PR_TRUE, sizeof(cViewSource) - 1))
|
||||
{
|
||||
// Strip the view-source: prefix and set the docshell's view mode
|
||||
nsAutoString newUri;
|
||||
uriString.Mid(newUri, sizeof(cViewSource) - 1, -1);
|
||||
uriString = newUri;
|
||||
mLastViewMode = mViewMode;
|
||||
mViewMode = viewSource;
|
||||
mRestoreViewMode = PR_TRUE;
|
||||
}
|
||||
else if (mRestoreViewMode)
|
||||
{
|
||||
mRestoreViewMode = PR_FALSE;
|
||||
mViewMode = mLastViewMode;
|
||||
}
|
||||
|
||||
// Just try to create an URL out of it
|
||||
NS_NewURI(aURI, uriString, nsnull);
|
||||
if(*aURI)
|
||||
|
|
|
@ -260,7 +260,8 @@ protected:
|
|||
PRBool mInitialPageLoad;
|
||||
PRBool mAllowPlugins;
|
||||
PRInt32 mViewMode;
|
||||
|
||||
PRInt32 mLastViewMode;
|
||||
PRBool mRestoreViewMode;
|
||||
PRInt32 mChildOffset; // Offset in the parent's child list.
|
||||
// Reference to the SHEntry for this docshell until the page is destroyed.
|
||||
// Somebody give me better name
|
||||
|
|
|
@ -95,14 +95,6 @@ interface nsIDocShell : nsISupports
|
|||
nsIWebNavigation::Stop() method.
|
||||
*/
|
||||
void stopLoad();
|
||||
/*
|
||||
Sets the current document to the one being passed in. This will simulate
|
||||
a load.
|
||||
|
||||
@param document - The document to load.
|
||||
@param rootNode - The root of the document content, to be hooked up
|
||||
*/
|
||||
[noscript]void setDocument(in nsIDOMDocument document, in nsIDOMElement rootNode);
|
||||
|
||||
/*
|
||||
The current URI that is loaded.
|
||||
|
|
|
@ -85,16 +85,26 @@ interface nsIWebNavigation : nsISupports
|
|||
/*
|
||||
Definitions for the reload types.
|
||||
*/
|
||||
/* these are load type enums... */
|
||||
const long loadNormal = 0; // Normal Load
|
||||
const long loadNormalReplace = 1; // Normal Load but replaces current history slot
|
||||
const long loadHistory = 2; // Load from history
|
||||
const long loadReloadNormal = 3; // normal Reload
|
||||
const long loadReloadBypassCache = 4; // Reloads bypassing the cache
|
||||
const long loadReloadBypassProxy = 5; // Reloads bypassing the proxy
|
||||
const long loadReloadBypassProxyAndCache = 6;// Reloads bypassing proxy and cache
|
||||
const long loadLink = 7;
|
||||
const long loadRefresh = 8;
|
||||
/* these are load type enums... */
|
||||
const long LOAD_NORMAL = 0; // Normal Load
|
||||
const long LOAD_NORMAL_REPLACE = 1; // Normal Load but replaces current history slot
|
||||
const long LOAD_HISTORY = 2; // Load from history
|
||||
const long LOAD_RELOAD_NORMAL = 3; // normal Reload
|
||||
const long LOAD_RELOAD_BYPASS_CACHE = 4; // Reloads bypassing the cache
|
||||
const long LOAD_RELOAD_BYPASS_PROXY = 5; // Reloads bypassing the proxy
|
||||
const long LOAD_RELOAD_BYPASS_PROXY_AND_CACHE = 6;// Reloads bypassing proxy and cache
|
||||
const long LOAD_LINK = 7;
|
||||
const long LOAD_REFRESH = 8;
|
||||
|
||||
const long loadNormal = 0; // Normal Load
|
||||
const long loadNormalReplace = 1; // Normal Load but replaces current history slot
|
||||
const long loadHistory = 2; // Load from history
|
||||
const long loadReloadNormal = 3; // normal Reload
|
||||
const long loadReloadBypassCache = 4; // Reloads bypassing the cache
|
||||
const long loadReloadBypassProxy = 5; // Reloads bypassing the proxy
|
||||
const long loadReloadBypassProxyAndCache = 6;// Reloads bypassing proxy and cache
|
||||
const long loadLink = 7;
|
||||
const long loadRefresh = 8;
|
||||
|
||||
/*
|
||||
Tells the Object to reload the current location.
|
||||
|
@ -107,19 +117,7 @@ interface nsIWebNavigation : nsISupports
|
|||
void stop();
|
||||
|
||||
/*
|
||||
Set the document for the current webBrowser. This will simulate the normal
|
||||
load process of a document being loaded.
|
||||
|
||||
@param document - The document to be set.
|
||||
@param contentType - This is the content type to try and render the document
|
||||
as. This may be null. If this is null, the method will try to query
|
||||
the document to identify the content type of the document. If the query
|
||||
fails, content type "HTML" will be assumed.
|
||||
*/
|
||||
void setDocument(in nsIDOMDocument document, in wstring contentType);
|
||||
|
||||
/*
|
||||
Retrieves or sets the current Document for the WebBrowser. When setting
|
||||
Retrieves the current Document for the WebBrowser. When setting
|
||||
this will simulate the normal load process.
|
||||
*/
|
||||
readonly attribute nsIDOMDocument document;
|
||||
|
|
|
@ -856,7 +856,7 @@ nsWebShell::OnOverLink(nsIContent* aContent,
|
|||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(mTreeOwner));
|
||||
|
||||
if(browserChrome)
|
||||
browserChrome->SetOverLink(aURLSpec);
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_LINK, aURLSpec);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ NS_IMETHODIMP BarPropImpl::GetVisibleByFlag(PRBool *aVisible,
|
|||
*aVisible = PR_FALSE;
|
||||
if(mBrowserChrome)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeMask(&chromeFlags),
|
||||
NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeFlags(&chromeFlags),
|
||||
NS_ERROR_FAILURE);
|
||||
if(chromeFlags & aChromeFlag)
|
||||
*aVisible = PR_TRUE;
|
||||
|
@ -101,13 +101,13 @@ NS_IMETHODIMP BarPropImpl::SetVisibleByFlag(PRBool aVisible,
|
|||
PRUint32 chromeFlags;
|
||||
if(mBrowserChrome)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeMask(&chromeFlags),
|
||||
NS_ENSURE_SUCCESS(mBrowserChrome->GetChromeFlags(&chromeFlags),
|
||||
NS_ERROR_FAILURE);
|
||||
if(aVisible)
|
||||
chromeFlags |= aChromeFlag;
|
||||
else
|
||||
chromeFlags |= ~aChromeFlag;
|
||||
NS_ENSURE_SUCCESS(mBrowserChrome->SetChromeMask(chromeFlags),
|
||||
NS_ENSURE_SUCCESS(mBrowserChrome->SetChromeFlags(chromeFlags),
|
||||
NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -128,12 +128,12 @@ MenubarPropImpl::~MenubarPropImpl()
|
|||
|
||||
NS_IMETHODIMP MenubarPropImpl::GetVisible(PRBool *aVisible)
|
||||
{
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::menuBarOn);
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP MenubarPropImpl::SetVisible(PRBool aVisible)
|
||||
{
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::menuBarOn);
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -150,12 +150,12 @@ ToolbarPropImpl::~ToolbarPropImpl()
|
|||
|
||||
NS_IMETHODIMP ToolbarPropImpl::GetVisible(PRBool *aVisible)
|
||||
{
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::toolBarOn);
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP ToolbarPropImpl::SetVisible(PRBool aVisible)
|
||||
{
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::toolBarOn);
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -172,12 +172,12 @@ LocationbarPropImpl::~LocationbarPropImpl()
|
|||
|
||||
NS_IMETHODIMP LocationbarPropImpl::GetVisible(PRBool *aVisible)
|
||||
{
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::locationBarOn);
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP LocationbarPropImpl::SetVisible(PRBool aVisible)
|
||||
{
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::locationBarOn);
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -194,12 +194,12 @@ PersonalbarPropImpl::~PersonalbarPropImpl()
|
|||
|
||||
NS_IMETHODIMP PersonalbarPropImpl::GetVisible(PRBool *aVisible)
|
||||
{
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::personalToolBarOn);
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP PersonalbarPropImpl::SetVisible(PRBool aVisible)
|
||||
{
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::personalToolBarOn);
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -216,12 +216,12 @@ StatusbarPropImpl::~StatusbarPropImpl()
|
|||
|
||||
NS_IMETHODIMP StatusbarPropImpl::GetVisible(PRBool *aVisible)
|
||||
{
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::statusBarOn);
|
||||
return BarPropImpl::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_STATUSBAR);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP StatusbarPropImpl::SetVisible(PRBool aVisible)
|
||||
{
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::statusBarOn);
|
||||
return BarPropImpl::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_STATUSBAR);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -859,10 +859,10 @@ NS_IMETHODIMP GlobalWindowImpl::SetStatus(const nsAReadableString& aStatus)
|
|||
{
|
||||
mStatus = aStatus;
|
||||
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
|
||||
GetWebBrowserChrome(getter_AddRefs(browserChrome));
|
||||
if (browserChrome)
|
||||
browserChrome->SetJSStatus(nsPromiseFlatString(aStatus));
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
|
||||
GetWebBrowserChrome(getter_AddRefs(browserChrome));
|
||||
if(browserChrome)
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT, nsPromiseFlatString(aStatus));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -877,10 +877,10 @@ NS_IMETHODIMP GlobalWindowImpl::SetDefaultStatus(const nsAReadableString& aDefau
|
|||
{
|
||||
mDefaultStatus = aDefaultStatus;
|
||||
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
|
||||
GetWebBrowserChrome(getter_AddRefs(browserChrome));
|
||||
if (browserChrome)
|
||||
browserChrome->SetJSDefaultStatus(nsPromiseFlatString(aDefaultStatus));
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome;
|
||||
GetWebBrowserChrome(getter_AddRefs(browserChrome));
|
||||
if(browserChrome)
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT_DEFAULT, nsPromiseFlatString(aDefaultStatus));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2924,7 +2924,7 @@ NS_IMETHODIMP GlobalWindowImpl::OpenInternal(JSContext *cx,
|
|||
|
||||
if (!newDocShellItem) {
|
||||
windowIsNew = PR_TRUE;
|
||||
if (chromeFlags & nsIWebBrowserChrome::modal) {
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL) {
|
||||
eventQService = do_GetService(kEventQueueServiceCID);
|
||||
if (eventQService &&
|
||||
NS_SUCCEEDED(eventQService->
|
||||
|
@ -3060,14 +3060,14 @@ NS_IMETHODIMP GlobalWindowImpl::AttachArguments(nsIDOMWindow *aWindow,
|
|||
*/
|
||||
PRUint32 GlobalWindowImpl::CalculateChromeFlags(char *aFeatures, PRBool aDialog)
|
||||
{
|
||||
if (!aFeatures) {
|
||||
if (aDialog)
|
||||
return nsIWebBrowserChrome::allChrome |
|
||||
nsIWebBrowserChrome::openAsDialog |
|
||||
nsIWebBrowserChrome::openAsChrome;
|
||||
else
|
||||
return nsIWebBrowserChrome::allChrome;
|
||||
}
|
||||
if(!aFeatures) {
|
||||
if(aDialog)
|
||||
return nsIWebBrowserChrome::CHROME_ALL |
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
|
||||
else
|
||||
return nsIWebBrowserChrome::CHROME_ALL;
|
||||
}
|
||||
|
||||
/* This function has become complicated since browser windows and
|
||||
dialogs diverged. The difference is, browser windows assume all
|
||||
|
@ -3080,32 +3080,31 @@ PRUint32 GlobalWindowImpl::CalculateChromeFlags(char *aFeatures, PRBool aDialog)
|
|||
PRUint32 chromeFlags = 0;
|
||||
PRBool presenceFlag = PR_FALSE;
|
||||
|
||||
|
||||
chromeFlags = nsIWebBrowserChrome::windowBordersOn;
|
||||
chromeFlags = nsIWebBrowserChrome::CHROME_WINDOW_BORDERS;
|
||||
if (aDialog && WinHasOption(aFeatures, "all", 0, &presenceFlag))
|
||||
chromeFlags = nsIWebBrowserChrome::allChrome;
|
||||
chromeFlags = nsIWebBrowserChrome::CHROME_ALL;
|
||||
|
||||
/* Next, allow explicitly named options to override the initial settings */
|
||||
|
||||
chromeFlags |= WinHasOption(aFeatures, "titlebar", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::titlebarOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_TITLEBAR : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "close", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::windowCloseOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_WINDOW_CLOSE : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "toolbar", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::toolBarOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_TOOLBAR : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "location", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::locationBarOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_LOCATIONBAR : 0;
|
||||
chromeFlags |= (WinHasOption(aFeatures, "directories", 0, &presenceFlag) ||
|
||||
WinHasOption(aFeatures, "personalbar", 0, &presenceFlag))
|
||||
? nsIWebBrowserChrome::personalToolBarOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "status", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::statusBarOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_STATUSBAR : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "menubar", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::menuBarOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_MENUBAR : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "scrollbars", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::scrollbarsOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_SCROLLBARS : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "resizable", 0, &presenceFlag)
|
||||
? nsIWebBrowserChrome::windowResizeOn : 0;
|
||||
? nsIWebBrowserChrome::CHROME_WINDOW_RESIZE : 0;
|
||||
|
||||
/* OK.
|
||||
Normal browser windows, in spite of a stated pattern of turning off
|
||||
|
@ -3116,12 +3115,12 @@ PRUint32 GlobalWindowImpl::CalculateChromeFlags(char *aFeatures, PRBool aDialog)
|
|||
|
||||
// default titlebar and closebox to "on," if not mentioned at all
|
||||
if (!PL_strcasestr(aFeatures, "titlebar"))
|
||||
chromeFlags |= nsIWebBrowserChrome::titlebarOn;
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
|
||||
if (!PL_strcasestr(aFeatures, "close"))
|
||||
chromeFlags |= nsIWebBrowserChrome::windowCloseOn;
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE;
|
||||
|
||||
if (aDialog && !presenceFlag)
|
||||
chromeFlags = nsIWebBrowserChrome::defaultChrome;
|
||||
chromeFlags = nsIWebBrowserChrome::CHROME_DEFAULT;
|
||||
|
||||
/* Finally, once all the above normal chrome has been divined, deal
|
||||
with the features that are more operating hints than appearance
|
||||
|
@ -3129,28 +3128,28 @@ PRUint32 GlobalWindowImpl::CalculateChromeFlags(char *aFeatures, PRBool aDialog)
|
|||
|
||||
if (WinHasOption(aFeatures, "alwaysLowered", 0, nsnull) ||
|
||||
WinHasOption(aFeatures, "z-lock", 0, nsnull))
|
||||
chromeFlags |= nsIWebBrowserChrome::windowLowered;
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_LOWERED;
|
||||
else if (WinHasOption(aFeatures, "alwaysRaised", 0, nsnull))
|
||||
chromeFlags |= nsIWebBrowserChrome::windowRaised;
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_RAISED;
|
||||
|
||||
chromeFlags |= WinHasOption(aFeatures, "chrome", 0, nsnull) ?
|
||||
nsIWebBrowserChrome::openAsChrome : 0;
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "centerscreen", 0, nsnull) ?
|
||||
nsIWebBrowserChrome::centerScreen : 0;
|
||||
nsIWebBrowserChrome::CHROME_CENTER_SCREEN : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "dependent", 0, nsnull) ?
|
||||
nsIWebBrowserChrome::dependent : 0;
|
||||
nsIWebBrowserChrome::CHROME_DEPENDENT : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "modal", 0, nsnull) ?
|
||||
(nsIWebBrowserChrome::modal | nsIWebBrowserChrome::dependent) : 0;
|
||||
(nsIWebBrowserChrome::CHROME_MODAL | nsIWebBrowserChrome::CHROME_DEPENDENT) : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "dialog", 0, nsnull) ?
|
||||
nsIWebBrowserChrome::openAsDialog : 0;
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG : 0;
|
||||
|
||||
/* and dialogs need to have the last word. assume dialogs are dialogs,
|
||||
and opened as chrome, unless explicitly told otherwise. */
|
||||
if (aDialog) {
|
||||
if (!PL_strcasestr(aFeatures, "dialog"))
|
||||
chromeFlags |= nsIWebBrowserChrome::openAsDialog;
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_OPENAS_DIALOG;
|
||||
if (!PL_strcasestr(aFeatures, "chrome"))
|
||||
chromeFlags |= nsIWebBrowserChrome::openAsChrome;
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
|
||||
}
|
||||
|
||||
/* missing
|
||||
|
@ -3174,14 +3173,16 @@ PRUint32 GlobalWindowImpl::CalculateChromeFlags(char *aFeatures, PRBool aDialog)
|
|||
nsresult res =
|
||||
securityManager->IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
|
||||
|
||||
res = securityManager->IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
|
||||
|
||||
if (NS_FAILED(res) || !enabled) {
|
||||
//If priv check fails, set all elements to minimum reqs., else leave them alone.
|
||||
chromeFlags |= nsIWebBrowserChrome::titlebarOn;
|
||||
chromeFlags &= ~nsIWebBrowserChrome::windowLowered;
|
||||
chromeFlags &= ~nsIWebBrowserChrome::windowRaised;
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
|
||||
chromeFlags &= ~nsIWebBrowserChrome::CHROME_WINDOW_LOWERED;
|
||||
chromeFlags &= ~nsIWebBrowserChrome::CHROME_WINDOW_RAISED;
|
||||
//XXX Temporarily removing this check to allow modal dialogs to be
|
||||
//raised from script. A more complete security based fix is needed.
|
||||
//chromeFlags &= ~nsIWebBrowserChrome::modal;
|
||||
//chromeFlags &= ~nsIWebBrowserChrome::CHROME_MODAL;
|
||||
}
|
||||
|
||||
return chromeFlags;
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "nsIContentViewerFile.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
#include "nsIDOMWindow.h"
|
||||
|
||||
#include "nsEmbedAPI.h"
|
||||
|
||||
// Macros to return errors from bad calls to the automation
|
||||
|
@ -428,13 +430,15 @@ LRESULT CMozillaBrowser::OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
|
|||
char szFileTitle[256];
|
||||
BSTR pageName = NULL;
|
||||
|
||||
//TODO: The IE control allows you to also save as "Web Page, complete"
|
||||
// where all of the page's images are saved in the same directory.
|
||||
// For the moment, we're not allowing this option.
|
||||
|
||||
memset(&SaveFileName, 0, sizeof(SaveFileName));
|
||||
SaveFileName.lStructSize = sizeof(SaveFileName);
|
||||
SaveFileName.hwndOwner = m_hWnd;
|
||||
SaveFileName.hInstance = NULL;
|
||||
SaveFileName.lpstrFilter = "Web Page, HTML Only (*.htm;*.html)\0*.htm;*.html\0Text File (*.txt)\0*.txt\0";
|
||||
//TODO: The IE control allows you to also save as "Web Page, complete" where all of the page's images are saved
|
||||
// in a directory along with the web page. This doesn't appear to be directly supported by Mozilla, but
|
||||
// could be implemented here if deemed necessary. (Web Page, complete (*.htm;*.html)\0*.htm;*.html\0)
|
||||
SaveFileName.lpstrCustomFilter = NULL;
|
||||
SaveFileName.nMaxCustFilter = NULL;
|
||||
SaveFileName.nFilterIndex = 1;
|
||||
|
@ -461,9 +465,9 @@ LRESULT CMozillaBrowser::OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
|
|||
get_LocationName(&pageName);
|
||||
strcpy(szTmp, OLE2A(pageName));
|
||||
|
||||
//The SaveAs dialog will fail if szFile contains any "bad" characters.
|
||||
//This hunk of code attempts to mimick the IE way of replacing "bad"
|
||||
//characters with "good" characters.
|
||||
// The SaveAs dialog will fail if szFile contains any "bad" characters.
|
||||
// This hunk of code attempts to mimick the IE way of replacing "bad"
|
||||
// characters with "good" characters.
|
||||
int j = 0;
|
||||
for (int i=0; szTmp[i]!='\0'; i++)
|
||||
{
|
||||
|
@ -497,42 +501,42 @@ LRESULT CMozillaBrowser::OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
|
|||
szFile[j] = '\0';
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
if ( GetSaveFileName(&SaveFileName) )
|
||||
if (GetSaveFileName(&SaveFileName))
|
||||
{
|
||||
//Get the current DOM document
|
||||
// Get the current DOM document
|
||||
nsIDOMDocument* pDocument = nsnull;
|
||||
hr = GetDOMDocument(&pDocument);
|
||||
if ( FAILED(hr) )
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return hr;
|
||||
}
|
||||
|
||||
//Get an nsIDiskDocument interface to the DOM document
|
||||
// Get an nsIDiskDocument interface to the DOM document
|
||||
nsCOMPtr<nsIDiskDocument> diskDoc = do_QueryInterface(pDocument);
|
||||
if (!diskDoc)
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* XXX fix to use new mime-ified version of SaveFile on nsIDiskDocument
|
||||
//Set the file type specified by the user
|
||||
//Add the correct file extension if none is specified
|
||||
nsIDiskDocument::ESaveFileType saveFileType;
|
||||
if ( SaveFileName.nFilterIndex == 2 ) //SaveAs text file
|
||||
{
|
||||
saveFileType = nsIDiskDocument::eSaveFileText;
|
||||
}
|
||||
else //SaveAs html file
|
||||
{
|
||||
saveFileType = nsIDiskDocument::eSaveFileHTML;
|
||||
}
|
||||
|
||||
//Create an nsFilelSpec from the selected file path.
|
||||
// Create an nsFilelSpec from the selected file path.
|
||||
nsFileSpec fileSpec(szFile, PR_FALSE);
|
||||
|
||||
//Save the file.
|
||||
hr = diskDoc->SaveFile(&fileSpec, PR_TRUE, PR_TRUE, saveFileType, "");
|
||||
*/
|
||||
// Figure out the mime type from the selection
|
||||
nsAutoString mimeType;
|
||||
switch (SaveFileName.nFilterIndex)
|
||||
{
|
||||
case 1:
|
||||
mimeType.AssignWithConversion("text/html");
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
mimeType.AssignWithConversion("text/plain");
|
||||
break;
|
||||
}
|
||||
|
||||
// Save the file.
|
||||
nsAutoString useDocCharset;
|
||||
hr = diskDoc->SaveFile(&fileSpec, PR_TRUE, PR_TRUE, mimeType, useDocCharset, 0);
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
@ -549,9 +553,8 @@ LRESULT CMozillaBrowser::OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl,
|
|||
LRESULT CMozillaBrowser::OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
||||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::OnCut);
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit;
|
||||
nsresult rv = GetEditInterface(getter_AddRefs(contentViewerEdit));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit(do_GetInterface(mWebBrowser));
|
||||
if (contentViewerEdit)
|
||||
{
|
||||
contentViewerEdit->CutSelection();
|
||||
}
|
||||
|
@ -561,9 +564,8 @@ LRESULT CMozillaBrowser::OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b
|
|||
LRESULT CMozillaBrowser::OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
||||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::OnCopy);
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit;
|
||||
nsresult rv = GetEditInterface(getter_AddRefs(contentViewerEdit));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit(do_GetInterface(mWebBrowser));
|
||||
if (contentViewerEdit)
|
||||
{
|
||||
contentViewerEdit->CopySelection();
|
||||
}
|
||||
|
@ -573,9 +575,8 @@ LRESULT CMozillaBrowser::OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
|
|||
LRESULT CMozillaBrowser::OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
||||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::OnPaste);
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit;
|
||||
nsresult rv = GetEditInterface(getter_AddRefs(contentViewerEdit));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit(do_GetInterface(mWebBrowser));
|
||||
if (contentViewerEdit)
|
||||
{
|
||||
contentViewerEdit->Paste();
|
||||
}
|
||||
|
@ -585,9 +586,8 @@ LRESULT CMozillaBrowser::OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
|
|||
LRESULT CMozillaBrowser::OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
||||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::OnSelectAll);
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit;
|
||||
nsresult rv = GetEditInterface(getter_AddRefs(contentViewerEdit));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsCOMPtr<nsIContentViewerEdit> contentViewerEdit(do_GetInterface(mWebBrowser));
|
||||
if (contentViewerEdit)
|
||||
{
|
||||
contentViewerEdit->SelectAll();
|
||||
}
|
||||
|
@ -881,7 +881,9 @@ HRESULT CMozillaBrowser::CreateBrowser()
|
|||
return rv;
|
||||
}
|
||||
|
||||
mWebBrowser->QueryInterface(NS_GET_IID(nsIBaseWindow), (void **) &mWebBrowserAsWin);
|
||||
nsCOMPtr<nsIInterfaceRequestor> webBrowserAsReq(do_QueryInterface(mWebBrowser));
|
||||
|
||||
mWebBrowserAsWin = do_QueryInterface(mWebBrowser);
|
||||
rv = mWebBrowserAsWin->InitWindow(nsNativeWidget(m_hWnd), nsnull,
|
||||
0, 0, rcLocation.right - rcLocation.left, rcLocation.bottom - rcLocation.top);
|
||||
|
||||
|
@ -889,7 +891,13 @@ HRESULT CMozillaBrowser::CreateBrowser()
|
|||
browserAsItem->SetItemType(nsIDocShellTreeItem::typeChromeWrapper);
|
||||
|
||||
rv = mWebBrowserAsWin->Create();
|
||||
rv = mWebBrowser->GetDocShell(&mRootDocShell);
|
||||
|
||||
// Configure what the web browser can and cannot do
|
||||
// nsCOMPtr<nsIWebBrowserSetup> webBrowserAsSetup(do_QueryInterface(mWebBrowser));
|
||||
// webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, aAllowPlugins);
|
||||
|
||||
// XXX delete when docshell becomes inaccessible
|
||||
mRootDocShell = do_GetInterface(mWebBrowser);
|
||||
if (mRootDocShell == nsnull)
|
||||
{
|
||||
NG_ASSERT(0);
|
||||
|
@ -897,7 +905,7 @@ HRESULT CMozillaBrowser::CreateBrowser()
|
|||
SetStartupErrorMessage(IDS_CANNOTCREATEPREFS);
|
||||
return rv;
|
||||
}
|
||||
mRootDocShell->SetAllowPlugins(aAllowPlugins);
|
||||
|
||||
nsCOMPtr<nsIDocumentLoader> docLoader;
|
||||
|
||||
// Create the container object
|
||||
|
@ -939,15 +947,15 @@ HRESULT CMozillaBrowser::DestroyBrowser()
|
|||
}
|
||||
|
||||
// Destroy layout...
|
||||
if (mWebBrowserAsWin != nsnull)
|
||||
if (mWebBrowserAsWin)
|
||||
{
|
||||
mWebBrowserAsWin->Destroy();
|
||||
NS_RELEASE(mWebBrowserAsWin);
|
||||
mWebBrowserAsWin = nsnull;
|
||||
}
|
||||
|
||||
if (mRootDocShell != nsnull)
|
||||
{
|
||||
NS_RELEASE(mRootDocShell);
|
||||
mRootDocShell = nsnull;
|
||||
}
|
||||
|
||||
if (mWebBrowserContainer)
|
||||
|
@ -971,58 +979,6 @@ HRESULT CMozillaBrowser::DestroyBrowser()
|
|||
HRESULT CMozillaBrowser::SetEditorMode(BOOL bEnabled)
|
||||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::SetEditorMode);
|
||||
/*
|
||||
mEditModeFlag = FALSE;
|
||||
if (bEnabled && mEditor == nsnull)
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsresult result = nsComponentManager::CreateInstance(kHTMLEditorCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIEditor),
|
||||
(void **) &mEditor);
|
||||
if (NS_FAILED(result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (!mEditor)
|
||||
{
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
nsIDOMDocument *pIDOMDocument = nsnull;
|
||||
if (FAILED(GetDOMDocument(&pIDOMDocument)) || pIDOMDocument == nsnull)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsIPresShell* pIPresShell = nsnull;
|
||||
if (FAILED(GetPresShell(&pIPresShell)) || pIPresShell == nsnull)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
result = mEditor->Init(pIDOMDocument, pIPresShell, 0);
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
mEditModeFlag = TRUE;
|
||||
}
|
||||
|
||||
NS_RELEASE(pIPresShell);
|
||||
NS_RELEASE(pIDOMDocument);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mEditor)
|
||||
{
|
||||
mEditor->Release();
|
||||
mEditor = nsnull;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1095,72 +1051,12 @@ HRESULT CMozillaBrowser::OnEditorCommand(DWORD nCmdID)
|
|||
}
|
||||
|
||||
|
||||
// Returns the presentation shell
|
||||
HRESULT CMozillaBrowser::GetPresShell(nsIPresShell **pPresShell)
|
||||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::GetPresShell);
|
||||
|
||||
nsresult res;
|
||||
|
||||
// Test for stupid args
|
||||
if (pPresShell == NULL)
|
||||
{
|
||||
NG_ASSERT(0);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
*pPresShell = nsnull;
|
||||
|
||||
if (!IsValid())
|
||||
{
|
||||
NG_ASSERT(0);
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsIContentViewer* pIContentViewer = nsnull;
|
||||
res = mRootDocShell->GetContentViewer(&pIContentViewer);
|
||||
if (NS_SUCCEEDED(res) && pIContentViewer)
|
||||
{
|
||||
nsIDocumentViewer* pIDocViewer = nsnull;
|
||||
res = pIContentViewer->QueryInterface(NS_GET_IID(nsIDocumentViewer), (void**) &pIDocViewer);
|
||||
if (NS_SUCCEEDED(res) && pIDocViewer)
|
||||
{
|
||||
nsIPresContext * pIPresContent = nsnull;
|
||||
res = pIDocViewer->GetPresContext(pIPresContent);
|
||||
if (NS_SUCCEEDED(res) && pIPresContent)
|
||||
{
|
||||
res = pIPresContent->GetShell(pPresShell);
|
||||
NS_RELEASE(pIPresContent);
|
||||
}
|
||||
NS_RELEASE(pIDocViewer);
|
||||
}
|
||||
NS_RELEASE(pIContentViewer);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// Get the nsIContentViewEdit interface from the root docshell
|
||||
HRESULT CMozillaBrowser::GetEditInterface(nsIContentViewerEdit** aEditInterface)
|
||||
{
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
mRootDocShell->GetContentViewer(getter_AddRefs(viewer));
|
||||
nsCOMPtr<nsIContentViewerEdit> edit(do_QueryInterface(viewer));
|
||||
NS_ENSURE_TRUE(edit, NS_ERROR_FAILURE);
|
||||
|
||||
*aEditInterface = edit;
|
||||
NS_ADDREF(*aEditInterface);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Return the root DOM document
|
||||
HRESULT CMozillaBrowser::GetDOMDocument(nsIDOMDocument **pDocument)
|
||||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::GetDOMDocument);
|
||||
|
||||
nsresult res;
|
||||
HRESULT hr = E_FAIL;
|
||||
|
||||
// Test for stupid args
|
||||
if (pDocument == NULL)
|
||||
|
@ -1176,28 +1072,18 @@ HRESULT CMozillaBrowser::GetDOMDocument(nsIDOMDocument **pDocument)
|
|||
NG_ASSERT(0);
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsIContentViewer * pCViewer = nsnull;
|
||||
res = mRootDocShell->GetContentViewer(&pCViewer);
|
||||
if (NS_SUCCEEDED(res) && pCViewer)
|
||||
{
|
||||
nsIDocumentViewer * pDViewer = nsnull;
|
||||
res = pCViewer->QueryInterface(NS_GET_IID(nsIDocumentViewer), (void**) &pDViewer);
|
||||
if (NS_SUCCEEDED(res) && pDViewer)
|
||||
{
|
||||
nsIDocument * pDoc = nsnull;
|
||||
res = pDViewer->GetDocument(pDoc);
|
||||
if (NS_SUCCEEDED(res) && pDoc)
|
||||
{
|
||||
res = pDoc->QueryInterface(NS_GET_IID(nsIDOMDocument), (void**) pDocument);
|
||||
NS_RELEASE(pDoc);
|
||||
}
|
||||
NS_RELEASE(pDViewer);
|
||||
}
|
||||
NS_RELEASE(pCViewer);
|
||||
}
|
||||
|
||||
return res;
|
||||
// Get the DOM window from the webbrowser
|
||||
nsCOMPtr<nsIDOMWindow> window(do_GetInterface(mWebBrowser));
|
||||
if (window)
|
||||
{
|
||||
if (NS_SUCCEEDED(window->GetDocument(pDocument)) && *pDocument)
|
||||
{
|
||||
hr = S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1674,7 +1560,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR
|
|||
// Load the URL
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mRootDocShell);
|
||||
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mWebBrowser);
|
||||
if (spIWebNavigation)
|
||||
{
|
||||
res = spIWebNavigation->LoadURI(sUrl.c_str());
|
||||
|
@ -1745,7 +1631,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level)
|
|||
RETURN_E_UNEXPECTED();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mRootDocShell);
|
||||
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mWebBrowser);
|
||||
if (spIWebNavigation)
|
||||
{
|
||||
spIWebNavigation->Reload(type);
|
||||
|
@ -1765,7 +1651,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Stop()
|
|||
RETURN_E_UNEXPECTED();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mRootDocShell);
|
||||
nsCOMPtr<nsIWebNavigation> spIWebNavigation = do_QueryInterface(mWebBrowser);
|
||||
if (spIWebNavigation)
|
||||
{
|
||||
spIWebNavigation->Stop();
|
||||
|
|
|
@ -328,8 +328,8 @@ protected:
|
|||
|
||||
// Mozilla interfaces
|
||||
nsCOMPtr<nsIWebBrowser> mWebBrowser;
|
||||
nsIBaseWindow * mWebBrowserAsWin;
|
||||
nsIDocShell * mRootDocShell;
|
||||
nsCOMPtr<nsIBaseWindow> mWebBrowserAsWin;
|
||||
nsCOMPtr<nsIDocShell> mRootDocShell; // XXX this is going soon
|
||||
|
||||
nsIPref * mPrefs;
|
||||
nsIEditor * mEditor;
|
||||
|
@ -365,8 +365,6 @@ protected:
|
|||
virtual HRESULT CheckBinDirPath();
|
||||
virtual HRESULT SetStartupErrorMessage(UINT nStringID);
|
||||
virtual HRESULT SetErrorInfo(LPCTSTR lpszDesc, HRESULT hr);
|
||||
virtual HRESULT GetPresShell(nsIPresShell **pPresShell);
|
||||
virtual HRESULT GetEditInterface(nsIContentViewerEdit** aEditInterface);
|
||||
virtual HRESULT GetDOMDocument(nsIDOMDocument **pDocument);
|
||||
virtual HRESULT SetEditorMode(BOOL bEnabled);
|
||||
virtual HRESULT OnEditorCommand(DWORD nCmdID);
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIWebBrowserSetup.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
@ -77,7 +78,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMSelection.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
||||
#include "nsEditorCID.h"
|
||||
|
|
|
@ -63,6 +63,7 @@ NS_INTERFACE_MAP_BEGIN(CWebBrowserContainer)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener)
|
||||
// NS_INTERFACE_MAP_ENTRY(nsICommandHandler)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
|
@ -199,15 +200,15 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStateChange(...)\n"));
|
||||
|
||||
if (progressStateFlags & flag_is_network)
|
||||
if (progressStateFlags & STATE_IS_NETWORK)
|
||||
{
|
||||
|
||||
if (progressStateFlags & flag_start)
|
||||
if (progressStateFlags & STATE_START)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (progressStateFlags & flag_stop)
|
||||
if (progressStateFlags & STATE_STOP)
|
||||
{
|
||||
nsXPIDLCString aURI;
|
||||
if (m_pCurrentURI)
|
||||
|
@ -486,11 +487,8 @@ NS_IMETHODIMP CWebBrowserContainer::GetNewWindow(PRInt32 aChromeFlags,
|
|||
if ((bCancel == VARIANT_FALSE) && pDispNew)
|
||||
{
|
||||
CMozillaBrowser *pBrowser = (CMozillaBrowser *) pDispNew;
|
||||
|
||||
nsIDocShell *docShell;
|
||||
pBrowser->mWebBrowser->GetDocShell(&docShell);
|
||||
docShell->QueryInterface(NS_GET_IID(nsIDocShellTreeItem), (void **) aDocShellTreeItem);
|
||||
docShell->Release();
|
||||
// XXXX what the hell is this supposed to mean?
|
||||
nsCOMPtr<nsIDocShell> docShell(do_GetInterface(pBrowser->mWebBrowser));
|
||||
pDispNew->Release();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -654,7 +652,7 @@ CWebBrowserContainer::SetTitle(const PRUnichar * aTitle)
|
|||
// nsIWebBrowserChrome implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetJSStatus(const PRUnichar *status)
|
||||
CWebBrowserContainer::SetStatus(PRUint32 statusType, const PRUnichar *status)
|
||||
{
|
||||
//Fire a StatusTextChange event
|
||||
BSTR bstrStatus = SysAllocString(status);
|
||||
|
@ -665,30 +663,6 @@ CWebBrowserContainer::SetJSStatus(const PRUnichar *status)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetJSDefaultStatus(const PRUnichar *status)
|
||||
{
|
||||
//Fire a StatusTextChange event
|
||||
BSTR bstrStatus = SysAllocString(status);
|
||||
m_pEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
m_pEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
SysFreeString(bstrStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetOverLink(const PRUnichar *link)
|
||||
{
|
||||
//Fire a StatusTextChange event
|
||||
BSTR bstrStatus = SysAllocString(link);
|
||||
m_pEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
m_pEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
SysFreeString(bstrStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetWebBrowser(nsIWebBrowser * *aWebBrowser)
|
||||
{
|
||||
|
@ -704,21 +678,21 @@ CWebBrowserContainer::SetWebBrowser(nsIWebBrowser * aWebBrowser)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetChromeMask(PRUint32 *aChromeMask)
|
||||
CWebBrowserContainer::GetChromeFlags(PRUint32 *aChromeFlags)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetChromeMask(PRUint32 aChromeMask)
|
||||
CWebBrowserContainer::SetChromeFlags(PRUint32 aChromeFlags)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetNewBrowser(PRUint32 chromeMask, nsIWebBrowser **_retval)
|
||||
CWebBrowserContainer::CreateBrowserWindow(PRUint32 chromeFlags, nsIWebBrowser **_retval)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -909,3 +883,17 @@ CWebBrowserContainer::OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channe
|
|||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsICommandHandler implementation
|
||||
|
||||
/* void do (in string aCommand, in string aStatus); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::Exec(const char *aCommand, const char *aStatus, char **aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void query (in string aCommand, in string aStatus); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::Query(const char *aCommand, const char *aStatus, char **aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define WEBBROWSERCONTAINER_H
|
||||
|
||||
#include "nsIContextMenuListener.h"
|
||||
#include "nsICommandHandler.h"
|
||||
|
||||
// This is the class that handles the XPCOM side of things, callback
|
||||
// interfaces into the web shell and so forth.
|
||||
|
@ -40,7 +41,8 @@ class CWebBrowserContainer :
|
|||
public nsIDocShellTreeOwner,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsIPrompt,
|
||||
public nsIContextMenuListener
|
||||
public nsIContextMenuListener,
|
||||
public nsICommandHandler
|
||||
{
|
||||
public:
|
||||
CWebBrowserContainer(CMozillaBrowser *pOwner);
|
||||
|
@ -70,6 +72,7 @@ public:
|
|||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSICONTEXTMENULISTENER
|
||||
NS_DECL_NSICOMMANDHANDLER
|
||||
|
||||
// "Services" accessed through nsIInterfaceRequestor
|
||||
NS_DECL_NSIPROMPT
|
||||
|
|
|
@ -38,7 +38,6 @@ CPPSRCS = \
|
|||
|
||||
SHARED_LIBRARY_LIBS= \
|
||||
$(DIST)/lib/libnsWebBrowser_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libnsWebBrowserSetup_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS= \
|
||||
|
|
|
@ -29,7 +29,7 @@ MAKE_OBJ_TYPE = DLL
|
|||
DLLNAME = webbrwsr
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
LINCS=-I..\webBrowser -I..\setup
|
||||
LINCS=-I..\webBrowser
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsWebBrowserModule.obj \
|
||||
|
@ -38,7 +38,6 @@ CPP_OBJS= \
|
|||
# These are the libraries we need to link with to create the dll
|
||||
LLIBS = \
|
||||
$(DIST)\lib\nsWebBrowser_s.lib \
|
||||
$(DIST)\lib\nsWebBrowserSetup_s.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\gkgfxwin.lib \
|
||||
$(LIBNSPR)
|
||||
|
|
|
@ -24,26 +24,26 @@
|
|||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsWebBrowser.h"
|
||||
#include "nsWebBrowserSetup.h"
|
||||
#include "nsCommandHandler.h"
|
||||
|
||||
|
||||
// Factory Constructors
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowser)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserSetup)
|
||||
//NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserSetup)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandHandler)
|
||||
|
||||
|
||||
// Component Table
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "WebBrowser Component", NS_WEBBROWSER_CID,
|
||||
NS_WEBBROWSER_PROGID, nsWebBrowserConstructor },
|
||||
{ "WebBrowserSetup Component", NS_WEBBROWSER_SETUP_CID,
|
||||
NS_WEBBROWSER_SETUP_PROGID, nsWebBrowserSetupConstructor },
|
||||
{ "CommandHandler Component", NS_COMMANDHANDLER_CID,
|
||||
NS_COMMANDHANDLER_PROGID, nsCommandHandlerConstructor }
|
||||
// { "WebBrowserSetup Component", NS_WEBBROWSER_SETUP_CID,
|
||||
// NS_WEBBROWSER_SETUP_PROGID, nsWebBrowserSetupConstructor }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -318,33 +318,36 @@ NS_IMETHODIMP GtkMozEmbedChrome::GetInterface(const nsIID &aIID, void** aInstanc
|
|||
|
||||
// nsIWebBrowserChrome interface
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::SetJSStatus(const PRUnichar *status)
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::SetStatus(PRUint32 aType, const PRUnichar *status)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetJSStatus\n"));
|
||||
nsString jsStatusString(status);
|
||||
mJSStatus = jsStatusString.ToNewCString();
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("js status is %s\n", (const char *)mJSStatus));
|
||||
// let our chrome listener know that the JS message has changed.
|
||||
if (mChromeListener)
|
||||
mChromeListener->Message(GtkEmbedListener::MessageJSStatus, mJSStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetStatus\n"));
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::SetJSDefaultStatus(const PRUnichar *status)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetJSDefaultStatus\n"));
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::SetOverLink(const PRUnichar *link)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetOverLink\n"));
|
||||
nsString linkMessageString(link);
|
||||
mLinkMessage = linkMessageString.ToNewCString();
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("message is %s\n", (const char *)mLinkMessage));
|
||||
// notify the chrome listener that the link message has changed
|
||||
if (mChromeListener)
|
||||
mChromeListener->Message(GtkEmbedListener::MessageLink, mLinkMessage);
|
||||
switch (aType)
|
||||
{
|
||||
case STATUS_SCRIPT:
|
||||
{
|
||||
nsString jsStatusString(status);
|
||||
mJSStatus = jsStatusString.ToNewCString();
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("js status is %s\n", (const char *)mJSStatus));
|
||||
// let our chrome listener know that the JS message has changed.
|
||||
if (mChromeListener)
|
||||
mChromeListener->Message(GtkEmbedListener::MessageJSStatus, mJSStatus);
|
||||
}
|
||||
break;
|
||||
case STATUS_SCRIPT_DEFAULT:
|
||||
// NOT IMPLEMENTED
|
||||
break;
|
||||
case STATUS_LINK:
|
||||
{
|
||||
nsString linkMessageString(status);
|
||||
mLinkMessage = linkMessageString.ToNewCString();
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("message is %s\n", (const char *)mLinkMessage));
|
||||
// notify the chrome listener that the link message has changed
|
||||
if (mChromeListener)
|
||||
mChromeListener->Message(GtkEmbedListener::MessageLink, mLinkMessage);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -370,22 +373,22 @@ NS_IMETHODIMP GtkMozEmbedChrome::SetWebBrowser(nsIWebBrowser * aWebBrowser)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::GetChromeMask(PRUint32 *aChromeMask)
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::GetChromeFlags(PRUint32 *aChromeFlags)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetChromeMask\n"));
|
||||
NS_ENSURE_ARG_POINTER(aChromeMask);
|
||||
*aChromeMask = mChromeMask;
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetChromeFlags\n"));
|
||||
NS_ENSURE_ARG_POINTER(aChromeFlags);
|
||||
*aChromeFlags = mChromeMask;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::SetChromeMask(PRUint32 aChromeMask)
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::SetChromeFlags(PRUint32 aChromeFlags)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetChromeMask\n"));
|
||||
mChromeMask = aChromeMask;
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetChromeFlags\n"));
|
||||
mChromeMask = aChromeFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::GetNewBrowser(PRUint32 chromeMask,
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::CreateBrowserWindow(PRUint32 chromeMask,
|
||||
nsIWebBrowser **_retval)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetNewBrowser\n"));
|
||||
|
|
|
@ -264,8 +264,8 @@ GtkMozEmbedPrivate::Init(GtkMozEmbed *aEmbed)
|
|||
// get our hands on the browser chrome
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome = do_QueryInterface(mEmbed);
|
||||
NS_ENSURE_TRUE(browserChrome, NS_ERROR_FAILURE);
|
||||
// set the toplevel window
|
||||
mWebBrowser->SetTopLevelWindow(browserChrome);
|
||||
// set the container window
|
||||
mWebBrowser->SetContainerWindow(browserChrome);
|
||||
// set the widget as the owner of the object
|
||||
mEmbed->Init(GTK_WIDGET(aEmbed));
|
||||
|
||||
|
@ -327,8 +327,7 @@ GtkMozEmbedPrivate::Realize(GtkWidget *aWidget)
|
|||
mWebBrowser->SetParentURIContentListener(uriListener);
|
||||
|
||||
// get the nsIWebProgress object from the chrome docshell
|
||||
nsCOMPtr <nsIDocShell> docShell;
|
||||
mWebBrowser->GetDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr <nsIDocShell> docShell = do_GetInterface(mWebBrowser);
|
||||
nsCOMPtr <nsIWebProgress> webProgress;
|
||||
webProgress = do_GetInterface(docShell);
|
||||
// add our chrome listener object
|
||||
|
@ -563,8 +562,7 @@ GtkMozEmbedPrivate::Destroy(void)
|
|||
mWebBrowser->SetParentURIContentListener(nsnull);
|
||||
|
||||
// remove ourselves as the progress listener for the chrome object
|
||||
nsCOMPtr <nsIDocShell> docShell;
|
||||
mWebBrowser->GetDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr <nsIDocShell> docShell = do_GetInterface(mWebBrowser);
|
||||
nsCOMPtr <nsIWebProgress> webProgress;
|
||||
webProgress = do_GetInterface(docShell);
|
||||
webProgress->RemoveProgressListener(mChromeProgress);
|
||||
|
@ -1111,14 +1109,14 @@ gtk_moz_embed_set_chrome_mask (GtkMozEmbed *embed, guint32 flags)
|
|||
nsCOMPtr<nsIWebBrowserChrome> browserChrome =
|
||||
do_QueryInterface(embed_private->mEmbed);
|
||||
g_return_if_fail(browserChrome);
|
||||
browserChrome->SetChromeMask(flags);
|
||||
browserChrome->SetChromeFlags(flags);
|
||||
}
|
||||
|
||||
guint32
|
||||
gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed)
|
||||
{
|
||||
GtkMozEmbedPrivate *embed_private;
|
||||
PRUint32 curMask = 0;
|
||||
PRUint32 curFlags = 0;
|
||||
|
||||
g_return_val_if_fail ((embed != NULL), 0);
|
||||
g_return_val_if_fail (GTK_IS_MOZ_EMBED(embed), 0);
|
||||
|
@ -1127,8 +1125,8 @@ gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed)
|
|||
nsCOMPtr<nsIWebBrowserChrome> browserChrome =
|
||||
do_QueryInterface(embed_private->mEmbed);
|
||||
g_return_val_if_fail(browserChrome, 0);
|
||||
if (browserChrome->GetChromeMask(&curMask) == NS_OK)
|
||||
return curMask;
|
||||
if (browserChrome->GetChromeFlags(&curFlags) == NS_OK)
|
||||
return curFlags;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,11 +23,12 @@ DEPTH=..\..\..
|
|||
MODULE=webBrowser_core
|
||||
|
||||
XPIDLSRCS= \
|
||||
.\nsIContextMenuListener.idl \
|
||||
.\nsCWebBrowser.idl \
|
||||
.\nsIWebBrowser.idl \
|
||||
.\nsIWebBrowserChrome.idl \
|
||||
.\nsICommandHandler.idl \
|
||||
.\nsIContextMenuListener.idl \
|
||||
.\nsCWebBrowser.idl \
|
||||
.\nsIWebBrowser.idl \
|
||||
.\nsIWebBrowserChrome.idl \
|
||||
.\nsICommandHandler.idl \
|
||||
.\nsIWebBrowserSetup.idl \
|
||||
$(NULL)
|
||||
|
||||
LIBRARY_NAME=nsWebBrowser_s
|
||||
|
|
|
@ -120,10 +120,11 @@ NS_IMETHODIMP nsCommandHandler::SetWindow(nsIDOMWindow * aWindow)
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsICommandHandler implementation
|
||||
|
||||
/* void do (in string aCommand, in string aStatus); */
|
||||
NS_IMETHODIMP nsCommandHandler::Exec(const char *aCommand, const char *aStatus)
|
||||
/* string exec (in string aCommand, in string aStatus); */
|
||||
NS_IMETHODIMP nsCommandHandler::Exec(const char *aCommand, const char *aStatus, char **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCommand);
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
nsCOMPtr<nsICommandHandler> commandHandler;
|
||||
GetCommandHandler(getter_AddRefs(commandHandler));
|
||||
|
@ -131,13 +132,18 @@ NS_IMETHODIMP nsCommandHandler::Exec(const char *aCommand, const char *aStatus)
|
|||
// Call the client's command handler to deal with this command
|
||||
if (commandHandler)
|
||||
{
|
||||
return commandHandler->Exec(aCommand, aStatus);
|
||||
*aResult = nsnull;
|
||||
return commandHandler->Exec(aCommand, aStatus, aResult);
|
||||
}
|
||||
|
||||
// Return an empty string
|
||||
const char szEmpty[] = "";
|
||||
*aResult = (char *) nsAllocator::Clone(szEmpty, sizeof(szEmpty));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void query (in string aCommand, in string aStatus); */
|
||||
/* string query (in string aCommand, in string aStatus); */
|
||||
NS_IMETHODIMP nsCommandHandler::Query(const char *aCommand, const char *aStatus, char **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCommand);
|
||||
|
|
|
@ -238,11 +238,11 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
|
|||
|
||||
nsCOMPtr<nsIWebBrowser> webBrowser;
|
||||
NS_ENSURE_TRUE(mWebBrowserChrome, NS_ERROR_FAILURE);
|
||||
mWebBrowserChrome->GetNewBrowser(aChromeFlags, getter_AddRefs(webBrowser));
|
||||
mWebBrowserChrome->CreateBrowserWindow(aChromeFlags, getter_AddRefs(webBrowser));
|
||||
NS_ENSURE_TRUE(webBrowser, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
webBrowser->GetDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsIInterfaceRequestor> webBrowserAsReq(do_QueryInterface(webBrowser));
|
||||
nsCOMPtr<nsIDocShell> docShell(do_GetInterface(webBrowserAsReq));
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(CallQueryInterface(docShell, aDocShellTreeItem),
|
||||
|
@ -750,3 +750,4 @@ nsresult nsDocShellTreeOwner::MouseOut(nsIDOMEvent* aMouseEvent)
|
|||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,11 +33,20 @@ interface nsICommandHandlerInit : nsISupports
|
|||
[scriptable, uuid(34A4FCF0-66FC-11d4-9528-0020183BF181)]
|
||||
interface nsICommandHandler : nsISupports
|
||||
{
|
||||
void exec(in string aCommand, in string aStatus);
|
||||
void query(in string aCommand, in string aStatus, [retval] out string aResult);
|
||||
/*
|
||||
* Execute the specified command with the specified parameters and return
|
||||
* the result to the caller. The format of the command, parameters and
|
||||
* the result are determined by the acutal implementation.
|
||||
*/
|
||||
string exec(in string aCommand, in string aParameters);
|
||||
/*
|
||||
* Query the status of the specified command with the specified parameters
|
||||
* and return the result to the caller. The format of the command,
|
||||
* parameters and the result are determined by the implementation.
|
||||
*/
|
||||
string query(in string aCommand, in string aParameters);
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
// {3A449110-66FD-11d4-9528-0020183BF181} -
|
||||
#define NS_COMMANDHANDLER_CID \
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDocShell;
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsIWebBrowserChrome;
|
||||
interface nsIURIContentListener;
|
||||
|
@ -75,17 +74,11 @@ interface nsIWebBrowser : nsISupports
|
|||
window. That therefore means that when the topLevelWindow goes away, it
|
||||
must set topLevelWindow to nsnull.
|
||||
*/
|
||||
attribute nsIWebBrowserChrome topLevelWindow;
|
||||
attribute nsIWebBrowserChrome containerWindow;
|
||||
|
||||
/*
|
||||
URI content listener parent. This is not refcounted and is assumed to be
|
||||
nulled out by the parent when the parent is going away.
|
||||
*/
|
||||
attribute nsIURIContentListener parentURIContentListener;
|
||||
|
||||
|
||||
/*
|
||||
The root docShell of the browserWindow.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
};
|
||||
|
|
|
@ -32,23 +32,16 @@ interface nsIDocShellTreeItem;
|
|||
[scriptable, uuid(BA434C60-9D52-11d3-AFB0-00A024FFC08C)]
|
||||
interface nsIWebBrowserChrome : nsISupports
|
||||
{
|
||||
/*
|
||||
Called when the js status value changes. nsnull will be passed when
|
||||
there is no longer any js Status.
|
||||
*/
|
||||
void setJSStatus(in wstring status);
|
||||
const unsigned long STATUS_SCRIPT = 0x00000001;
|
||||
const unsigned long STATUS_SCRIPT_DEFAULT = 0x00000002;
|
||||
const unsigned long STATUS_LINK = 0x00000003;
|
||||
|
||||
/*
|
||||
Called when the js default status value changes. nsnull will be passed
|
||||
when there is no longer any js default status.
|
||||
*/
|
||||
void setJSDefaultStatus(in wstring status);
|
||||
|
||||
/*
|
||||
Called when the current link the mouse is over changes. nsnull will
|
||||
be passed when the mouse is no longer over a link.
|
||||
*/
|
||||
void setOverLink(in wstring link);
|
||||
Called when the status text in the chrome needs to be updated.
|
||||
The statusType indicates what is setting the text, the text is nsnull
|
||||
when there is no longer any status
|
||||
*/
|
||||
void setStatus(in unsigned long statusType, in wstring status);
|
||||
|
||||
/*
|
||||
This is the currently loaded webBrowser. The browser chrome may be
|
||||
|
@ -63,33 +56,35 @@ interface nsIWebBrowserChrome : nsISupports
|
|||
/*
|
||||
Definitions for the chrome masks
|
||||
*/
|
||||
const unsigned long defaultChrome = 0x00000001;
|
||||
const unsigned long windowBordersOn = 0x00000002;
|
||||
const unsigned long windowCloseOn = 0x00000004;
|
||||
const unsigned long windowResizeOn = 0x00000008;
|
||||
const unsigned long menuBarOn = 0x00000010;
|
||||
const unsigned long toolBarOn = 0x00000020;
|
||||
const unsigned long locationBarOn = 0x00000040;
|
||||
const unsigned long statusBarOn = 0x00000080;
|
||||
const unsigned long personalToolBarOn = 0x00000100;
|
||||
const unsigned long scrollbarsOn = 0x00000200;
|
||||
const unsigned long titlebarOn = 0x00000400;
|
||||
const unsigned long extraChromeOn = 0x00000800;
|
||||
const unsigned long CHROME_DEFAULT = 0x00000001;
|
||||
const unsigned long CHROME_WINDOW_BORDERS = 0x00000002;
|
||||
const unsigned long CHROME_WINDOW_CLOSE = 0x00000004;
|
||||
const unsigned long CHROME_WINDOW_RESIZE = 0x00000008;
|
||||
const unsigned long CHROME_MENUBAR = 0x00000010;
|
||||
const unsigned long CHROME_TOOLBAR = 0x00000020;
|
||||
const unsigned long CHROME_LOCATIONBAR = 0x00000040;
|
||||
const unsigned long CHROME_STATUSBAR = 0x00000080;
|
||||
const unsigned long CHROME_PERSONAL_TOOLBAR = 0x00000100;
|
||||
const unsigned long CHROME_SCROLLBARS = 0x00000200;
|
||||
const unsigned long CHROME_TITLEBAR = 0x00000400;
|
||||
const unsigned long CHROME_EXTRA = 0x00000800;
|
||||
|
||||
const unsigned long windowRaised = 0x02000000;
|
||||
const unsigned long windowLowered = 0x04000000;
|
||||
const unsigned long centerScreen = 0x08000000;
|
||||
const unsigned long dependent = 0x10000000;
|
||||
const unsigned long modal = 0x20000000;
|
||||
const unsigned long openAsDialog = 0x40000000;
|
||||
const unsigned long openAsChrome = 0x80000000;
|
||||
const unsigned long CHROME_WINDOW_RAISED = 0x02000000;
|
||||
const unsigned long CHROME_WINDOW_LOWERED = 0x04000000;
|
||||
const unsigned long CHROME_CENTER_SCREEN = 0x08000000;
|
||||
const unsigned long CHROME_DEPENDENT = 0x10000000;
|
||||
// Note: The modal style bit just affects the way the window looks and does
|
||||
// mean it's actually modal.
|
||||
const unsigned long CHROME_MODAL = 0x20000000;
|
||||
const unsigned long CHROME_OPENAS_DIALOG = 0x40000000;
|
||||
const unsigned long CHROME_OPENAS_CHROME = 0x80000000;
|
||||
|
||||
const unsigned long allChrome = 0x00000ffe;
|
||||
const unsigned long CHROME_ALL = 0x00000ffe;
|
||||
|
||||
/*
|
||||
The chrome mask for this browser chrome
|
||||
The chrome flags for this browser chrome
|
||||
*/
|
||||
attribute unsigned long chromeMask;
|
||||
attribute unsigned long chromeFlags;
|
||||
|
||||
/*
|
||||
Tells the implementer of this interface to create a new webBrowserChrome
|
||||
|
@ -101,7 +96,8 @@ interface nsIWebBrowserChrome : nsISupports
|
|||
setWebBrowser will be called with the new widget to instantiate in this
|
||||
new window.
|
||||
*/
|
||||
nsIWebBrowser getNewBrowser(in unsigned long chromeMask);
|
||||
|
||||
nsIWebBrowser createBrowserWindow(in unsigned long chromeFlags);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications, Inc. Portions created by Netscape are
|
||||
* Copyright (C) 1999, Mozilla. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Travis Bogard <travis@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
|
||||
/**
|
||||
* The nsIWebBrowserSetup
|
||||
*/
|
||||
|
||||
[scriptable, uuid(F15398A0-8018-11d3-AF70-00A024FFC08C)]
|
||||
interface nsIWebBrowserSetup : nsISupports
|
||||
{
|
||||
const unsigned long SETUP_ALLOW_PLUGINS = 1;
|
||||
|
||||
void setProperty(in unsigned long aId, in unsigned long aValue);
|
||||
};
|
|
@ -145,7 +145,7 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIInterfaceRequestor* aLis
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetTopLevelWindow(nsIWebBrowserChrome** aTopWindow)
|
||||
NS_IMETHODIMP nsWebBrowser::GetContainerWindow(nsIWebBrowserChrome** aTopWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTopWindow);
|
||||
|
||||
|
@ -158,7 +158,7 @@ NS_IMETHODIMP nsWebBrowser::GetTopLevelWindow(nsIWebBrowserChrome** aTopWindow)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::SetTopLevelWindow(nsIWebBrowserChrome* aTopWindow)
|
||||
NS_IMETHODIMP nsWebBrowser::SetContainerWindow(nsIWebBrowserChrome* aTopWindow)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(EnsureDocShellTreeOwner(), NS_ERROR_FAILURE);
|
||||
return mDocShellTreeOwner->SetWebBrowserChrome(aTopWindow);
|
||||
|
@ -181,16 +181,6 @@ NS_IMETHODIMP nsWebBrowser::SetParentURIContentListener(nsIURIContentListener*
|
|||
return mContentListener->SetParentContentListener(aParentContentListener);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetDocShell(nsIDocShell** aDocShell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocShell);
|
||||
|
||||
*aDocShell = mDocShell;
|
||||
NS_IF_ADDREF(*aDocShell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsWebBrowser::nsIDocShellTreeItem
|
||||
//*****************************************************************************
|
||||
|
@ -322,15 +312,21 @@ NS_IMETHODIMP nsWebBrowser::FindItemWithName(const PRUnichar *aName,
|
|||
|
||||
NS_IMETHODIMP nsWebBrowser::GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTreeOwner);
|
||||
|
||||
if(mDocShellTreeOwner)
|
||||
*aTreeOwner = mDocShellTreeOwner->mTreeOwner;
|
||||
else
|
||||
*aTreeOwner = nsnull;
|
||||
|
||||
NS_IF_ADDREF(*aTreeOwner);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aTreeOwner);
|
||||
*aTreeOwner = nsnull;
|
||||
if(mDocShellTreeOwner)
|
||||
{
|
||||
if (mDocShellTreeOwner->mTreeOwner)
|
||||
{
|
||||
*aTreeOwner = mDocShellTreeOwner->mTreeOwner;
|
||||
}
|
||||
else
|
||||
{
|
||||
*aTreeOwner = mDocShellTreeOwner;
|
||||
}
|
||||
}
|
||||
NS_IF_ADDREF(*aTreeOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
|
||||
|
@ -411,20 +407,6 @@ NS_IMETHODIMP nsWebBrowser::Stop()
|
|||
return mDocShellAsNav->Stop();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::SetDocument(nsIDOMDocument* aDocument,
|
||||
const PRUnichar* aContentType)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
return mDocShellAsNav->SetDocument(aDocument, aContentType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsNav->GetDocument(aDocument);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetCurrentURI(PRUnichar** aCurrentURI)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
@ -455,6 +437,38 @@ NS_IMETHODIMP nsWebBrowser::GetSessionHistory(nsISHistory** aSessionHistory)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsNav->GetDocument(aDocument);
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// nsWebBrowser::nsIWebBrowserSetup
|
||||
//*****************************************************************************
|
||||
|
||||
/* void setProperty (in unsigned long aId, in unsigned long aValue); */
|
||||
NS_IMETHODIMP nsWebBrowser::SetProperty(PRUint32 aId, PRUint32 aValue)
|
||||
{
|
||||
switch (aId)
|
||||
{
|
||||
case nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS:
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
NS_ENSURE_TRUE((aValue == PR_TRUE || aValue == PR_FALSE), NS_ERROR_INVALID_ARG);
|
||||
mDocShell->SetAllowPlugins(aValue);
|
||||
}
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// nsWebBrowser::nsIWebProgress
|
||||
//*****************************************************************************
|
||||
|
@ -473,41 +487,6 @@ NS_IMETHODIMP nsWebBrowser::RemoveProgressListener(nsIWebProgressListener* aList
|
|||
return mDocShellAsProgress->RemoveProgressListener(aListener);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetProgressStatusFlags(PRInt32* aProgressStatusFlags)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsProgress->GetProgressStatusFlags(aProgressStatusFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetCurSelfProgress(PRInt32* aCurSelfProgress)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsProgress->GetCurSelfProgress(aCurSelfProgress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetMaxSelfProgress(PRInt32* aMaxSelfProgress)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsProgress->GetMaxSelfProgress(aMaxSelfProgress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetCurTotalProgress(PRInt32* aCurTotalProgress)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsProgress->GetCurTotalProgress(aCurTotalProgress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetMaxTotalProgress(PRInt32* aMaxTotalProgress)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsProgress->GetMaxTotalProgress(aMaxTotalProgress);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsWebBrowser::nsIBaseWindow
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsIWebBrowser.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIWebBrowserSetup.h"
|
||||
|
||||
class nsWebBrowserInitInfo
|
||||
{
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
class nsWebBrowser : public nsIWebBrowser,
|
||||
public nsIWebNavigation,
|
||||
public nsIWebProgress,
|
||||
public nsIWebBrowserSetup,
|
||||
public nsIDocShellTreeItem,
|
||||
public nsIBaseWindow,
|
||||
public nsIScrollable,
|
||||
|
@ -84,6 +86,7 @@ public:
|
|||
NS_DECL_NSIWEBBROWSER
|
||||
NS_DECL_NSIWEBNAVIGATION
|
||||
NS_DECL_NSIWEBPROGRESS
|
||||
NS_DECL_NSIWEBBROWSERSETUP
|
||||
|
||||
protected:
|
||||
virtual ~nsWebBrowser();
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "WebBrowser.h"
|
||||
|
||||
#include "nsCWebBrowser.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIContentViewerFile.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIEditorShell.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
|
||||
nsresult
|
||||
ConvertDocShellToDOMWindow(nsIDocShell* aDocShell, nsIDOMWindow** aDOMWindow)
|
||||
{
|
||||
if (!aDOMWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aDOMWindow = nsnull;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject(do_GetInterface(aDocShell));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(scriptGlobalObject));
|
||||
if (!domWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aDOMWindow = domWindow.get();
|
||||
NS_ADDREF(*aDOMWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WebBrowser::WebBrowser(){}
|
||||
WebBrowser::~WebBrowser()
|
||||
{
|
||||
PRBool duh;
|
||||
if (mEditor) // not good place for it!
|
||||
mEditor->SaveDocument(PR_FALSE, PR_FALSE, &duh);
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebBrowser::Init(nsNativeWidget widget, nsIWebBrowserChrome* aTopWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
mWebBrowser = do_CreateInstance(NS_WEBBROWSER_PROGID, &rv);
|
||||
|
||||
if (!mWebBrowser)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mBaseWindow = do_QueryInterface(mWebBrowser);
|
||||
|
||||
mTopWindow = aTopWindow;
|
||||
mWebBrowser->SetTopLevelWindow(aTopWindow);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(mWebBrowser);
|
||||
dsti->SetItemType(nsIDocShellTreeItem::typeChromeWrapper);
|
||||
|
||||
rv = mBaseWindow->InitWindow( widget,
|
||||
nsnull,
|
||||
0,
|
||||
0,
|
||||
100,
|
||||
100);
|
||||
|
||||
mBaseWindow->Create();
|
||||
mBaseWindow->SetVisibility(PR_TRUE);
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebBrowser::GetWebBrowser(nsIWebBrowser **outBrowser)
|
||||
{
|
||||
*outBrowser = mWebBrowser;
|
||||
NS_IF_ADDREF(*outBrowser);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebBrowser::GoTo(char* url)
|
||||
{
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
|
||||
return webNav->LoadURI(NS_ConvertASCIItoUCS2(url).GetUnicode());
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebBrowser::Edit(char* url)
|
||||
{
|
||||
nsresult rv;
|
||||
mEditor = do_CreateInstance("component://netscape/editor/editorshell", &rv);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr <nsIDocShell> rootDocShell;
|
||||
mWebBrowser->GetDocShell(getter_AddRefs(rootDocShell));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
ConvertDocShellToDOMWindow(rootDocShell, getter_AddRefs(domWindow));
|
||||
|
||||
mEditor->Init();
|
||||
mEditor->SetEditorType(NS_ConvertASCIItoUCS2("html").GetUnicode());
|
||||
mEditor->SetWebShellWindow(domWindow);
|
||||
mEditor->SetContentWindow(domWindow);
|
||||
return mEditor->LoadUrl(NS_ConvertASCIItoUCS2(url).GetUnicode());
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebBrowser::Print(void)
|
||||
{
|
||||
nsCOMPtr <nsIDocShell> rootDocShell;
|
||||
mWebBrowser->GetDocShell(getter_AddRefs(rootDocShell));
|
||||
|
||||
|
||||
nsIContentViewer *pContentViewer = nsnull;
|
||||
nsresult res = rootDocShell->GetContentViewer(&pContentViewer);
|
||||
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsCOMPtr<nsIContentViewerFile> spContentViewerFile = do_QueryInterface(pContentViewer);
|
||||
spContentViewerFile->Print(PR_TRUE, nsnull);
|
||||
NS_RELEASE(pContentViewer);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
WebBrowser::SetPositionAndSize(int x, int y, int cx, int cy)
|
||||
{
|
||||
return mBaseWindow->SetPositionAndSize(x, y, cx, cy, PR_TRUE);
|
||||
}
|
||||
|
|
@ -75,17 +75,7 @@ NS_IMETHODIMP WebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstance
|
|||
// WebBrowserChrome::nsIWebBrowserChrome
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP WebBrowserChrome::SetJSStatus(const PRUnichar* aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP WebBrowserChrome::SetJSDefaultStatus(const PRUnichar* aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP WebBrowserChrome::SetOverLink(const PRUnichar* aLink)
|
||||
NS_IMETHODIMP WebBrowserChrome::SetStatus(PRUint32 aType, const PRUnichar* aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -109,13 +99,13 @@ NS_IMETHODIMP WebBrowserChrome::SetWebBrowser(nsIWebBrowser* aWebBrowser)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP WebBrowserChrome::GetChromeMask(PRUint32* aChromeMask)
|
||||
NS_IMETHODIMP WebBrowserChrome::GetChromeFlags(PRUint32* aChromeMask)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP WebBrowserChrome::SetChromeMask(PRUint32 aChromeMask)
|
||||
NS_IMETHODIMP WebBrowserChrome::SetChromeFlags(PRUint32 aChromeMask)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -125,7 +115,7 @@ NS_IMETHODIMP WebBrowserChrome::SetChromeMask(PRUint32 aChromeMask)
|
|||
// in winEmbed.cpp
|
||||
extern nativeWindow CreateNativeWindow(nsIWebBrowserChrome* chrome);
|
||||
|
||||
NS_IMETHODIMP WebBrowserChrome::GetNewBrowser(PRUint32 chromeMask, nsIWebBrowser **aWebBrowser)
|
||||
NS_IMETHODIMP WebBrowserChrome::CreateBrowserWindow(PRUint32 chromeMask, nsIWebBrowser **aWebBrowser)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWebBrowser);
|
||||
*aWebBrowser = nsnull;
|
||||
|
@ -135,7 +125,7 @@ NS_IMETHODIMP WebBrowserChrome::GetNewBrowser(PRUint32 chromeMask, nsIWebBrowser
|
|||
if (!mWebBrowser)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mWebBrowser->SetTopLevelWindow(NS_STATIC_CAST(nsIWebBrowserChrome*, this));
|
||||
mWebBrowser->SetContainerWindow(NS_STATIC_CAST(nsIWebBrowserChrome*, this));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(mWebBrowser);
|
||||
dsti->SetItemType(nsIDocShellTreeItem::typeChromeWrapper);
|
||||
|
@ -221,7 +211,7 @@ NS_IMETHODIMP WebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIReque
|
|||
PRInt32 progressStateFlags, PRUint32 status)
|
||||
{
|
||||
|
||||
if ((progressStateFlags & flag_stop) && (progressStateFlags & flag_is_request))
|
||||
if ((progressStateFlags & STATE_STOP) && (progressStateFlags & STATE_IS_REQUEST))
|
||||
{
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -88,7 +88,7 @@ nsresult OpenWebPage(char* url)
|
|||
NS_ADDREF(chrome); // native window will hold the addref.
|
||||
|
||||
nsCOMPtr<nsIWebBrowser> newBrowser;
|
||||
chrome->GetNewBrowser(0, getter_AddRefs(newBrowser));
|
||||
chrome->CreateBrowserWindow(0, getter_AddRefs(newBrowser));
|
||||
if (!newBrowser)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -254,9 +254,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
nsCOMPtr<nsIWebBrowser> wb;
|
||||
chrome->GetWebBrowser(getter_AddRefs(wb));
|
||||
|
||||
nsCOMPtr <nsIDocShell> rootDocShell;
|
||||
wb->GetDocShell(getter_AddRefs(rootDocShell));
|
||||
|
||||
nsCOMPtr <nsIDocShell> rootDocShell = do_GetInterface(wb);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> pContentViewer;
|
||||
nsresult res = rootDocShell->GetContentViewer(getter_AddRefs(pContentViewer));
|
||||
|
@ -276,9 +274,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
nsCOMPtr<nsIWebBrowser> wb;
|
||||
chrome->GetWebBrowser(getter_AddRefs(wb));
|
||||
|
||||
nsCOMPtr <nsIDocShell> rootDocShell;
|
||||
wb->GetDocShell(getter_AddRefs(rootDocShell));
|
||||
|
||||
nsCOMPtr <nsIDocShell> rootDocShell = do_GetInterface(wb);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> pContentViewer;
|
||||
nsresult res = rootDocShell->GetContentViewer(getter_AddRefs(pContentViewer));
|
||||
|
@ -300,9 +296,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
nsCOMPtr<nsIWebBrowser> wb;
|
||||
chrome->GetWebBrowser(getter_AddRefs(wb));
|
||||
|
||||
nsCOMPtr <nsIDocShell> rootDocShell;
|
||||
wb->GetDocShell(getter_AddRefs(rootDocShell));
|
||||
|
||||
nsCOMPtr <nsIDocShell> rootDocShell = do_GetInterface(wb);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> pContentViewer;
|
||||
nsresult res = rootDocShell->GetContentViewer(getter_AddRefs(pContentViewer));
|
||||
|
|
|
@ -318,8 +318,8 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
#endif
|
||||
|
||||
// A Document is starting to load...
|
||||
if ((aProgressStateFlags & flag_start) &&
|
||||
(aProgressStateFlags & flag_is_network))
|
||||
if ((aProgressStateFlags & STATE_START) &&
|
||||
(aProgressStateFlags & STATE_IS_NETWORK))
|
||||
{
|
||||
// starting to load a webpage
|
||||
PR_FREEIF(mLastPSMStatus); mLastPSMStatus = nsnull;
|
||||
|
@ -331,8 +331,8 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
}
|
||||
|
||||
// A document has finished loading
|
||||
if ((aProgressStateFlags & flag_stop) &&
|
||||
(aProgressStateFlags & flag_is_network) &&
|
||||
if ((aProgressStateFlags & STATE_STOP) &&
|
||||
(aProgressStateFlags & STATE_IS_NETWORK) &&
|
||||
mIsSecureDocument)
|
||||
{
|
||||
if (!mIsDocumentBroken) // and status is okay FIX
|
||||
|
@ -413,15 +413,15 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
return NS_OK;
|
||||
|
||||
// A URL is starting to load...
|
||||
if ((aProgressStateFlags & flag_start) &&
|
||||
(aProgressStateFlags & flag_is_network))
|
||||
if ((aProgressStateFlags & STATE_START) &&
|
||||
(aProgressStateFlags & STATE_IS_NETWORK))
|
||||
{ // check to see if we are going to mix content.
|
||||
return CheckMixedContext(loadingURI);
|
||||
}
|
||||
|
||||
// A URL has finished loading...
|
||||
if ((aProgressStateFlags & flag_stop) &&
|
||||
(aProgressStateFlags & flag_is_network))
|
||||
if ((aProgressStateFlags & STATE_STOP) &&
|
||||
(aProgressStateFlags & STATE_IS_NETWORK))
|
||||
{
|
||||
if (1) // FIX status from the flag...
|
||||
{
|
||||
|
@ -671,7 +671,7 @@ nsSecureBrowserUIImpl::CheckPost(nsIURI *actionURL, PRBool *okayToPost)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool boolpref = PR_TRUE;
|
||||
PRBool boolpref = PR_TRUE;
|
||||
|
||||
// posting to a non https URL.
|
||||
mPref->GetBoolPref(INSECURE_SUBMIT_PREF, &boolpref);
|
||||
|
|
|
@ -1761,7 +1761,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char *aStatusMsg)
|
|||
if(browserChrome)
|
||||
{
|
||||
nsAutoString msg; msg.AssignWithConversion(aStatusMsg);
|
||||
browserChrome->SetJSStatus(msg.GetUnicode());
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT, msg.GetUnicode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1761,7 +1761,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char *aStatusMsg)
|
|||
if(browserChrome)
|
||||
{
|
||||
nsAutoString msg; msg.AssignWithConversion(aStatusMsg);
|
||||
browserChrome->SetJSStatus(msg.GetUnicode());
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT, msg.GetUnicode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ nsMathMLmactionFrame::ShowStatus(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(treeOwner));
|
||||
|
||||
if(browserChrome)
|
||||
browserChrome->SetJSStatus(aStatusMsg.GetUnicode());
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT, aStatusMsg.GetUnicode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,9 +113,9 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
nsresult aStatus)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aProgressStateFlags & flag_is_network)
|
||||
if (aProgressStateFlags & STATE_IS_NETWORK)
|
||||
{
|
||||
if (aProgressStateFlags & flag_start)
|
||||
if (aProgressStateFlags & STATE_START)
|
||||
{
|
||||
m_lastPercent = 0;
|
||||
StartMeteors();
|
||||
|
@ -125,7 +125,7 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(loadingDocument);
|
||||
}
|
||||
else if (aProgressStateFlags & flag_stop)
|
||||
else if (aProgressStateFlags & STATE_STOP)
|
||||
{
|
||||
StopMeteors();
|
||||
nsXPIDLString documentDone;
|
||||
|
|
|
@ -883,7 +883,7 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
|
|||
if(browserChrome)
|
||||
{
|
||||
nsAutoString msg; msg.AssignWithConversion(aStatusMsg);
|
||||
browserChrome->SetJSStatus(msg.GetUnicode());
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT, msg.GetUnicode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -883,7 +883,7 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
|
|||
if(browserChrome)
|
||||
{
|
||||
nsAutoString msg; msg.AssignWithConversion(aStatusMsg);
|
||||
browserChrome->SetJSStatus(msg.GetUnicode());
|
||||
browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT, msg.GetUnicode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#include "nsIPlatformCharset.h"
|
||||
#undef NS_IMPL_IDS
|
||||
|
||||
#define CHROME_STYLE nsIWebBrowserChrome::allChrome | nsIWebBrowserChrome::centerScreen
|
||||
#define CHROME_STYLE nsIWebBrowserChrome::CHROME_ALL | nsIWebBrowserChrome::CHROME_CENTER_SCREEN
|
||||
|
||||
/* Network */
|
||||
|
||||
|
|
|
@ -105,9 +105,9 @@
|
|||
#define SHRIMP_PREF "shrimp.startup.enable"
|
||||
|
||||
#if defined (XP_MAC)
|
||||
#define CHROME_STYLE nsIWebBrowserChrome::windowBordersOn | nsIWebBrowserChrome::windowCloseOn | nsIWebBrowserChrome::centerScreen
|
||||
#define CHROME_STYLE nsIWebBrowserChrome::CHROME_WINDOW_BORDERS | nsIWebBrowserChrome::CHROME_WINDOW_CLOSE | nsIWebBrowserChrome::CHROME_CENTER_SCREEN
|
||||
#else /* the rest */
|
||||
#define CHROME_STYLE nsIWebBrowserChrome::allChrome | nsIWebBrowserChrome::centerScreen
|
||||
#define CHROME_STYLE nsIWebBrowserChrome::CHROME_ALL | nsIWebBrowserChrome::CHROME_CENTER_SCREEN
|
||||
#endif
|
||||
|
||||
// we want everyone to have the debugging info to the console for now
|
||||
|
|
|
@ -479,7 +479,7 @@ nsDocLoaderImpl::OnStartRequest(nsIChannel *aChannel, nsISupports *aCtxt)
|
|||
mLoadGroup->SetDefaultLoadChannel(mDocumentChannel);
|
||||
|
||||
// Update the progress status state
|
||||
mProgressStateFlags = nsIWebProgressListener::flag_start;
|
||||
mProgressStateFlags = nsIWebProgressListener::STATE_START;
|
||||
|
||||
doStartDocumentLoad();
|
||||
FireOnStartDocumentLoad(this, aChannel);
|
||||
|
@ -592,7 +592,7 @@ void nsDocLoaderImpl::DocLoaderIsEmpty(nsresult aStatus)
|
|||
mIsLoadingDocument = PR_FALSE;
|
||||
|
||||
// Update the progress status state - the document is done
|
||||
mProgressStateFlags = nsIWebProgressListener::flag_stop;
|
||||
mProgressStateFlags = nsIWebProgressListener::STATE_STOP;
|
||||
|
||||
//
|
||||
// New code to break the circular reference between
|
||||
|
@ -628,15 +628,15 @@ void nsDocLoaderImpl::doStartDocumentLoad(void)
|
|||
this, (const char *) buffer));
|
||||
#endif /* DEBUG */
|
||||
|
||||
// Fire an OnStatus(...) notification flag_net_start. This indicates
|
||||
// Fire an OnStatus(...) notification STATE_START. This indicates
|
||||
// that the document represented by mDocumentChannel has started to
|
||||
// load...
|
||||
FireOnStateChange(this,
|
||||
mDocumentChannel,
|
||||
nsIWebProgressListener::flag_start |
|
||||
nsIWebProgressListener::flag_is_document |
|
||||
nsIWebProgressListener::flag_is_request |
|
||||
nsIWebProgressListener::flag_is_network,
|
||||
nsIWebProgressListener::STATE_START |
|
||||
nsIWebProgressListener::STATE_IS_DOCUMENT |
|
||||
nsIWebProgressListener::STATE_IS_REQUEST |
|
||||
nsIWebProgressListener::STATE_IS_NETWORK,
|
||||
NS_OK);
|
||||
}
|
||||
|
||||
|
@ -654,8 +654,8 @@ void nsDocLoaderImpl::doStartURLLoad(nsIChannel *aChannel)
|
|||
|
||||
FireOnStateChange(this,
|
||||
aChannel,
|
||||
nsIWebProgressListener::flag_start |
|
||||
nsIWebProgressListener::flag_is_request,
|
||||
nsIWebProgressListener::STATE_START |
|
||||
nsIWebProgressListener::STATE_IS_REQUEST,
|
||||
NS_OK);
|
||||
}
|
||||
|
||||
|
@ -673,8 +673,8 @@ void nsDocLoaderImpl::doStopURLLoad(nsIChannel *aChannel, nsresult aStatus)
|
|||
|
||||
FireOnStateChange(this,
|
||||
aChannel,
|
||||
nsIWebProgressListener::flag_stop |
|
||||
nsIWebProgressListener::flag_is_request,
|
||||
nsIWebProgressListener::STATE_STOP |
|
||||
nsIWebProgressListener::STATE_IS_REQUEST,
|
||||
aStatus);
|
||||
}
|
||||
|
||||
|
@ -697,9 +697,9 @@ void nsDocLoaderImpl::doStopDocumentLoad(nsIChannel* aChannel,
|
|||
//
|
||||
FireOnStateChange(this,
|
||||
aChannel,
|
||||
nsIWebProgressListener::flag_stop |
|
||||
nsIWebProgressListener::flag_is_document |
|
||||
nsIWebProgressListener::flag_is_network,
|
||||
nsIWebProgressListener::STATE_STOP |
|
||||
nsIWebProgressListener::STATE_IS_DOCUMENT |
|
||||
nsIWebProgressListener::STATE_IS_NETWORK,
|
||||
aStatus);
|
||||
}
|
||||
|
||||
|
@ -956,33 +956,31 @@ nsDocLoaderImpl::RemoveProgressListener(nsIWebProgressListener *aListener)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocLoaderImpl::GetProgressStatusFlags(PRInt32 *aProgressStateFlags)
|
||||
nsresult nsDocLoaderImpl::GetProgressStatusFlags(PRInt32 *aProgressStateFlags)
|
||||
{
|
||||
*aProgressStateFlags = mProgressStateFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocLoaderImpl::GetCurSelfProgress(PRInt32 *aCurSelfProgress)
|
||||
nsresult nsDocLoaderImpl::GetCurSelfProgress(PRInt32 *aCurSelfProgress)
|
||||
{
|
||||
*aCurSelfProgress = mCurrentSelfProgress;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDocLoaderImpl::GetMaxSelfProgress(PRInt32 *aMaxSelfProgress)
|
||||
nsresult nsDocLoaderImpl::GetMaxSelfProgress(PRInt32 *aMaxSelfProgress)
|
||||
{
|
||||
*aMaxSelfProgress = mMaxSelfProgress;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDocLoaderImpl::GetCurTotalProgress(PRInt32 *aCurTotalProgress)
|
||||
nsresult nsDocLoaderImpl::GetCurTotalProgress(PRInt32 *aCurTotalProgress)
|
||||
{
|
||||
*aCurTotalProgress = mCurrentTotalProgress;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocLoaderImpl::GetMaxTotalProgress(PRInt32 *aMaxTotalProgress)
|
||||
nsresult nsDocLoaderImpl::GetMaxTotalProgress(PRInt32 *aMaxTotalProgress)
|
||||
{
|
||||
PRUint32 count = 0;
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -1000,8 +998,8 @@ NS_IMETHODIMP nsDocLoaderImpl::GetMaxTotalProgress(PRInt32 *aMaxTotalProgress)
|
|||
docloader = getter_AddRefs(mChildList->ElementAt(i));
|
||||
if (docloader)
|
||||
{
|
||||
webProgress = do_QueryInterface(docloader);
|
||||
webProgress->GetMaxTotalProgress(&invididualProgress);
|
||||
// Cast is safe since all children are nsDocLoaderImpl too
|
||||
((nsDocLoaderImpl *) docloader.get())->GetMaxTotalProgress(&invididualProgress);
|
||||
}
|
||||
if (invididualProgress < 0) // if one of the elements doesn't know it's size
|
||||
// then none of them do
|
||||
|
@ -1017,8 +1015,6 @@ NS_IMETHODIMP nsDocLoaderImpl::GetMaxTotalProgress(PRInt32 *aMaxTotalProgress)
|
|||
} else {
|
||||
*aMaxTotalProgress = -1;
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1054,19 +1050,19 @@ NS_IMETHODIMP nsDocLoaderImpl::OnProgress(nsIChannel* aChannel, nsISupports* ctx
|
|||
info->mMaxProgress = -1;
|
||||
}
|
||||
|
||||
// Send a flag_transferring notification for the request.
|
||||
// Send a STATE_TRANSFERRING notification for the request.
|
||||
PRInt32 flags;
|
||||
|
||||
flags = nsIWebProgressListener::flag_transferring |
|
||||
nsIWebProgressListener::flag_is_request;
|
||||
flags = nsIWebProgressListener::STATE_TRANSFERRING |
|
||||
nsIWebProgressListener::STATE_IS_REQUEST;
|
||||
//
|
||||
// Move the WebProgress into the flag_transferring state if necessary...
|
||||
// Move the WebProgress into the STATE_TRANSFERRING state if necessary...
|
||||
//
|
||||
if (mProgressStateFlags & nsIWebProgressListener::flag_start) {
|
||||
mProgressStateFlags = nsIWebProgressListener::flag_transferring;
|
||||
if (mProgressStateFlags & nsIWebProgressListener::STATE_START) {
|
||||
mProgressStateFlags = nsIWebProgressListener::STATE_TRANSFERRING;
|
||||
|
||||
// Send flag_transferring for the document too...
|
||||
flags |= nsIWebProgressListener::flag_is_document;
|
||||
// Send STATE_TRANSFERRING for the document too...
|
||||
flags |= nsIWebProgressListener::STATE_IS_DOCUMENT;
|
||||
}
|
||||
|
||||
FireOnStateChange(this, aChannel, flags, NS_OK);
|
||||
|
@ -1129,7 +1125,7 @@ void nsDocLoaderImpl::ClearInternalProgress()
|
|||
mCurrentSelfProgress = mMaxSelfProgress = 0;
|
||||
mCurrentTotalProgress = mMaxTotalProgress = 0;
|
||||
|
||||
mProgressStateFlags = nsIWebProgressListener::flag_stop;
|
||||
mProgressStateFlags = nsIWebProgressListener::STATE_STOP;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1202,16 +1198,16 @@ void nsDocLoaderImpl::FireOnStateChange(nsIWebProgress *aProgress,
|
|||
PRInt32 count;
|
||||
|
||||
//
|
||||
// Remove the flag_is_network bit if necessary.
|
||||
// Remove the STATE_IS_NETWORK bit if necessary.
|
||||
//
|
||||
// The rule is to remove this bit, if the notification has been passed
|
||||
// up from a child WebProgress, and the current WebProgress is already
|
||||
// active...
|
||||
//
|
||||
if (mIsLoadingDocument &&
|
||||
(aStateFlags & nsIWebProgressListener::flag_is_network) &&
|
||||
(aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) &&
|
||||
(this != aProgress)) {
|
||||
aStateFlags &= ~nsIWebProgressListener::flag_is_network;
|
||||
aStateFlags &= ~nsIWebProgressListener::STATE_IS_NETWORK;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
|
|
@ -162,6 +162,12 @@ protected:
|
|||
nsVoidArray mChannelInfoList;
|
||||
|
||||
private:
|
||||
nsresult GetProgressStatusFlags(PRInt32* aProgressStatusFlags);
|
||||
nsresult GetCurSelfProgress(PRInt32* aCurSelfProgress);
|
||||
nsresult GetMaxSelfProgress(PRInt32* aMaxSelfProgress);
|
||||
nsresult GetCurTotalProgress(PRInt32* aCurTotalProgress);
|
||||
nsresult GetMaxTotalProgress(PRInt32* aMaxTotalProgress);
|
||||
|
||||
nsresult AddChannelInfo(nsIChannel *aChannel);
|
||||
nsChannelInfo *GetChannelInfo(nsIChannel *aChannel);
|
||||
nsresult ClearChannelInfoList(void);
|
||||
|
|
|
@ -32,57 +32,6 @@ interface nsIWebProgressListener;
|
|||
[scriptable, uuid(570F39D0-EFD0-11d3-B093-00A024FFC08C)]
|
||||
interface nsIWebProgress : nsISupports
|
||||
{
|
||||
/*
|
||||
Progress Status Flags. These flags show transition.
|
||||
|
||||
Bit Layout:
|
||||
|31-22|21-20|19-12|11-0|
|
||||
|
||||
|11-0| - Network Transitions
|
||||
|19-12| - Network Stop Reasons
|
||||
|21-20| - Window Activity Transitions
|
||||
|31-22| - Available
|
||||
*/
|
||||
|
||||
/* Network Transitions bits |11-0|
|
||||
flag_net_start - network activity is starting
|
||||
flag_net_stop - network activity has stopped (this may include a stop
|
||||
reason which would have the stop reasons bits set)
|
||||
flag_net_dns - Looking up requested host.
|
||||
flag_net_connecting - Connecting to requested host.
|
||||
flag_net_redirecting - Connection is being redirected.
|
||||
flag_net_negotiating - Negotiating connection to the server
|
||||
(Authentication/ Authorization).
|
||||
flag_net_transferring - Transferring data from host.
|
||||
*/
|
||||
const long flag_net_start = 0x00000001;
|
||||
const long flag_net_stop = 0x00000002;
|
||||
const long flag_net_dns = 0x00000004;
|
||||
const long flag_net_connecting = 0x00000008;
|
||||
const long flag_net_redirecting = 0x00000010;
|
||||
const long flag_net_negotiating = 0x00000020;
|
||||
const long flag_net_transferring = 0x00000040;
|
||||
|
||||
/* Network Stop Reasons bits |19-12|
|
||||
flag_net_failedDNS - DNS lookup failed.
|
||||
flag_net_failedConnect - Connecting to server failed.
|
||||
flag_net_failedTransfer - Transfer failed.
|
||||
flag_net_failedTimeout - connection timed out
|
||||
flag_net_userCancelled - User cancelled load.
|
||||
*/
|
||||
const long flag_net_failedDNS = 0x00001000;
|
||||
const long flag_net_failedConnect = 0x00002000;
|
||||
const long flag_net_failedTransfer = 0x00004000;
|
||||
const long flag_net_failedTimeout = 0x00008000;
|
||||
const long flag_net_userCancelled = 0x00010000;
|
||||
|
||||
/* Window Activity bits |21-20|
|
||||
flag_win_start - window activity is starting
|
||||
flag_win_stop - window activity is stoping
|
||||
*/
|
||||
const long flag_win_start = 0x00100000;
|
||||
const long flag_win_stop = 0x00200000;
|
||||
|
||||
/*
|
||||
Registers a listener to be notified of Progress Events
|
||||
|
||||
|
@ -106,38 +55,4 @@ interface nsIWebProgress : nsISupports
|
|||
to a previously registered listener.
|
||||
*/
|
||||
void removeProgressListener(in nsIWebProgressListener listener);
|
||||
|
||||
/*
|
||||
Current progress Status of the browser. This will be a combination of the
|
||||
progress status flags.
|
||||
*/
|
||||
readonly attribute long progressStatusFlags;
|
||||
|
||||
/*
|
||||
The current position of progress. This is between 0 and maxSelfProgress.
|
||||
This is the position of only this progress object. It doesn not include
|
||||
the progress of all children.
|
||||
*/
|
||||
readonly attribute long curSelfProgress;
|
||||
|
||||
/*
|
||||
The maximum position that progress will go to. This sets a relative
|
||||
position point for the current progress to relate to. This is the max
|
||||
position of only this progress object. It does not include the progress of
|
||||
all the children.
|
||||
*/
|
||||
readonly attribute long maxSelfProgress;
|
||||
|
||||
/*
|
||||
The current position of progress for this object and all children added
|
||||
together. This is between 0 and maxTotalProgress.
|
||||
*/
|
||||
readonly attribute long curTotalProgress;
|
||||
|
||||
/*
|
||||
The maximum position that progress will go to for the max of this progress
|
||||
object and all children. This sets the relative position point for the
|
||||
current progress to relate to.
|
||||
*/
|
||||
readonly attribute long maxTotalProgress;
|
||||
};
|
||||
|
|
|
@ -40,21 +40,22 @@ interface nsIWebProgressListener : nsISupports
|
|||
* These flags indicate the various states that documents and requests
|
||||
* may transition through as they are being loaded.
|
||||
*/
|
||||
const long flag_start = 0x00000001;
|
||||
const long flag_redirecting = 0x00000002;
|
||||
const long flag_transferring = 0x00000004;
|
||||
const long flag_negotiating = 0x00000008;
|
||||
const long flag_stop = 0x00000010;
|
||||
const unsigned long STATE_START = 0x00000001;
|
||||
const unsigned long STATE_REDIRECTING = 0x00000002;
|
||||
const unsigned long STATE_TRANSFERRING = 0x00000004;
|
||||
const unsigned long STATE_NEGOTIATING = 0x00000008;
|
||||
const unsigned long STATE_STOP = 0x00000010;
|
||||
|
||||
/**
|
||||
* Progress type bits.
|
||||
* These flags indicate whether the transition is occuring on a document
|
||||
* or an individual request within the document.
|
||||
*/
|
||||
const long flag_is_request = 0x00010000;
|
||||
const long flag_is_document = 0x00020000;
|
||||
const long flag_is_network = 0x00040000;
|
||||
const long flag_is_window = 0x00080000;
|
||||
const unsigned long STATE_IS_REQUEST = 0x00010000;
|
||||
const unsigned long STATE_IS_DOCUMENT = 0x00020000;
|
||||
const unsigned long STATE_IS_NETWORK = 0x00040000;
|
||||
const unsigned long STATE_IS_WINDOW = 0x00080000;
|
||||
|
||||
/**
|
||||
* Notification indicating the state has changed for one of the requests
|
||||
* associated with the document loaded.
|
||||
|
@ -70,7 +71,7 @@ interface nsIWebProgressListener : nsISupports
|
|||
*/
|
||||
void onStateChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in long aStateFlags,
|
||||
in long aStateFlags, // XXX TODO unsigned long
|
||||
in unsigned long aStatus);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1421,10 +1421,11 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
nsCOMPtr<nsIBaseWindow> webBrowserWin(do_QueryInterface(mWebBrowser));
|
||||
rv = webBrowserWin->InitWindow(mWindow->GetNativeData(NS_NATIVE_WIDGET), nsnull, r.x, r.y, r.width, r.height);
|
||||
NS_ENSURE_SUCCESS(EnsureWebBrowserChrome(), NS_ERROR_FAILURE);
|
||||
mWebBrowser->SetTopLevelWindow(mWebBrowserChrome);
|
||||
mWebBrowser->SetContainerWindow(mWebBrowserChrome);
|
||||
|
||||
webBrowserWin->Create();
|
||||
mWebBrowser->GetDocShell(&mDocShell);
|
||||
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mWebBrowser);
|
||||
mDocShell = docShell;
|
||||
mDocShell->SetAllowPlugins(aAllowPlugins);
|
||||
nsCOMPtr<nsIDocumentLoader> docLoader;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
|
@ -1436,7 +1437,7 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
}
|
||||
webBrowserWin->SetVisibility(PR_TRUE);
|
||||
|
||||
if (nsIWebBrowserChrome::menuBarOn & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_MENUBAR & aChromeMask) {
|
||||
rv = CreateMenuBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1445,14 +1446,14 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
r.x = r.y = 0;
|
||||
}
|
||||
|
||||
if (nsIWebBrowserChrome::toolBarOn & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_TOOLBAR & aChromeMask) {
|
||||
rv = CreateToolBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (nsIWebBrowserChrome::statusBarOn & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_STATUSBAR & aChromeMask) {
|
||||
rv = CreateStatusBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1514,7 +1515,7 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
docLoader->AddObserver(this);
|
||||
}
|
||||
|
||||
if (nsIWebBrowserChrome::menuBarOn & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_MENUBAR & aChromeMask) {
|
||||
rv = CreateMenuBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1523,14 +1524,14 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
r.x = r.y = 0;
|
||||
}
|
||||
|
||||
if (nsIWebBrowserChrome::toolBarOn & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_TOOLBAR & aChromeMask) {
|
||||
rv = CreateToolBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (nsIWebBrowserChrome::statusBarOn & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_STATUSBAR & aChromeMask) {
|
||||
rv = CreateStatusBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1758,7 +1759,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
|
|||
nsRect rr(0, 0, aWidth, aHeight);
|
||||
|
||||
// position location bar (it's stretchy)
|
||||
if (nsIWebBrowserChrome::toolBarOn & mChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_TOOLBAR & mChromeMask) {
|
||||
nsIWidget* locationWidget = nsnull;
|
||||
if (mLocation &&
|
||||
NS_SUCCEEDED(mLocation->QueryInterface(kIWidgetIID,
|
||||
|
@ -1825,7 +1826,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
|
|||
nsIWidget* statusWidget = nsnull;
|
||||
|
||||
if (mStatus && NS_OK == mStatus->QueryInterface(kIWidgetIID,(void**)&statusWidget)) {
|
||||
if (mChromeMask & nsIWebBrowserChrome::statusBarOn) {
|
||||
if (mChromeMask & nsIWebBrowserChrome::CHROME_STATUSBAR) {
|
||||
statusWidget->Resize(0, aHeight - txtHeight,
|
||||
aWidth, txtHeight,
|
||||
PR_TRUE);
|
||||
|
@ -1842,7 +1843,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
|
|||
|
||||
// inset the web widget
|
||||
|
||||
if (nsIWebBrowserChrome::toolBarOn & mChromeMask) {
|
||||
if (nsIWebBrowserChrome::CHROME_TOOLBAR & mChromeMask) {
|
||||
rr.height -= BUTTON_HEIGHT;
|
||||
rr.y += BUTTON_HEIGHT;
|
||||
}
|
||||
|
@ -2443,7 +2444,7 @@ nsBrowserWindow::ShowPrintPreview(PRInt32 aID)
|
|||
nsBrowserWindow* bw = new nsNativeBrowserWindow;
|
||||
bw->SetApp(mApp);
|
||||
bw->Init(mAppShell, nsRect(0, 0, 600, 400),
|
||||
nsIWebBrowserChrome::menuBarOn, PR_TRUE, docv, printContext);
|
||||
nsIWebBrowserChrome::CHROME_MENUBAR, PR_TRUE, docv, printContext);
|
||||
bw->SetVisibility(PR_TRUE);
|
||||
|
||||
NS_RELEASE(printContext);
|
||||
|
|
|
@ -80,30 +80,21 @@ NS_IMETHODIMP nsWebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstan
|
|||
//*****************************************************************************
|
||||
// nsWebBrowserChrome::nsIWebBrowserChrome
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetJSStatus(const PRUnichar* aStatus)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetStatus(PRUint32 aStatusType, const PRUnichar* aStatus)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow->mStatus);
|
||||
|
||||
PRUint32 size;
|
||||
mBrowserWindow->mStatus->SetText(nsAutoString(aStatus), size);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetJSDefaultStatus(const PRUnichar* aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetOverLink(const PRUnichar* aLink)
|
||||
{
|
||||
if(!mBrowserWindow->mStatus)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 size;
|
||||
mBrowserWindow->mStatus->SetText(nsAutoString(aLink), size);
|
||||
|
||||
switch (aStatusType)
|
||||
{
|
||||
case STATUS_SCRIPT:
|
||||
case STATUS_LINK:
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow->mStatus);
|
||||
PRUint32 size;
|
||||
mBrowserWindow->mStatus->SetText(nsAutoString(aStatus), size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -119,19 +110,19 @@ NS_IMETHODIMP nsWebBrowserChrome::GetWebBrowser(nsIWebBrowser** aWebBrowser)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetChromeMask(PRUint32 aChromeMask)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetChromeFlags(PRUint32 aChromeFlags)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetChromeMask(PRUint32* aChromeMask)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetChromeFlags(PRUint32* aChromeFlags)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetNewBrowser(PRUint32 aChromeMask,
|
||||
NS_IMETHODIMP nsWebBrowserChrome::CreateBrowserWindow(PRUint32 aChromeMask,
|
||||
nsIWebBrowser** aWebBrowser)
|
||||
{
|
||||
if(mBrowserWindow->mWebCrawler && (mBrowserWindow->mWebCrawler->Crawling() ||
|
||||
|
@ -402,18 +393,18 @@ nsWebBrowserChrome::OnStateChange(nsIWebProgress* aProgress,
|
|||
PRInt32 aProgressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
if (aProgressStateFlags & flag_start) {
|
||||
if (aProgressStateFlags & flag_is_network) {
|
||||
if (aProgressStateFlags & STATE_START) {
|
||||
if (aProgressStateFlags & STATE_IS_NETWORK) {
|
||||
OnWindowActivityStart();
|
||||
OnLoadStart(aRequest);
|
||||
}
|
||||
if (aProgressStateFlags & flag_is_request) {
|
||||
if (aProgressStateFlags & STATE_IS_REQUEST) {
|
||||
mTotal += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (aProgressStateFlags & flag_stop) {
|
||||
if (aProgressStateFlags & flag_is_request) {
|
||||
if (aProgressStateFlags & STATE_STOP) {
|
||||
if (aProgressStateFlags & STATE_IS_REQUEST) {
|
||||
mCurrent += 1;
|
||||
|
||||
if(mBrowserWindow->mStatus) {
|
||||
|
@ -434,13 +425,13 @@ nsWebBrowserChrome::OnStateChange(nsIWebProgress* aProgress,
|
|||
}
|
||||
}
|
||||
|
||||
if (aProgressStateFlags & flag_is_network) {
|
||||
if (aProgressStateFlags & STATE_IS_NETWORK) {
|
||||
OnLoadFinished(aRequest, aProgressStateFlags);
|
||||
OnWindowActivityFinished();
|
||||
}
|
||||
}
|
||||
|
||||
if (aProgressStateFlags & flag_transferring) {
|
||||
if (aProgressStateFlags & STATE_TRANSFERRING) {
|
||||
OnStatusTransferring(aRequest);
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ nsAppShellService::CreateHiddenWindow()
|
|||
PRInt32 initialHeight = 0, initialWidth = 0;
|
||||
#else
|
||||
const char* hiddenWindowURL = "about:blank";
|
||||
PRUint32 chromeMask = nsIWebBrowserChrome::allChrome;
|
||||
PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL;
|
||||
PRInt32 initialHeight = 100, initialWidth = 100;
|
||||
#endif
|
||||
|
||||
|
@ -548,24 +548,24 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
|||
else {
|
||||
nsWidgetInitData widgetInitData;
|
||||
|
||||
widgetInitData.mWindowType = aChromeMask & nsIWebBrowserChrome::openAsDialog ?
|
||||
widgetInitData.mWindowType = aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG ?
|
||||
eWindowType_dialog : eWindowType_toplevel;
|
||||
|
||||
// note default chrome overrides other OS chrome settings, but
|
||||
// not internal chrome
|
||||
if (aChromeMask & nsIWebBrowserChrome::defaultChrome)
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_DEFAULT)
|
||||
widgetInitData.mBorderStyle = eBorderStyle_default;
|
||||
else if ((aChromeMask & nsIWebBrowserChrome::allChrome) == nsIWebBrowserChrome::allChrome)
|
||||
else if ((aChromeMask & nsIWebBrowserChrome::CHROME_ALL) == nsIWebBrowserChrome::CHROME_ALL)
|
||||
widgetInitData.mBorderStyle = eBorderStyle_all;
|
||||
else {
|
||||
widgetInitData.mBorderStyle = eBorderStyle_none; // assumes none == 0x00
|
||||
if (aChromeMask & nsIWebBrowserChrome::windowBordersOn)
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_BORDERS)
|
||||
widgetInitData.mBorderStyle = NS_STATIC_CAST(enum nsBorderStyle, widgetInitData.mBorderStyle | eBorderStyle_border);
|
||||
if (aChromeMask & nsIWebBrowserChrome::titlebarOn)
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_TITLEBAR)
|
||||
widgetInitData.mBorderStyle = NS_STATIC_CAST(enum nsBorderStyle, widgetInitData.mBorderStyle | eBorderStyle_title);
|
||||
if (aChromeMask & nsIWebBrowserChrome::windowCloseOn)
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_CLOSE)
|
||||
widgetInitData.mBorderStyle = NS_STATIC_CAST(enum nsBorderStyle, widgetInitData.mBorderStyle | eBorderStyle_close);
|
||||
if (aChromeMask & nsIWebBrowserChrome::windowResizeOn) {
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
|
||||
widgetInitData.mBorderStyle = NS_STATIC_CAST(enum nsBorderStyle, widgetInitData.mBorderStyle | eBorderStyle_resizeh);
|
||||
/* Associate the resize flag with min/max buttons and system menu.
|
||||
but not for dialogs. This is logic better associated with the
|
||||
|
@ -573,18 +573,18 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
|||
eBorderStyle_default style. But since I know of no platform
|
||||
that wants min/max buttons on dialogs, it works here, too.
|
||||
If you have such a platform, this is where the fun starts: */
|
||||
if (!(aChromeMask & nsIWebBrowserChrome::openAsDialog))
|
||||
if (!(aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG))
|
||||
widgetInitData.mBorderStyle = NS_STATIC_CAST(enum nsBorderStyle, widgetInitData.mBorderStyle | eBorderStyle_minimize | eBorderStyle_maximize | eBorderStyle_menu);
|
||||
}
|
||||
}
|
||||
|
||||
if (aChromeMask & nsIWebBrowserChrome::scrollbarsOn)
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_SCROLLBARS)
|
||||
contentScrollbars = PR_TRUE;
|
||||
|
||||
zlevel = nsIXULWindow::normalZ;
|
||||
if (aChromeMask & nsIWebBrowserChrome::windowRaised)
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RAISED)
|
||||
zlevel = nsIXULWindow::raisedZ;
|
||||
else if (aChromeMask & nsIWebBrowserChrome::windowLowered)
|
||||
else if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_LOWERED)
|
||||
zlevel = nsIXULWindow::loweredZ;
|
||||
#ifdef XP_MAC
|
||||
/* Platforms on which modal windows are always application-modal, not
|
||||
|
@ -596,7 +596,7 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
|||
but the Mac, right?) know how to stack dependent windows. On these
|
||||
platforms, give the dependent window the same level as its parent,
|
||||
so we won't try to override the normal platform behaviour. */
|
||||
if ((aChromeMask & nsIWebBrowserChrome::dependent) && aParent)
|
||||
if ((aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT) && aParent)
|
||||
aParent->GetZlevel(&zlevel);
|
||||
#endif
|
||||
|
||||
|
@ -629,7 +629,7 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
|||
|
||||
}
|
||||
|
||||
if (aChromeMask & nsIWebBrowserChrome::centerScreen)
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_CENTER_SCREEN)
|
||||
window->Center(nsnull, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
|
|||
|
||||
nsContentTreeOwner::nsContentTreeOwner(PRBool fPrimary) : mXULWindow(nsnull),
|
||||
mPrimary(fPrimary), mContentTitleSetting(PR_FALSE),
|
||||
mChromeMask(nsIWebBrowserChrome::allChrome)
|
||||
mChromeFlags(nsIWebBrowserChrome::CHROME_ALL)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
@ -198,25 +198,7 @@ NS_IMETHODIMP nsContentTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
|
|||
// nsContentTreeOwner::nsIWebBrowserChrome
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetJSStatus(const PRUnichar* aStatus)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
mXULWindow->GetWindowDOMWindow(getter_AddRefs(domWindow));
|
||||
nsCOMPtr<nsPIDOMWindow> piDOMWindow(do_QueryInterface(domWindow));
|
||||
if(!piDOMWindow)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsISupports> xpConnectObj;
|
||||
nsAutoString xulBrowserWinId; xulBrowserWinId.AssignWithConversion("XULBrowserWindow");
|
||||
piDOMWindow->GetObjectProperty(xulBrowserWinId.GetUnicode(), getter_AddRefs(xpConnectObj));
|
||||
|
||||
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow(do_QueryInterface(xpConnectObj));
|
||||
if(xulBrowserWindow)
|
||||
xulBrowserWindow->SetJSStatus(aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetJSDefaultStatus(const PRUnichar* aStatus)
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetStatus(PRUint32 aStatusType, const PRUnichar* aStatus)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
mXULWindow->GetWindowDOMWindow(getter_AddRefs(domWindow));
|
||||
|
@ -229,26 +211,22 @@ NS_IMETHODIMP nsContentTreeOwner::SetJSDefaultStatus(const PRUnichar* aStatus)
|
|||
piDOMWindow->GetObjectProperty(xulBrowserWinId.GetUnicode(), getter_AddRefs(xpConnectObj));
|
||||
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow(do_QueryInterface(xpConnectObj));
|
||||
|
||||
if(xulBrowserWindow)
|
||||
xulBrowserWindow->SetJSDefaultStatus(aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
if (xulBrowserWindow)
|
||||
{
|
||||
switch(aStatusType)
|
||||
{
|
||||
case STATUS_SCRIPT:
|
||||
xulBrowserWindow->SetJSStatus(aStatus);
|
||||
break;
|
||||
case STATUS_SCRIPT_DEFAULT:
|
||||
xulBrowserWindow->SetJSDefaultStatus(aStatus);
|
||||
break;
|
||||
case STATUS_LINK:
|
||||
xulBrowserWindow->SetOverLink(aStatus);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetOverLink(const PRUnichar* aLink)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
mXULWindow->GetWindowDOMWindow(getter_AddRefs(domWindow));
|
||||
nsCOMPtr<nsPIDOMWindow> piDOMWindow(do_QueryInterface(domWindow));
|
||||
if(!piDOMWindow)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsISupports> xpConnectObj;
|
||||
nsAutoString xulBrowserWinId; xulBrowserWinId.AssignWithConversion("XULBrowserWindow");
|
||||
piDOMWindow->GetObjectProperty(xulBrowserWinId.GetUnicode(), getter_AddRefs(xpConnectObj));
|
||||
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow(do_QueryInterface(xpConnectObj));
|
||||
|
||||
if(xulBrowserWindow)
|
||||
xulBrowserWindow->SetOverLink(aLink);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -264,23 +242,23 @@ NS_IMETHODIMP nsContentTreeOwner::GetWebBrowser(nsIWebBrowser** aWebBrowser)
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetChromeMask(PRUint32 aChromeMask)
|
||||
NS_IMETHODIMP nsContentTreeOwner::SetChromeFlags(PRUint32 aChromeFlags)
|
||||
{
|
||||
mChromeMask = aChromeMask;
|
||||
NS_ENSURE_SUCCESS(ApplyChromeMask(), NS_ERROR_FAILURE);
|
||||
mChromeFlags = aChromeFlags;
|
||||
NS_ENSURE_SUCCESS(ApplyChromeFlags(), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::GetChromeMask(PRUint32* aChromeMask)
|
||||
NS_IMETHODIMP nsContentTreeOwner::GetChromeFlags(PRUint32* aChromeFlags)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChromeMask);
|
||||
NS_ENSURE_ARG_POINTER(aChromeFlags);
|
||||
|
||||
*aChromeMask = mChromeMask;
|
||||
*aChromeFlags = mChromeFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::GetNewBrowser(PRUint32 aChromeFlags,
|
||||
NS_IMETHODIMP nsContentTreeOwner::CreateBrowserWindow(PRUint32 aChromeFlags,
|
||||
nsIWebBrowser** aWebBrowser)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
|
@ -567,7 +545,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle)
|
|||
// nsContentTreeOwner: Helpers
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsContentTreeOwner::ApplyChromeMask()
|
||||
NS_IMETHODIMP nsContentTreeOwner::ApplyChromeFlags()
|
||||
{
|
||||
if(!mXULWindow->mChromeLoaded)
|
||||
return NS_OK; // We'll do this later when chrome is loaded
|
||||
|
@ -576,8 +554,8 @@ NS_IMETHODIMP nsContentTreeOwner::ApplyChromeMask()
|
|||
mXULWindow->GetWindowDOMElement(getter_AddRefs(window));
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
mXULWindow->mWindow->ShowMenuBar(mChromeMask &
|
||||
nsIWebBrowserChrome::menuBarOn ?
|
||||
mXULWindow->mWindow->ShowMenuBar(mChromeFlags &
|
||||
nsIWebBrowserChrome::CHROME_MENUBAR ?
|
||||
PR_TRUE : PR_FALSE);
|
||||
|
||||
// Construct the new value for the 'chromehidden' attribute that
|
||||
|
@ -586,22 +564,22 @@ NS_IMETHODIMP nsContentTreeOwner::ApplyChromeMask()
|
|||
// 'chromehidden' attribute of the <window> tag.
|
||||
nsAutoString newvalue;
|
||||
|
||||
if (! (mChromeMask & nsIWebBrowserChrome::menuBarOn)) {
|
||||
if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_MENUBAR)) {
|
||||
newvalue.AppendWithConversion("menubar ");
|
||||
}
|
||||
if (! (mChromeMask & nsIWebBrowserChrome::toolBarOn)) {
|
||||
if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_TOOLBAR)) {
|
||||
newvalue.AppendWithConversion("toolbar ");
|
||||
}
|
||||
if (! (mChromeMask & nsIWebBrowserChrome::locationBarOn)) {
|
||||
if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_LOCATIONBAR)) {
|
||||
newvalue.AppendWithConversion("location ");
|
||||
}
|
||||
if (! (mChromeMask & nsIWebBrowserChrome::personalToolBarOn)) {
|
||||
if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR)) {
|
||||
newvalue.AppendWithConversion("directories ");
|
||||
}
|
||||
if (! (mChromeMask & nsIWebBrowserChrome::statusBarOn)) {
|
||||
if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_STATUSBAR)) {
|
||||
newvalue.AppendWithConversion("status ");
|
||||
}
|
||||
if (! (mChromeMask & nsIWebBrowserChrome::extraChromeOn)) {
|
||||
if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_EXTRA)) {
|
||||
newvalue.AppendWithConversion("extrachrome");
|
||||
}
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ protected:
|
|||
void XULWindow(nsXULWindow* aXULWindow);
|
||||
nsXULWindow* XULWindow();
|
||||
|
||||
NS_IMETHOD ApplyChromeMask();
|
||||
NS_IMETHOD ApplyChromeFlags();
|
||||
|
||||
protected:
|
||||
nsXULWindow* mXULWindow;
|
||||
PRBool mPrimary;
|
||||
PRBool mContentTitleSetting;
|
||||
PRUint32 mChromeMask;
|
||||
PRUint32 mChromeFlags;
|
||||
nsString mWindowTitleModifier;
|
||||
nsString mTitleSeparator;
|
||||
nsString mTitlePreface;
|
||||
|
|
|
@ -462,7 +462,7 @@ void nsSpecialFileSpec::operator = (Type aType)
|
|||
break;
|
||||
case App_ChromeDirectory:
|
||||
{
|
||||
*this = nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
*this = nsSpecialSystemDirectory(nsSpecialSystemDirectory::Moz_BinDirectory);
|
||||
#ifdef XP_MAC
|
||||
*this += "Chrome";
|
||||
#else
|
||||
|
|
|
@ -630,7 +630,7 @@ void nsXULWindow::OnChromeLoaded()
|
|||
mChromeLoaded = PR_TRUE;
|
||||
|
||||
if(mContentTreeOwner)
|
||||
mContentTreeOwner->ApplyChromeMask();
|
||||
mContentTreeOwner->ApplyChromeFlags();
|
||||
|
||||
LoadTitleFromXUL();
|
||||
LoadPositionAndSizeFromXUL(PR_TRUE, PR_TRUE);
|
||||
|
@ -981,7 +981,7 @@ NS_IMETHODIMP nsXULWindow::GetNewWindow(PRInt32 aChromeFlags,
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocShellTreeItem);
|
||||
|
||||
if(aChromeFlags & nsIWebBrowserChrome::openAsChrome)
|
||||
if(aChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)
|
||||
return CreateNewChromeWindow(aChromeFlags, aDocShellTreeItem);
|
||||
else
|
||||
return CreateNewContentWindow(aChromeFlags, aDocShellTreeItem);
|
||||
|
@ -998,7 +998,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewChromeWindow(PRInt32 aChromeFlags,
|
|||
// Just do a normal create of a window and return.
|
||||
//XXXTAB remove this when appshell talks in terms of nsIXULWindow
|
||||
nsCOMPtr<nsIXULWindow> parent;
|
||||
if(aChromeFlags & nsIWebBrowserChrome::dependent)
|
||||
if(aChromeFlags & nsIWebBrowserChrome::CHROME_DEPENDENT)
|
||||
parent = this;
|
||||
|
||||
nsCOMPtr<nsIXULWindow> newWindow;
|
||||
|
@ -1011,7 +1011,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewChromeWindow(PRInt32 aChromeFlags,
|
|||
// XXX Ick, this should be able to go away.....
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(newWindow));
|
||||
if(browserChrome)
|
||||
browserChrome->SetChromeMask(aChromeFlags);
|
||||
browserChrome->SetChromeFlags(aChromeFlags);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
newWindow->GetDocShell(getter_AddRefs(docShell));
|
||||
|
@ -1072,7 +1072,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(PRInt32 aChromeFlags,
|
|||
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(newWindow));
|
||||
if(browserChrome)
|
||||
browserChrome->SetChromeMask(aChromeFlags);
|
||||
browserChrome->SetChromeFlags(aChromeFlags);
|
||||
|
||||
nsCOMPtr<nsIAppShell> subShell(do_CreateInstance(kAppShellCID));
|
||||
NS_ENSURE_TRUE(subShell, NS_ERROR_FAILURE);
|
||||
|
|
|
@ -266,7 +266,7 @@ static nsresult OpenChromeURL( const char * urlstr, PRInt32 height = NS_SIZETOCO
|
|||
|
||||
nsCOMPtr<nsIXULWindow> newWindow;
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, url,
|
||||
PR_TRUE, PR_TRUE, nsIWebBrowserChrome::allChrome,
|
||||
PR_TRUE, PR_TRUE, nsIWebBrowserChrome::CHROME_ALL,
|
||||
width, height,
|
||||
getter_AddRefs(newWindow));
|
||||
return rv;
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
#include "nsIClipboardCommands.h"
|
||||
#include "pratom.h"
|
||||
#include "prprf.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -57,6 +56,8 @@
|
|||
#include "nsIDOMWindow.h"
|
||||
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIContentViewerEdit.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShellWindow.h"
|
||||
|
@ -1362,26 +1363,26 @@ nsBrowserInstance::Close()
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::Copy()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
GetContentAreaDocShell()->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
presShell->DoCopy();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
{
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
GetContentAreaDocShell()->GetContentViewer(getter_AddRefs(viewer));
|
||||
nsCOMPtr<nsIContentViewerEdit> edit(do_QueryInterface(viewer));
|
||||
if (edit) {
|
||||
edit->CopySelection();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::SelectAll()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIClipboardCommands> clip(do_QueryInterface(GetContentAreaDocShell(),&rv));
|
||||
if ( NS_SUCCEEDED(rv) ) {
|
||||
rv = clip->SelectAll();
|
||||
}
|
||||
|
||||
return rv;
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
GetContentAreaDocShell()->GetContentViewer(getter_AddRefs(viewer));
|
||||
nsCOMPtr<nsIContentViewerEdit> edit(do_QueryInterface(viewer));
|
||||
if (edit) {
|
||||
edit->SelectAll();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -375,15 +375,6 @@ nsSHistory::Stop()
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHistory::SetDocument(nsIDOMDocument* aDocument,
|
||||
const PRUnichar* aContentType)
|
||||
{
|
||||
// Not implemented
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHistory::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ static nsresult DisplayURI(const char *urlStr, PRBool block)
|
|||
URL,
|
||||
PR_TRUE,
|
||||
PR_TRUE,
|
||||
nsIWebBrowserChrome::allChrome,
|
||||
nsIWebBrowserChrome::CHROME_ALL,
|
||||
NS_SIZETOCONTENT, // width
|
||||
NS_SIZETOCONTENT, // height
|
||||
getter_AddRefs(window));
|
||||
|
|
Загрузка…
Ссылка в новой задаче