changes for plugins.

git-svn-id: svn://10.0.0.236/trunk@7328 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
michaelp%netscape.com
1998-08-05 04:23:21 +00:00
parent c273de6a07
commit f6f0263fa5
10 changed files with 34 additions and 15 deletions

View File

@@ -95,7 +95,8 @@ public:
// nsIWebShell
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
@@ -399,12 +400,15 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
NS_IMETHODIMP
nsWebShell::Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
nsScrollPreference aScrolling)
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
CreatePluginHost();
if (PR_TRUE == aAllowPlugins)
CreatePluginHost();
mScrollPref = aScrolling;

View File

@@ -311,7 +311,7 @@ nsresult nsDocFactoryImpl::InitUAStyleSheet()
if (nsnull == gUAStyleSheet) { // snarf one
nsIURL* uaURL;
rv = NS_NewURL(&uaURL, nsnull, UA_CSS_URL); // XXX this bites, fix it
rv = NS_NewURL(&uaURL, nsnull, nsString(UA_CSS_URL)); // XXX this bites, fix it
if (NS_OK == rv) {
// Get an input stream from the url
PRInt32 ec;

View File

@@ -52,7 +52,8 @@ public:
NS_IMETHOD Init(nsIAppShell* aAppShell,
nsIPref* aPrefs,
const nsRect& aBounds,
PRUint32 aChromeMask) = 0;
PRUint32 aChromeMask,
PRBool aAllowPlugins = PR_TRUE) = 0;
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY) = 0;

View File

@@ -85,7 +85,8 @@ class nsIWebShell : public nsIContentViewerContainer {
public:
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
nsScrollPreference aScrolling = nsScrollPreference_kAuto)=0;
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE) = 0;
NS_IMETHOD Destroy() = 0;

View File

@@ -311,7 +311,7 @@ nsresult nsDocFactoryImpl::InitUAStyleSheet()
if (nsnull == gUAStyleSheet) { // snarf one
nsIURL* uaURL;
rv = NS_NewURL(&uaURL, nsnull, UA_CSS_URL); // XXX this bites, fix it
rv = NS_NewURL(&uaURL, nsnull, nsString(UA_CSS_URL)); // XXX this bites, fix it
if (NS_OK == rv) {
// Get an input stream from the url
PRInt32 ec;

View File

@@ -95,7 +95,8 @@ public:
// nsIWebShell
NS_IMETHOD Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
nsScrollPreference aScrolling = nsScrollPreference_kAuto,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD Destroy(void);
NS_IMETHOD GetBounds(nsRect& aResult);
NS_IMETHOD SetBounds(const nsRect& aBounds);
@@ -399,12 +400,15 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
NS_IMETHODIMP
nsWebShell::Init(nsNativeWidget aNativeParent,
const nsRect& aBounds,
nsScrollPreference aScrolling)
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
CreatePluginHost();
if (PR_TRUE == aAllowPlugins)
CreatePluginHost();
mScrollPref = aScrolling;

View File

@@ -504,7 +504,8 @@ nsresult
nsBrowserWindow::Init(nsIAppShell* aAppShell,
nsIPref* aPrefs,
const nsRect& aBounds,
PRUint32 aChromeMask)
PRUint32 aChromeMask,
PRBool aAllowPlugins)
{
mChromeMask = aChromeMask;
@@ -527,7 +528,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,
nsScrollPreference_kAuto, aAllowPlugins);
mWebShell->SetContainer((nsIWebShellContainer*) this);
mWebShell->SetObserver((nsIStreamObserver*)this);
mWebShell->SetPrefs(aPrefs);

View File

@@ -60,7 +60,8 @@ public:
NS_IMETHOD Init(nsIAppShell* aAppShell,
nsIPref* aPrefs,
const nsRect& aBounds,
PRUint32 aChromeMask);
PRUint32 aChromeMask,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
NS_IMETHOD SizeTo(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD GetBounds(nsRect& aBounds);

View File

@@ -53,6 +53,7 @@ nsViewerApp::nsViewerApp()
mDelay = 1;
mRepeatCount = 1;
mNumSamples = 10;
mAllowPlugins = PR_TRUE;
}
nsViewerApp::~nsViewerApp()
@@ -164,7 +165,7 @@ nsViewerApp::Exit()
static void
PrintHelpInfo(char **argv)
{
fprintf(stderr, "Usage: %s [-p][-q][-md #][-f filename][-d #] [starting url]\n", argv[0]);
fprintf(stderr, "Usage: %s [-p][-q][-md #][-f filename][-d #][-np] [starting url]\n", argv[0]);
fprintf(stderr, "\t-p[#] -- run purify, optionally with a # that says which sample to stop at. For example, -p2 says to run samples 0, 1, and 2.\n");
fprintf(stderr, "\t-q -- run quantify\n");
fprintf(stderr, "\t-md # -- set the crt debug flags to #\n");
@@ -176,6 +177,7 @@ PrintHelpInfo(char **argv)
fprintf(stderr, "\t-S domain -- add a domain/host that is safe to crawl (e.g. www.netscape.com)\n");
fprintf(stderr, "\t-A domain -- add a domain/host that should be avoided (e.g. microsoft.com)\n");
fprintf(stderr, "\t-N pages -- set the max # of pages to crawl\n");
fprintf(stderr, "\t-np -- no plugins\n");
}
static void
@@ -324,6 +326,9 @@ nsViewerApp::ProcessArguments(int argc, char** argv)
}
mCrawler->SetMaxPages(pages);
}
else if (PL_strcmp(argv[i], "-np") == 0) {
mAllowPlugins = PR_FALSE;
}
else {
PrintHelpInfo(argv);
exit(-1);
@@ -347,7 +352,7 @@ nsViewerApp::OpenWindow()
kIBrowserWindowIID,
(void**) &bw);
bw->SetApp(this);
bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0));
bw->Init(mAppShell, mPrefs, nsRect(0, 0, 620, 400), PRUint32(~0), mAllowPlugins);
bw->Show();
mCrawler->SetBrowserWindow(bw);

View File

@@ -82,6 +82,7 @@ protected:
PRInt32 mDelay;
PRInt32 mRepeatCount;
nsWebCrawler* mCrawler;
PRBool mAllowPlugins;
};
class nsNativeViewerApp : public nsViewerApp {