Checked in api changes and some other small changes from the branch.

This commit is contained in:
scullin%netscape.com 1998-08-14 23:08:54 +00:00
parent 6686da4b00
commit 39b83242e3
14 changed files with 605 additions and 304 deletions

View File

@ -35,6 +35,7 @@
#include "nsWidgetsCID.h"
#include "nsGfxCIID.h"
#include "plevent.h"
#include "prprf.h"
#include "nsIPluginHost.h"
#include "nsplugin.h"
#include "nsPluginsCID.h"
@ -113,22 +114,22 @@ public:
// nsIWebShell
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h);
NS_IMETHOD SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Show();
NS_IMETHOD Hide();
NS_IMETHOD Repaint(PRBool aForce);
NS_IMETHOD SetContentViewer(nsIContentViewer* aViewer);
NS_IMETHOD GetContentViewer(nsIContentViewer*& aResult);
NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer);
NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult);
NS_IMETHOD SetObserver(nsIStreamObserver* anObserver);
NS_IMETHOD GetObserver(nsIStreamObserver*& aResult);
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult);
NS_IMETHOD SetPrefs(nsIPref* aPrefs);
NS_IMETHOD GetPrefs(nsIPref*& aPrefs);
NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult);
@ -137,41 +138,52 @@ public:
NS_IMETHOD GetChildCount(PRInt32& aResult);
NS_IMETHOD AddChild(nsIWebShell* aChild);
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIWebShell*& aResult);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD FindChildWithName(const nsString& aName,
NS_IMETHOD GetName(PRUnichar** aName);
NS_IMETHOD SetName(const PRUnichar* aName);
NS_IMETHOD FindChildWithName(const PRUnichar* aName,
nsIWebShell*& aResult);
NS_IMETHOD Back(void);
NS_IMETHOD Forward(void);
NS_IMETHOD Reload();
NS_IMETHOD LoadURL(const nsString& aURLSpec,
nsIPostData* aPostData=nsnull,
PRBool aModifyHistory=PR_TRUE);
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD GetTitle(nsString& aResult);
NS_IMETHOD GetMarginWidth (PRInt32& aWidth);
NS_IMETHOD SetMarginWidth (PRInt32 aWidth);
NS_IMETHOD GetMarginHeight(PRInt32& aWidth);
NS_IMETHOD SetMarginHeight(PRInt32 aHeight);
// Document load api's
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult);
NS_IMETHOD LoadURL(const PRUnichar *aURLSpec,
nsIPostData* aPostData=nsnull,
PRBool aModifyHistory=PR_TRUE);
NS_IMETHOD Stop(void);
NS_IMETHOD Reload(nsReloadType aType);
// History api's
NS_IMETHOD Back(void);
NS_IMETHOD CanBack(void);
NS_IMETHOD Forward(void);
NS_IMETHOD CanForward(void);
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult);
// Chrome api's
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus);
NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec);
// nsILinkHandler
NS_IMETHOD OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData = 0);
NS_IMETHOD OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec);
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState);
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec);
NS_IMETHOD GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState);
// nsIScriptContextOwner
NS_IMETHOD GetScriptContext(nsIScriptContext **aContext);
@ -182,13 +194,13 @@ public:
NS_IMETHOD OnConnectionsComplete();
// nsWebShell
void HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
void HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostDat = 0);
void ShowHistory();
nsIWebShell* GetTarget(const nsString& aName);
nsIWebShell* GetTarget(const PRUnichar* aName);
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
@ -452,13 +464,14 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
NS_IMETHODIMP
nsWebShell::Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling,
PRBool aAllowPlugins)
{
//XXX make sure plugins have started up. this really needs to
//be associated with the nsIContentViewerContainer interfaces,
//not the nsIWebShell interfaces. this is a hack. MMP
nsRect aBounds(x,y,w,h);
if ((PR_TRUE == aAllowPlugins) && (PR_FALSE == mPluginInited))
CreatePluginHost();
@ -559,30 +572,36 @@ nsWebShell::Destroy()
NS_IMETHODIMP
nsWebShell::GetBounds(nsRect& aResult)
nsWebShell::GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h)
{
nsRect aResult;
NS_PRECONDITION(nsnull != mWindow, "null window");
aResult.SetRect(0, 0, 0, 0);
if (nsnull != mWindow) {
mWindow->GetBounds(aResult);
}
x = aResult.x;
y = aResult.y;
w = aResult.width;
h = aResult.height;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetBounds(const nsRect& aBounds)
nsWebShell::SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
if (nsnull != mWindow) {
// Don't have the widget repaint. Layout will generate repaint requests
// during reflow
mWindow->Resize(aBounds.x, aBounds.y, aBounds.width, aBounds.height,
mWindow->Resize(x, y, w, h,
PR_FALSE);
}
if (nsnull != mContentViewer) {
nsRect rr(0, 0, aBounds.width, aBounds.height);
nsRect rr(0, 0, w, h);
mContentViewer->SetBounds(rr);
}
@ -631,6 +650,18 @@ nsWebShell::Hide()
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::Repaint(PRBool aForce)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
if (nsnull != mWindow) {
mWindow->Invalidate(aForce);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetContentViewer(nsIContentViewer* aViewer)
{
@ -690,14 +721,6 @@ nsWebShell::GetObserver(nsIStreamObserver*& aResult)
}
NS_IMETHODIMP
nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult)
{
aResult = mDocLoader;
NS_IF_ADDREF(mDocLoader);
return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsWebShell::SetPrefs(nsIPref* aPrefs)
{
@ -784,32 +807,33 @@ nsWebShell::ChildAt(PRInt32 aIndex, nsIWebShell*& aResult)
}
NS_IMETHODIMP
nsWebShell::GetName(nsString& aName)
nsWebShell::GetName(PRUnichar** aName)
{
aName = mName;
*aName = mName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetName(const nsString& aName)
nsWebShell::SetName(const PRUnichar* aName)
{
mName = aName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::FindChildWithName(const nsString& aName,
nsWebShell::FindChildWithName(const PRUnichar* aName1,
nsIWebShell*& aResult)
{
aResult = nsnull;
nsString aName(aName1);
nsAutoString childName;
PRUnichar *childName;
PRInt32 i, n = mChildren.Count();
for (i = 0; i < n; i++) {
nsIWebShell* child = (nsIWebShell*) mChildren.ElementAt(i);
if (nsnull != child) {
child->GetName(childName);
if (childName.Equals(aName)) {
child->GetName(&childName);
if (aName.Equals(childName)) {
aResult = child;
NS_ADDREF(child);
break;
@ -856,31 +880,60 @@ nsWebShell::SetMarginHeight(PRInt32 aHeight)
return NS_OK;
}
//----------------------------------------
// History methods
NS_IMETHODIMP
nsWebShell::Back(void)
/**
* Document Load methods
*/
NS_IMETHODIMP
nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult)
{
return GoTo(mHistoryIndex - 1);
aResult = mDocLoader;
NS_IF_ADDREF(mDocLoader);
return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE;
}
#define FILE_PROTOCOL "file:///"
static void convertFileToURL(nsString &aIn, nsString &aOut)
{
#ifdef XP_PC
char szFile[1000];
aIn.ToCString(szFile, sizeof(szFile));
if (PL_strchr(szFile, '\\')) {
PRInt32 len = strlen(szFile);
PRInt32 sum = len + sizeof(FILE_PROTOCOL);
char* lpszFileURL = new char[sum];
// Translate '\' to '/'
for (PRInt32 i = 0; i < len; i++) {
if (szFile[i] == '\\') {
szFile[i] = '/';
}
if (szFile[i] == ':') {
szFile[i] = '|';
}
}
// Build the file URL
PR_snprintf(lpszFileURL, sum, "%s%s", FILE_PROTOCOL, szFile);
aOut = lpszFileURL;
}
else
#endif
{
aOut = aIn;
}
}
NS_IMETHODIMP
nsWebShell::Forward(void)
{
return GoTo(mHistoryIndex + 1);
}
NS_IMETHODIMP
nsWebShell::LoadURL(const nsString& aURLSpec,
nsWebShell::LoadURL(const PRUnichar *aURLSpec,
nsIPostData* aPostData,
PRBool aModifyHistory)
{
nsresult rv;
PRInt32 colon, fSlash;
PRUnichar port;
nsAutoString urlSpec(aURLSpec);
nsAutoString urlSpec;
convertFileToURL(nsString(aURLSpec), urlSpec);
fSlash=urlSpec.Find('/');
@ -894,9 +947,10 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
nsString httpDef("http://");
urlSpec.Insert(httpDef, 0, 7);
}
// Give web-shell-container right of refusal
if (nsnull != mContainer) {
rv = mContainer->WillLoadURL(this, urlSpec);
rv = mContainer->WillLoadURL(this, urlSpec, nsLoadURL);
if (NS_OK != rv) {
return rv;
}
@ -935,12 +989,7 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
}
}
// Stop any documents that are currently being loaded...
mDocLoader->Stop();
// Cancel any timers that were set for this loader.
mDocLoader->CancelLoadURLTimer();
Stop();
rv = mDocLoader->LoadURL(urlSpec, // URL string
nsnull, // Command
@ -951,16 +1000,55 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
return rv;
}
NS_IMETHODIMP
nsWebShell::Reload()
NS_IMETHODIMP nsWebShell::Stop(void)
{
if (mDocLoader) {
// Stop any documents that are currently being loaded...
mDocLoader->Stop();
// Cancel any timers that were set for this loader.
mDocLoader->CancelLoadURLTimer();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsWebShell::Reload(nsReloadType aType)
{
nsString* s = (nsString*) mHistory.ElementAt(mHistoryIndex);
if (nsnull != s) {
// XXX What about the post data?
return LoadURL(*s, nsnull, PR_FALSE);
}
return NS_ERROR_FAILURE;
}
return NS_OK;
//----------------------------------------
// History methods
NS_IMETHODIMP
nsWebShell::Back(void)
{
return GoTo(mHistoryIndex - 1);
}
NS_IMETHODIMP
nsWebShell::CanBack(void)
{
return (mHistoryIndex > 0 ? NS_OK : NS_COMFALSE);
}
NS_IMETHODIMP
nsWebShell::Forward(void)
{
return GoTo(mHistoryIndex + 1);
}
NS_IMETHODIMP
nsWebShell::CanForward(void)
{
return (mHistoryIndex < mHistory.Count() - 1 ? NS_OK : NS_COMFALSE);
}
NS_IMETHODIMP
@ -968,13 +1056,13 @@ nsWebShell::GoTo(PRInt32 aHistoryIndex)
{
nsresult rv = NS_ERROR_ILLEGAL_VALUE;
if ((aHistoryIndex >= 0) &&
(aHistoryIndex <= mHistory.Count() - 1)) {
(aHistoryIndex < mHistory.Count())) {
nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);
// Give web-shell-container right of refusal
nsAutoString urlSpec(*s);
if (nsnull != mContainer) {
rv = mContainer->WillLoadURL(this, urlSpec);
rv = mContainer->WillLoadURL(this, urlSpec, nsLoadHistory);
if (NS_OK != rv) {
return rv;
}
@ -1016,15 +1104,14 @@ nsWebShell::GetHistoryIndex(PRInt32& aResult)
}
NS_IMETHODIMP
nsWebShell::GetURL(PRInt32 aHistoryIndex, nsString& aURLResult)
nsWebShell::GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult)
{
nsresult rv = NS_ERROR_ILLEGAL_VALUE;
if ((aHistoryIndex >= 0) &&
(aHistoryIndex <= mHistory.Count() - 1)) {
aURLResult.Truncate();
nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);
if (nsnull != s) {
aURLResult = *s;
*aURLResult = *s;
}
rv = NS_OK;
}
@ -1057,7 +1144,7 @@ nsWebShell::ShowHistory()
// Chrome API's
NS_IMETHODIMP
nsWebShell::SetTitle(const nsString& aTitle)
nsWebShell::SetTitle(const PRUnichar* aTitle)
{
// Record local title
mTitle = aTitle;
@ -1073,9 +1160,9 @@ nsWebShell::SetTitle(const nsString& aTitle)
}
NS_IMETHODIMP
nsWebShell::GetTitle(nsString& aResult)
nsWebShell::GetTitle(PRUnichar** aResult)
{
aResult = mTitle;
*aResult = mTitle;
return NS_OK;
}
@ -1084,16 +1171,16 @@ nsWebShell::GetTitle(nsString& aResult)
// WebShell container implementation
NS_IMETHODIMP
nsWebShell::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason)
{
if (nsnull != mContainer) {
return mContainer->WillLoadURL(aShell, aURL);
return mContainer->WillLoadURL(aShell, aURL, aReason);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->BeginLoadURL(aShell, aURL);
@ -1102,21 +1189,43 @@ nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsWebShell::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::ProgressLoadURL(nsIWebShell* aShell,
const PRUnichar* aURL,
PRInt32 aProgress,
PRInt32 aProgressMax)
{
if (nsnull != mContainer) {
return mContainer->EndLoadURL(aShell, aURL);
return mContainer->ProgressLoadURL(aShell, aURL, aProgress, aProgressMax);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus)
{
if (nsnull != mContainer) {
return mContainer->EndLoadURL(aShell, aURL, aStatus);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec)
{
if (nsnull != mContainer) {
return mContainer->OverLink(aShell, aURLSpec, aTargetSpec);
}
return NS_OK;
}
//----------------------------------------------------------------------
// WebShell link handling
struct OnLinkClickEvent : public PLEvent {
OnLinkClickEvent(nsWebShell* aHandler, const nsString& aURLSpec,
const nsString& aTargetSpec, nsIPostData* aPostData = 0);
OnLinkClickEvent(nsWebShell* aHandler, const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec, nsIPostData* aPostData = 0);
~OnLinkClickEvent();
void HandleEvent() {
@ -1140,8 +1249,8 @@ static void PR_CALLBACK DestroyPLEvent(OnLinkClickEvent* aEvent)
}
OnLinkClickEvent::OnLinkClickEvent(nsWebShell* aHandler,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
mHandler = aHandler;
@ -1182,8 +1291,8 @@ OnLinkClickEvent::~OnLinkClickEvent()
NS_IMETHODIMP
nsWebShell::OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
OnLinkClickEvent* ev;
@ -1202,21 +1311,22 @@ nsWebShell::OnLinkClick(nsIFrame* aFrame,
// XXX This doesn't yet know how to target other windows with their
// own tree
nsIWebShell*
nsWebShell::GetTarget(const nsString& aName)
nsWebShell::GetTarget(const PRUnichar* aName)
{
nsString name(aName);
nsIWebShell* target = nsnull;
if (aName.EqualsIgnoreCase("_blank")) {
if (name.EqualsIgnoreCase("_blank")) {
// XXX Need api in nsIWebShellContainer
NS_ASSERTION(0, "not implemented yet");
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_self")) {
else if (name.EqualsIgnoreCase("_self")) {
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_parent")) {
else if (name.EqualsIgnoreCase("_parent")) {
if (nsnull == mParent) {
target = this;
}
@ -1225,7 +1335,7 @@ nsWebShell::GetTarget(const nsString& aName)
}
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_top")) {
else if (name.EqualsIgnoreCase("_top")) {
GetRootWebShell(target);
}
else {
@ -1244,8 +1354,8 @@ nsWebShell::GetTarget(const nsString& aName)
}
void
nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
nsWebShell::HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
nsIWebShell* shell = GetTarget(aTargetSpec);
@ -1256,10 +1366,10 @@ nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
NS_IMETHODIMP
nsWebShell::OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec)
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec)
{
if (!aURLSpec.Equals(mOverURL) || !aTargetSpec.Equals(mOverTarget)) {
if (!mOverURL.Equals(aURLSpec) || !mOverTarget.Equals(aTargetSpec)) {
fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOverTarget, stdout); fputs("'\n", stdout);
fputs("Over link '", stdout);
fputs(aURLSpec, stdout);
@ -1289,20 +1399,21 @@ fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOv
}
NS_IMETHODIMP
nsWebShell:: GetLinkState(const nsString& aURLSpec, nsLinkState& aState)
nsWebShell:: GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState)
{
nsString URLSpec(aURLSpec);
aState = eLinkState_Unvisited;
#ifdef NS_DEBUG
if (aURLSpec.Equals("http://visited/")) {
if (URLSpec.Equals("http://visited/")) {
aState = eLinkState_Visited;
}
else if (aURLSpec.Equals("http://out-of-date/")) {
else if (URLSpec.Equals("http://out-of-date/")) {
aState = eLinkState_OutOfDate;
}
else if (aURLSpec.Equals("http://active/")) {
else if (URLSpec.Equals("http://active/")) {
aState = eLinkState_Active;
}
else if (aURLSpec.Equals("http://hover/")) {
else if (URLSpec.Equals("http://hover/")) {
aState = eLinkState_Hover;
}
#endif

View File

@ -351,7 +351,9 @@ GlobalWindowImpl::GetStatus(nsString& aStatus)
{
nsIBrowserWindow *mBrowser;
if (NS_OK == GetBrowserWindowInterface(mBrowser)) {
mBrowser->GetStatus(aStatus);
PRUnichar *status;
mBrowser->GetStatus(&status);
aStatus = status;
NS_RELEASE(mBrowser);
}
return NS_OK;
@ -383,7 +385,9 @@ GlobalWindowImpl::SetDefaultStatus(const nsString& aDefaultStatus)
NS_IMETHODIMP
GlobalWindowImpl::GetName(nsString& aName)
{
mWebShell->GetName(aName);
PRUnichar *name;
mWebShell->GetName(&name);
aName = name;
return NS_OK;
}

View File

@ -281,8 +281,10 @@ LocationImpl::GetHref(nsString& aHref)
nsresult result = NS_OK;
if (nsnull != mWebShell) {
PRUnichar *href;
mWebShell->GetHistoryIndex(index);
result = mWebShell->GetURL(index, aHref);
result = mWebShell->GetURL(index, &href);
aHref = href;
}
return result;
@ -499,7 +501,7 @@ LocationImpl::Reload(JSContext *cx, jsval *argv, PRUint32 argc)
nsresult result = NS_OK;
if (nsnull != mWebShell) {
result = mWebShell->Reload();
result = mWebShell->Reload(nsReload);
}
return result;

View File

@ -248,7 +248,7 @@ extern "C" NS_EXPORT int DebugRobot(
g_bReadyForNextUrl = PR_FALSE;
if (ww) {
ww->SetObserver(pl);
ww->LoadURL(url->GetSpec());/* XXX hook up stream listener here! */
ww->LoadURL(nsString(url->GetSpec()));/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL)
(*yieldProc)(url->GetSpec());

View File

@ -525,7 +525,8 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
nsIViewManager* viewMan = presShell->GetViewManager();
NS_RELEASE(presShell);
rv = view->Init(viewMan, viewBounds, parView, &kCChildCID);
rv = view->Init(viewMan, viewBounds,
parView, &kCChildCID);
viewMan->InsertChild(parView, view, 0);
NS_RELEASE(viewMan);
SetView(view);
@ -534,8 +535,10 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
nsRect webBounds(0, 0, NSToCoordRound(aSize.width * t2p),
NSToCoordRound(aSize.height * t2p));
mWebShell->Init(widget->GetNativeData(NS_NATIVE_WIDGET), webBounds,
content->GetScrolling());
mWebShell->Init(widget->GetNativeData(NS_NATIVE_WIDGET),
webBounds.x, webBounds.y,
webBounds.width, webBounds.height,
content->GetScrolling());
NS_RELEASE(content);
NS_RELEASE(widget);
@ -594,10 +597,12 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
float t2p = aPresContext.GetTwipsToPixels();
nsRect subBounds;
mWebShell->GetBounds(subBounds);
mWebShell->GetBounds(subBounds.x, subBounds.y,
subBounds.width, subBounds.height);
subBounds.width = NSToCoordRound(aDesiredSize.width * t2p);
subBounds.height = NSToCoordRound(aDesiredSize.height * t2p);
mWebShell->SetBounds(subBounds);
mWebShell->SetBounds(subBounds.x, subBounds.y,
subBounds.width, subBounds.height);
aStatus = NS_FRAME_COMPLETE;

View File

@ -248,7 +248,7 @@ extern "C" NS_EXPORT int DebugRobot(
g_bReadyForNextUrl = PR_FALSE;
if (ww) {
ww->SetObserver(pl);
ww->LoadURL(url->GetSpec());/* XXX hook up stream listener here! */
ww->LoadURL(nsString(url->GetSpec()));/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL)
(*yieldProc)(url->GetSpec());

View File

@ -76,15 +76,15 @@ public:
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult) = 0;
NS_IMETHOD LoadURL(const nsString& aURL) = 0;
NS_IMETHOD LoadURL(const PRUnichar* aURL) = 0;
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0;
NS_IMETHOD GetTitle(nsString& aResult) = 0;
NS_IMETHOD GetTitle(PRUnichar** aResult) = 0;
NS_IMETHOD SetStatus(const nsString& aStatus) = 0;
NS_IMETHOD SetStatus(const PRUnichar* aStatus) = 0;
NS_IMETHOD GetStatus(nsString& aResult) = 0;
NS_IMETHOD GetStatus(PRUnichar** aResult) = 0;
NS_IMETHOD GetWebShell(nsIWebShell*& aResult) = 0;

View File

@ -23,7 +23,6 @@
#include "nsISupports.h"
class nsIFrame;
class nsString;
class nsIPostData;
struct nsGUIEvent;
@ -51,8 +50,8 @@ public:
* targeted (it may be an empty string).
*/
NS_IMETHOD OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData = 0) = 0;
/**
@ -62,13 +61,13 @@ public:
* targeted (it may be an empty string).
*/
NS_IMETHOD OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec) = 0;
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec) = 0;
/**
* Get the state of a link to a given absolute URL
*/
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState) = 0;
NS_IMETHOD GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState) = 0;
};
#endif /* nsILinkHandler_h___ */

View File

@ -46,19 +46,29 @@ class nsIPref;
//----------------------------------------------------------------------
typedef enum {
nsLoadURL,
nsLoadHistory,
nsLoadLink,
nsLoadRefresh
} nsLoadType;
// Container for web shell's
class nsIWebShellContainer : public nsISupports {
public:
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
NS_IMETHOD SetTitle(const PRUnichar* aTitle) = 0;
NS_IMETHOD GetTitle(nsString& aResult) = 0;
NS_IMETHOD GetTitle(PRUnichar** aResult) = 0;
// History control
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL) = 0;
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL) = 0;
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason) = 0;
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) = 0;
// XXX not yet implemented; should we?
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL) = 0;
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax) = 0;
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus) = 0;
NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec) = 0;
// Chrome control
// NS_IMETHOD SetHistoryIndex(PRInt32 aIndex, PRInt32 aMaxIndex) = 0;
@ -66,6 +76,12 @@ public:
// Link traversing control
};
typedef enum {
nsReload,
nsReloadBypassCache,
nsReloadBypassProxy
} nsReloadType;
// Return value from WillLoadURL
#define NS_WEB_SHELL_CANCEL_URL_LOAD 0xC0E70000
@ -84,15 +100,15 @@ public:
class nsIWebShell : public nsIContentViewerContainer {
public:
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE) = 0;
NS_IMETHOD Destroy() = 0;
NS_IMETHOD GetBounds(nsRect& aResult) = 0;
NS_IMETHOD GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h) = 0;
NS_IMETHOD SetBounds(const nsRect& aBounds) = 0;
NS_IMETHOD SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) = 0;
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY) = 0;
@ -100,6 +116,8 @@ public:
NS_IMETHOD Hide() = 0;
NS_IMETHOD Repaint(PRBool aForce) = 0;
NS_IMETHOD SetContentViewer(nsIContentViewer* aViewer) = 0;
NS_IMETHOD GetContentViewer(nsIContentViewer*& aResult) = 0;
@ -109,8 +127,6 @@ public:
NS_IMETHOD SetObserver(nsIStreamObserver* anObserver) = 0;
NS_IMETHOD GetObserver(nsIStreamObserver*& aResult) = 0;
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult) = 0;
NS_IMETHOD SetPrefs(nsIPref* aPrefs) = 0;
NS_IMETHOD GetPrefs(nsIPref*& aPrefs) = 0;
@ -120,9 +136,9 @@ public:
NS_IMETHOD GetChildCount(PRInt32& aResult) = 0;
NS_IMETHOD AddChild(nsIWebShell* aChild) = 0;
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIWebShell*& aResult) = 0;
NS_IMETHOD GetName(nsString& aName) = 0;
NS_IMETHOD SetName(const nsString& aName) = 0;
NS_IMETHOD FindChildWithName(const nsString& aName,
NS_IMETHOD GetName(PRUnichar** aName) = 0;
NS_IMETHOD SetName(const PRUnichar* aName) = 0;
NS_IMETHOD FindChildWithName(const PRUnichar* aName,
nsIWebShell*& aResult) = 0;
// XXX these are here until there a better way to pass along info to a sub doc
@ -131,21 +147,27 @@ public:
NS_IMETHOD GetMarginHeight(PRInt32& aWidth) = 0;
NS_IMETHOD SetMarginHeight(PRInt32 aHeight) = 0;
// History api's
NS_IMETHOD Back() = 0;
NS_IMETHOD Forward() = 0;
NS_IMETHOD Reload() = 0;
NS_IMETHOD LoadURL(const nsString& aURLSpec,
// Document load api's
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult) = 0;
NS_IMETHOD LoadURL(const PRUnichar *aURLSpec,
nsIPostData* aPostData=nsnull,
PRBool aModifyHistory=PR_TRUE) = 0;
NS_IMETHOD Stop(void) = 0;
NS_IMETHOD Reload(nsReloadType aType) = 0;
// History api's
NS_IMETHOD Back() = 0;
NS_IMETHOD CanBack() = 0;
NS_IMETHOD Forward() = 0;
NS_IMETHOD CanForward() = 0;
NS_IMETHOD GoTo(PRInt32 aHistoryIndex) = 0;
NS_IMETHOD GetHistoryIndex(PRInt32& aResult) = 0;
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult) = 0;
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar **aURLResult) = 0;
// Chrome api's
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
NS_IMETHOD SetTitle(const PRUnichar *aTitle) = 0;
NS_IMETHOD GetTitle(nsString& aResult) = 0;
NS_IMETHOD GetTitle(PRUnichar **aResult) = 0;
// SetToolBar
// SetMenuBar
// SetStatusBar

View File

@ -29,11 +29,16 @@
#include <windows.h>
#include <ole2.h>
#include "plstr.h"
#include "prmem.h"
#include "prprf.h"
#include "prlink.h"
#include "nsIFactory.h"
#include "nsIWebShell.h"
#include "nsString.h"
#include "plevent.h"
#include "prthread.h"
#include "private/pprthred.h"
static HMODULE g_DllInst = NULL;
@ -63,8 +68,11 @@ BOOL WINAPI DllMain(HINSTANCE hDllInst,
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
{
// save our instance
g_DllInst = hDllInst;
break;
}
break;
case DLL_PROCESS_DETACH:
break;
@ -100,10 +108,33 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
// for now here is as good a place as any...
//
if (TRUE == isFirstTime) {
PL_InitializeEventsLib("");
NS_SetupRegistry();
isFirstTime = FALSE;
// Get dll directory
char binpath[_MAX_PATH];
::GetModuleFileName(g_DllInst, binpath, _MAX_PATH);
char *lastslash = PL_strrchr(binpath, '\\');
if (lastslash) *lastslash = '\0';
// Get existing search path
int len = GetEnvironmentVariable("PATH", NULL, 0);
char *newpath = (char *) PR_Malloc(sizeof(char) * (len +
PL_strlen(binpath) +
2)); // ';' + '\0'
GetEnvironmentVariable("PATH", newpath, len + 1);
PL_strcat(newpath, ";");
PL_strcat(newpath, binpath);
// Set new search path
SetEnvironmentVariable("PATH", newpath);
// Clean up
PR_Free(newpath);
// PR_AttachThread(PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL);
PL_InitializeEventsLib("");
NS_SetupRegistry();
isFirstTime = FALSE;
}
if (WebShellCID == rclsid) {
@ -131,7 +162,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
/*
* Helper function to register a key/sub-key in the Windows registry...
*/
void RegisterKey(char *aKey, const char *aSubKey, const char *aValue)
void RegisterKey(char *aKey, const char *aSubKey, const char *aValue, const char* aValueName=NULL)
{
LONG rv;
HKEY hKey;
@ -156,7 +187,7 @@ void RegisterKey(char *aKey, const char *aSubKey, const char *aValue)
if (rv == ERROR_SUCCESS) {
if (NULL != aValue) {
RegSetValueEx(hKey,
NULL,
aValueName,
0,
REG_SZ,
(const BYTE*)aValue,
@ -166,7 +197,6 @@ void RegisterKey(char *aKey, const char *aSubKey, const char *aValue)
}
}
/*
* Helper function to remove a key/sub-key from the Windows registry...
*/
@ -250,6 +280,7 @@ STDAPI DllRegisterServer(void)
RegisterKey(WebShellCLSIDkey, "VersionIndependentProgID", WEBSHELL_GLOBAL_PROGID_KEY);
RegisterKey(WebShellCLSIDkey, "NotInsertable", NULL);
RegisterKey(WebShellCLSIDkey, "InprocServer32", WebShellDLLPath);
RegisterKey(WebShellCLSIDkey, "InprocServer32", "Apartment", "ThreadingModel");
// Free up memory...
if (WebShellCLSID) {
@ -329,4 +360,5 @@ STDAPI DllUnregisterServer(void)
return NOERROR;
}
#endif // XP_PC
#endif // XP_PC

View File

@ -35,6 +35,7 @@
#include "nsWidgetsCID.h"
#include "nsGfxCIID.h"
#include "plevent.h"
#include "prprf.h"
#include "nsIPluginHost.h"
#include "nsplugin.h"
#include "nsPluginsCID.h"
@ -113,22 +114,22 @@ public:
// nsIWebShell
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h);
NS_IMETHOD SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Show();
NS_IMETHOD Hide();
NS_IMETHOD Repaint(PRBool aForce);
NS_IMETHOD SetContentViewer(nsIContentViewer* aViewer);
NS_IMETHOD GetContentViewer(nsIContentViewer*& aResult);
NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer);
NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult);
NS_IMETHOD SetObserver(nsIStreamObserver* anObserver);
NS_IMETHOD GetObserver(nsIStreamObserver*& aResult);
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult);
NS_IMETHOD SetPrefs(nsIPref* aPrefs);
NS_IMETHOD GetPrefs(nsIPref*& aPrefs);
NS_IMETHOD GetRootWebShell(nsIWebShell*& aResult);
@ -137,41 +138,52 @@ public:
NS_IMETHOD GetChildCount(PRInt32& aResult);
NS_IMETHOD AddChild(nsIWebShell* aChild);
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIWebShell*& aResult);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD FindChildWithName(const nsString& aName,
NS_IMETHOD GetName(PRUnichar** aName);
NS_IMETHOD SetName(const PRUnichar* aName);
NS_IMETHOD FindChildWithName(const PRUnichar* aName,
nsIWebShell*& aResult);
NS_IMETHOD Back(void);
NS_IMETHOD Forward(void);
NS_IMETHOD Reload();
NS_IMETHOD LoadURL(const nsString& aURLSpec,
nsIPostData* aPostData=nsnull,
PRBool aModifyHistory=PR_TRUE);
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, nsString& aURLResult);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD GetTitle(nsString& aResult);
NS_IMETHOD GetMarginWidth (PRInt32& aWidth);
NS_IMETHOD SetMarginWidth (PRInt32 aWidth);
NS_IMETHOD GetMarginHeight(PRInt32& aWidth);
NS_IMETHOD SetMarginHeight(PRInt32 aHeight);
// Document load api's
NS_IMETHOD GetDocumentLoader(nsIDocumentLoader*& aResult);
NS_IMETHOD LoadURL(const PRUnichar *aURLSpec,
nsIPostData* aPostData=nsnull,
PRBool aModifyHistory=PR_TRUE);
NS_IMETHOD Stop(void);
NS_IMETHOD Reload(nsReloadType aType);
// History api's
NS_IMETHOD Back(void);
NS_IMETHOD CanBack(void);
NS_IMETHOD Forward(void);
NS_IMETHOD CanForward(void);
NS_IMETHOD GoTo(PRInt32 aHistoryIndex);
NS_IMETHOD GetHistoryIndex(PRInt32& aResult);
NS_IMETHOD GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult);
// Chrome api's
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus);
NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec);
// nsILinkHandler
NS_IMETHOD OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData = 0);
NS_IMETHOD OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec);
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState);
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec);
NS_IMETHOD GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState);
// nsIScriptContextOwner
NS_IMETHOD GetScriptContext(nsIScriptContext **aContext);
@ -182,13 +194,13 @@ public:
NS_IMETHOD OnConnectionsComplete();
// nsWebShell
void HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
void HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostDat = 0);
void ShowHistory();
nsIWebShell* GetTarget(const nsString& aName);
nsIWebShell* GetTarget(const PRUnichar* aName);
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
@ -452,13 +464,14 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
NS_IMETHODIMP
nsWebShell::Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
nsScrollPreference aScrolling,
PRBool aAllowPlugins)
{
//XXX make sure plugins have started up. this really needs to
//be associated with the nsIContentViewerContainer interfaces,
//not the nsIWebShell interfaces. this is a hack. MMP
nsRect aBounds(x,y,w,h);
if ((PR_TRUE == aAllowPlugins) && (PR_FALSE == mPluginInited))
CreatePluginHost();
@ -559,30 +572,36 @@ nsWebShell::Destroy()
NS_IMETHODIMP
nsWebShell::GetBounds(nsRect& aResult)
nsWebShell::GetBounds(PRInt32 &x, PRInt32 &y, PRInt32 &w, PRInt32 &h)
{
nsRect aResult;
NS_PRECONDITION(nsnull != mWindow, "null window");
aResult.SetRect(0, 0, 0, 0);
if (nsnull != mWindow) {
mWindow->GetBounds(aResult);
}
x = aResult.x;
y = aResult.y;
w = aResult.width;
h = aResult.height;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetBounds(const nsRect& aBounds)
nsWebShell::SetBounds(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
if (nsnull != mWindow) {
// Don't have the widget repaint. Layout will generate repaint requests
// during reflow
mWindow->Resize(aBounds.x, aBounds.y, aBounds.width, aBounds.height,
mWindow->Resize(x, y, w, h,
PR_FALSE);
}
if (nsnull != mContentViewer) {
nsRect rr(0, 0, aBounds.width, aBounds.height);
nsRect rr(0, 0, w, h);
mContentViewer->SetBounds(rr);
}
@ -631,6 +650,18 @@ nsWebShell::Hide()
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::Repaint(PRBool aForce)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
if (nsnull != mWindow) {
mWindow->Invalidate(aForce);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetContentViewer(nsIContentViewer* aViewer)
{
@ -690,14 +721,6 @@ nsWebShell::GetObserver(nsIStreamObserver*& aResult)
}
NS_IMETHODIMP
nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult)
{
aResult = mDocLoader;
NS_IF_ADDREF(mDocLoader);
return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsWebShell::SetPrefs(nsIPref* aPrefs)
{
@ -784,32 +807,33 @@ nsWebShell::ChildAt(PRInt32 aIndex, nsIWebShell*& aResult)
}
NS_IMETHODIMP
nsWebShell::GetName(nsString& aName)
nsWebShell::GetName(PRUnichar** aName)
{
aName = mName;
*aName = mName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetName(const nsString& aName)
nsWebShell::SetName(const PRUnichar* aName)
{
mName = aName;
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::FindChildWithName(const nsString& aName,
nsWebShell::FindChildWithName(const PRUnichar* aName1,
nsIWebShell*& aResult)
{
aResult = nsnull;
nsString aName(aName1);
nsAutoString childName;
PRUnichar *childName;
PRInt32 i, n = mChildren.Count();
for (i = 0; i < n; i++) {
nsIWebShell* child = (nsIWebShell*) mChildren.ElementAt(i);
if (nsnull != child) {
child->GetName(childName);
if (childName.Equals(aName)) {
child->GetName(&childName);
if (aName.Equals(childName)) {
aResult = child;
NS_ADDREF(child);
break;
@ -856,31 +880,60 @@ nsWebShell::SetMarginHeight(PRInt32 aHeight)
return NS_OK;
}
//----------------------------------------
// History methods
NS_IMETHODIMP
nsWebShell::Back(void)
/**
* Document Load methods
*/
NS_IMETHODIMP
nsWebShell::GetDocumentLoader(nsIDocumentLoader*& aResult)
{
return GoTo(mHistoryIndex - 1);
aResult = mDocLoader;
NS_IF_ADDREF(mDocLoader);
return (nsnull != mDocLoader) ? NS_OK : NS_ERROR_FAILURE;
}
#define FILE_PROTOCOL "file:///"
static void convertFileToURL(nsString &aIn, nsString &aOut)
{
#ifdef XP_PC
char szFile[1000];
aIn.ToCString(szFile, sizeof(szFile));
if (PL_strchr(szFile, '\\')) {
PRInt32 len = strlen(szFile);
PRInt32 sum = len + sizeof(FILE_PROTOCOL);
char* lpszFileURL = new char[sum];
// Translate '\' to '/'
for (PRInt32 i = 0; i < len; i++) {
if (szFile[i] == '\\') {
szFile[i] = '/';
}
if (szFile[i] == ':') {
szFile[i] = '|';
}
}
// Build the file URL
PR_snprintf(lpszFileURL, sum, "%s%s", FILE_PROTOCOL, szFile);
aOut = lpszFileURL;
}
else
#endif
{
aOut = aIn;
}
}
NS_IMETHODIMP
nsWebShell::Forward(void)
{
return GoTo(mHistoryIndex + 1);
}
NS_IMETHODIMP
nsWebShell::LoadURL(const nsString& aURLSpec,
nsWebShell::LoadURL(const PRUnichar *aURLSpec,
nsIPostData* aPostData,
PRBool aModifyHistory)
{
nsresult rv;
PRInt32 colon, fSlash;
PRUnichar port;
nsAutoString urlSpec(aURLSpec);
nsAutoString urlSpec;
convertFileToURL(nsString(aURLSpec), urlSpec);
fSlash=urlSpec.Find('/');
@ -894,9 +947,10 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
nsString httpDef("http://");
urlSpec.Insert(httpDef, 0, 7);
}
// Give web-shell-container right of refusal
if (nsnull != mContainer) {
rv = mContainer->WillLoadURL(this, urlSpec);
rv = mContainer->WillLoadURL(this, urlSpec, nsLoadURL);
if (NS_OK != rv) {
return rv;
}
@ -935,12 +989,7 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
}
}
// Stop any documents that are currently being loaded...
mDocLoader->Stop();
// Cancel any timers that were set for this loader.
mDocLoader->CancelLoadURLTimer();
Stop();
rv = mDocLoader->LoadURL(urlSpec, // URL string
nsnull, // Command
@ -951,16 +1000,55 @@ nsWebShell::LoadURL(const nsString& aURLSpec,
return rv;
}
NS_IMETHODIMP
nsWebShell::Reload()
NS_IMETHODIMP nsWebShell::Stop(void)
{
if (mDocLoader) {
// Stop any documents that are currently being loaded...
mDocLoader->Stop();
// Cancel any timers that were set for this loader.
mDocLoader->CancelLoadURLTimer();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsWebShell::Reload(nsReloadType aType)
{
nsString* s = (nsString*) mHistory.ElementAt(mHistoryIndex);
if (nsnull != s) {
// XXX What about the post data?
return LoadURL(*s, nsnull, PR_FALSE);
}
return NS_ERROR_FAILURE;
}
return NS_OK;
//----------------------------------------
// History methods
NS_IMETHODIMP
nsWebShell::Back(void)
{
return GoTo(mHistoryIndex - 1);
}
NS_IMETHODIMP
nsWebShell::CanBack(void)
{
return (mHistoryIndex > 0 ? NS_OK : NS_COMFALSE);
}
NS_IMETHODIMP
nsWebShell::Forward(void)
{
return GoTo(mHistoryIndex + 1);
}
NS_IMETHODIMP
nsWebShell::CanForward(void)
{
return (mHistoryIndex < mHistory.Count() - 1 ? NS_OK : NS_COMFALSE);
}
NS_IMETHODIMP
@ -968,13 +1056,13 @@ nsWebShell::GoTo(PRInt32 aHistoryIndex)
{
nsresult rv = NS_ERROR_ILLEGAL_VALUE;
if ((aHistoryIndex >= 0) &&
(aHistoryIndex <= mHistory.Count() - 1)) {
(aHistoryIndex < mHistory.Count())) {
nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);
// Give web-shell-container right of refusal
nsAutoString urlSpec(*s);
if (nsnull != mContainer) {
rv = mContainer->WillLoadURL(this, urlSpec);
rv = mContainer->WillLoadURL(this, urlSpec, nsLoadHistory);
if (NS_OK != rv) {
return rv;
}
@ -1016,15 +1104,14 @@ nsWebShell::GetHistoryIndex(PRInt32& aResult)
}
NS_IMETHODIMP
nsWebShell::GetURL(PRInt32 aHistoryIndex, nsString& aURLResult)
nsWebShell::GetURL(PRInt32 aHistoryIndex, PRUnichar** aURLResult)
{
nsresult rv = NS_ERROR_ILLEGAL_VALUE;
if ((aHistoryIndex >= 0) &&
(aHistoryIndex <= mHistory.Count() - 1)) {
aURLResult.Truncate();
nsString* s = (nsString*) mHistory.ElementAt(aHistoryIndex);
if (nsnull != s) {
aURLResult = *s;
*aURLResult = *s;
}
rv = NS_OK;
}
@ -1057,7 +1144,7 @@ nsWebShell::ShowHistory()
// Chrome API's
NS_IMETHODIMP
nsWebShell::SetTitle(const nsString& aTitle)
nsWebShell::SetTitle(const PRUnichar* aTitle)
{
// Record local title
mTitle = aTitle;
@ -1073,9 +1160,9 @@ nsWebShell::SetTitle(const nsString& aTitle)
}
NS_IMETHODIMP
nsWebShell::GetTitle(nsString& aResult)
nsWebShell::GetTitle(PRUnichar** aResult)
{
aResult = mTitle;
*aResult = mTitle;
return NS_OK;
}
@ -1084,16 +1171,16 @@ nsWebShell::GetTitle(nsString& aResult)
// WebShell container implementation
NS_IMETHODIMP
nsWebShell::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason)
{
if (nsnull != mContainer) {
return mContainer->WillLoadURL(aShell, aURL);
return mContainer->WillLoadURL(aShell, aURL, aReason);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (nsnull != mContainer) {
return mContainer->BeginLoadURL(aShell, aURL);
@ -1102,21 +1189,43 @@ nsWebShell::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsWebShell::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsWebShell::ProgressLoadURL(nsIWebShell* aShell,
const PRUnichar* aURL,
PRInt32 aProgress,
PRInt32 aProgressMax)
{
if (nsnull != mContainer) {
return mContainer->EndLoadURL(aShell, aURL);
return mContainer->ProgressLoadURL(aShell, aURL, aProgress, aProgressMax);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus)
{
if (nsnull != mContainer) {
return mContainer->EndLoadURL(aShell, aURL, aStatus);
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec)
{
if (nsnull != mContainer) {
return mContainer->OverLink(aShell, aURLSpec, aTargetSpec);
}
return NS_OK;
}
//----------------------------------------------------------------------
// WebShell link handling
struct OnLinkClickEvent : public PLEvent {
OnLinkClickEvent(nsWebShell* aHandler, const nsString& aURLSpec,
const nsString& aTargetSpec, nsIPostData* aPostData = 0);
OnLinkClickEvent(nsWebShell* aHandler, const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec, nsIPostData* aPostData = 0);
~OnLinkClickEvent();
void HandleEvent() {
@ -1140,8 +1249,8 @@ static void PR_CALLBACK DestroyPLEvent(OnLinkClickEvent* aEvent)
}
OnLinkClickEvent::OnLinkClickEvent(nsWebShell* aHandler,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
mHandler = aHandler;
@ -1182,8 +1291,8 @@ OnLinkClickEvent::~OnLinkClickEvent()
NS_IMETHODIMP
nsWebShell::OnLinkClick(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec,
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
OnLinkClickEvent* ev;
@ -1202,21 +1311,22 @@ nsWebShell::OnLinkClick(nsIFrame* aFrame,
// XXX This doesn't yet know how to target other windows with their
// own tree
nsIWebShell*
nsWebShell::GetTarget(const nsString& aName)
nsWebShell::GetTarget(const PRUnichar* aName)
{
nsString name(aName);
nsIWebShell* target = nsnull;
if (aName.EqualsIgnoreCase("_blank")) {
if (name.EqualsIgnoreCase("_blank")) {
// XXX Need api in nsIWebShellContainer
NS_ASSERTION(0, "not implemented yet");
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_self")) {
else if (name.EqualsIgnoreCase("_self")) {
target = this;
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_parent")) {
else if (name.EqualsIgnoreCase("_parent")) {
if (nsnull == mParent) {
target = this;
}
@ -1225,7 +1335,7 @@ nsWebShell::GetTarget(const nsString& aName)
}
NS_ADDREF(target);
}
else if (aName.EqualsIgnoreCase("_top")) {
else if (name.EqualsIgnoreCase("_top")) {
GetRootWebShell(target);
}
else {
@ -1244,8 +1354,8 @@ nsWebShell::GetTarget(const nsString& aName)
}
void
nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec,
nsWebShell::HandleLinkClickEvent(const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec,
nsIPostData* aPostData)
{
nsIWebShell* shell = GetTarget(aTargetSpec);
@ -1256,10 +1366,10 @@ nsWebShell::HandleLinkClickEvent(const nsString& aURLSpec,
NS_IMETHODIMP
nsWebShell::OnOverLink(nsIFrame* aFrame,
const nsString& aURLSpec,
const nsString& aTargetSpec)
const PRUnichar* aURLSpec,
const PRUnichar* aTargetSpec)
{
if (!aURLSpec.Equals(mOverURL) || !aTargetSpec.Equals(mOverTarget)) {
if (!mOverURL.Equals(aURLSpec) || !mOverTarget.Equals(aTargetSpec)) {
fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOverTarget, stdout); fputs("'\n", stdout);
fputs("Over link '", stdout);
fputs(aURLSpec, stdout);
@ -1289,20 +1399,21 @@ fputs("Was '", stdout); fputs(mOverURL, stdout); fputs("' '", stdout); fputs(mOv
}
NS_IMETHODIMP
nsWebShell:: GetLinkState(const nsString& aURLSpec, nsLinkState& aState)
nsWebShell:: GetLinkState(const PRUnichar* aURLSpec, nsLinkState& aState)
{
nsString URLSpec(aURLSpec);
aState = eLinkState_Unvisited;
#ifdef NS_DEBUG
if (aURLSpec.Equals("http://visited/")) {
if (URLSpec.Equals("http://visited/")) {
aState = eLinkState_Visited;
}
else if (aURLSpec.Equals("http://out-of-date/")) {
else if (URLSpec.Equals("http://out-of-date/")) {
aState = eLinkState_OutOfDate;
}
else if (aURLSpec.Equals("http://active/")) {
else if (URLSpec.Equals("http://active/")) {
aState = eLinkState_Active;
}
else if (aURLSpec.Equals("http://hover/")) {
else if (URLSpec.Equals("http://hover/")) {
aState = eLinkState_Hover;
}
#endif

View File

@ -325,7 +325,6 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
LoadURL(url);
}
break;
case JS_CONSOLE:
DoJSConsole();
break;
@ -368,7 +367,7 @@ nsBrowserWindow::Forward()
}
void
nsBrowserWindow::GoTo(const nsString& aURL)
nsBrowserWindow::GoTo(const PRUnichar* aURL)
{
mWebShell->LoadURL(aURL, nsnull);
}
@ -429,7 +428,7 @@ nsBrowserWindow::DoFileOpen()
PR_snprintf(lpszFileURL, sum, "%s%s", FILE_PROTOCOL, szFile);
// Ask the Web widget to load the file URL
LoadURL(lpszFileURL);
LoadURL(nsString(lpszFileURL));
delete lpszFileURL;
}
}
@ -550,7 +549,8 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
return rv;
}
r.x = r.y = 0;
rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), r,
rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET),
r.x, r.y, r.width, r.height,
nsScrollPreference_kAuto, aAllowPlugins);
mWebShell->SetContainer((nsIWebShellContainer*) this);
mWebShell->SetObserver((nsIStreamObserver*)this);
@ -727,7 +727,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
rr.y += WEBSHELL_TOP_INSET;
rr.width -= WEBSHELL_LEFT_INSET + WEBSHELL_RIGHT_INSET;
rr.height -= WEBSHELL_TOP_INSET + WEBSHELL_BOTTOM_INSET;
mWebShell->SetBounds(rr);
mWebShell->SetBounds(rr.x, rr.y, rr.width, rr.height);
}
NS_IMETHODIMP
@ -795,7 +795,7 @@ nsBrowserWindow::GetChrome(PRUint32& aChromeMaskResult)
}
NS_IMETHODIMP
nsBrowserWindow::LoadURL(const nsString& aURL)
nsBrowserWindow::LoadURL(const PRUnichar* aURL)
{
return mWebShell->LoadURL(aURL, nsnull);
}
@ -811,7 +811,7 @@ nsBrowserWindow::GetWebShell(nsIWebShell*& aResult)
//----------------------------------------
NS_IMETHODIMP
nsBrowserWindow::SetTitle(const nsString& aTitle)
nsBrowserWindow::SetTitle(const PRUnichar* aTitle)
{
NS_PRECONDITION(nsnull != mWindow, "null window");
mTitle = aTitle;
@ -820,14 +820,14 @@ nsBrowserWindow::SetTitle(const nsString& aTitle)
}
NS_IMETHODIMP
nsBrowserWindow::GetTitle(nsString& aResult)
nsBrowserWindow::GetTitle(PRUnichar** aResult)
{
aResult = mTitle;
*aResult = mTitle;
return NS_OK;
}
NS_IMETHODIMP
nsBrowserWindow::SetStatus(const nsString& aStatus)
nsBrowserWindow::SetStatus(const PRUnichar* aStatus)
{
if (nsnull != mStatus) {
mStatus->SetText(aStatus);
@ -836,13 +836,13 @@ nsBrowserWindow::SetStatus(const nsString& aStatus)
}
NS_IMETHODIMP
nsBrowserWindow::GetStatus(nsString& aResult)
nsBrowserWindow::GetStatus(PRUnichar** aResult)
{
return NS_OK;
}
NS_IMETHODIMP
nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason)
{
if (mStatus) {
nsAutoString url("Connecting to ");
@ -853,7 +853,7 @@ nsBrowserWindow::WillLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
if (mThrobber) {
mThrobber->Start();
@ -863,7 +863,13 @@ nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const nsString& aURL)
}
NS_IMETHODIMP
nsBrowserWindow::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
nsBrowserWindow::ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax)
{
return NS_OK;
}
NS_IMETHODIMP
nsBrowserWindow::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus)
{
if (mThrobber) {
mThrobber->Stop();
@ -871,6 +877,12 @@ nsBrowserWindow::EndLoadURL(nsIWebShell* aShell, const nsString& aURL)
return NS_OK;
}
NS_IMETHODIMP
nsBrowserWindow::OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec)
{
return NS_OK;
}
//----------------------------------------
// Stream observer implementation
@ -1053,7 +1065,6 @@ nsBrowserWindow::GetPresShell()
return shell;
}
void
nsBrowserWindow::DoCopy()
{
@ -1277,16 +1288,18 @@ nsBrowserWindow::DumpViews(FILE* out)
static void DumpAWebShell(nsIWebShell* aShell, FILE* out, PRInt32 aIndent)
{
nsAutoString name;
PRUnichar *name;
nsAutoString str;
nsIWebShell* parent;
PRInt32 i, n;
for (i = aIndent; --i >= 0; ) fprintf(out, " ");
fprintf(out, "%p '", aShell);
aShell->GetName(name);
aShell->GetName(&name);
aShell->GetParent(parent);
fputs(name, out);
str = name;
fputs(str, out);
fprintf(out, "' parent=%p <\n", parent);
NS_IF_RELEASE(parent);
@ -1485,8 +1498,8 @@ nsBrowserWindow::DoDebugSave()
PRBool doSave = PR_FALSE;
nsString path;
nsString urlString;
mWebShell->GetURL(0,urlString);
PRUnichar *urlString;
mWebShell->GetURL(0,&urlString);
nsIURL* url;
nsresult rv = NS_NewURL(&url, urlString);

View File

@ -70,23 +70,25 @@ public:
NS_IMETHOD OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow);
NS_IMETHOD ChangeChrome(PRUint32 aNewChromeMask);
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult);
NS_IMETHOD LoadURL(const nsString& aURL);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD GetTitle(nsString& aResult);
NS_IMETHOD SetStatus(const nsString& aStatus);
NS_IMETHOD GetStatus(nsString& aResult);
NS_IMETHOD LoadURL(const PRUnichar* aURL);
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
NS_IMETHOD GetTitle(PRUnichar** aResult);
NS_IMETHOD SetStatus(const PRUnichar* aStatus);
NS_IMETHOD GetStatus(PRUnichar** aResult);
NS_IMETHOD GetWebShell(nsIWebShell*& aResult);
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD OnStatus(nsIURL* aURL, const nsString& aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString &aMsg);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const nsString& aURL);
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus);
NS_IMETHOD OverLink(nsIWebShell* aShell, const PRUnichar* aURLSpec, const PRUnichar* aTargetSpec);
// nsINetSupport
NS_IMETHOD_(void) Alert(const nsString &aText);
@ -108,7 +110,7 @@ public:
void Destroy();
void Back();
void Forward();
void GoTo(const nsString& aURL);
void GoTo(const PRUnichar* aURL);
void StartThrobber();
void StopThrobber();
void LoadThrobberImages();

View File

@ -718,7 +718,7 @@ SiteWalkerDlgProc(HWND hDlg, UINT msg, WPARAM wParam,LPARAM lParam)
SetDlgItemText(hDlg,IDC_SITE_NAME, gTop100List[gTop100Pointer]);
EnableWindow(GetDlgItem(hDlg,ID_SITE_PREVIOUS),TRUE);
if (gWinData)
gWinData->LoadURL(gTop100List[gTop100Pointer]);
gWinData->LoadURL(nsString(gTop100List[gTop100Pointer]));
}
return FALSE;
case WM_COMMAND:
@ -731,7 +731,7 @@ SiteWalkerDlgProc(HWND hDlg, UINT msg, WPARAM wParam,LPARAM lParam)
EnableWindow(GetDlgItem(hDlg,ID_SITE_NEXT),TRUE);
SetDlgItemText(hDlg,IDC_SITE_NAME, p);
if (gWinData)
gWinData->LoadURL(gTop100List[gTop100Pointer]);
gWinData->LoadURL(nsString(gTop100List[gTop100Pointer]));
}
else {
EnableWindow(GetDlgItem(hDlg,ID_SITE_NEXT),FALSE);
@ -746,7 +746,7 @@ SiteWalkerDlgProc(HWND hDlg, UINT msg, WPARAM wParam,LPARAM lParam)
EnableWindow(GetDlgItem(hDlg,ID_SITE_PREVIOUS),TRUE);
SetDlgItemText(hDlg,IDC_SITE_NAME, gTop100List[--gTop100Pointer]);
if (gWinData)
gWinData->LoadURL(gTop100List[gTop100Pointer]);
gWinData->LoadURL(nsString(gTop100List[gTop100Pointer]));
}
else {
EnableWindow(GetDlgItem(hDlg,ID_SITE_PREVIOUS),FALSE);