From ef65acd8d9e54aebbba5be2cfd7bb78768cc5c59 Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Tue, 24 Jun 2003 21:08:26 +0000 Subject: [PATCH] NOT PART OF BUILD. Add sample licence, fix window creator git-svn-id: svn://10.0.0.236/trunk@144104 18797224-902f-48f8-a5cc-f745e15eee43 --- .../embedding/tests/wxEmbed/BrowserFrame.cpp | 48 +++++++- .../embedding/tests/wxEmbed/BrowserFrame.h | 37 ++++++- mozilla/embedding/tests/wxEmbed/EmbedApp.cpp | 52 ++++++++- .../tests/wxEmbed/GeckoContainer.cpp | 7 ++ .../embedding/tests/wxEmbed/GeckoContainer.h | 12 +- .../tests/wxEmbed/GeckoContainerUI.cpp | 33 +++++- .../tests/wxEmbed/GeckoProtocolHandler.cpp | 104 ++++++++++++------ .../tests/wxEmbed/GeckoProtocolHandler.h | 31 ++++++ .../embedding/tests/wxEmbed/GeckoWindow.cpp | 31 ++++++ mozilla/embedding/tests/wxEmbed/GeckoWindow.h | 32 ++++++ .../tests/wxEmbed/GeckoWindowCreator.cpp | 58 +++++++++- .../tests/wxEmbed/GeckoWindowCreator.h | 31 ++++++ mozilla/embedding/tests/wxEmbed/MailFrame.cpp | 32 +++++- mozilla/embedding/tests/wxEmbed/MailFrame.h | 31 ++++++ mozilla/embedding/tests/wxEmbed/global.h | 31 ++++++ mozilla/embedding/tests/wxEmbed/makefile.vc | 1 + 16 files changed, 518 insertions(+), 53 deletions(-) diff --git a/mozilla/embedding/tests/wxEmbed/BrowserFrame.cpp b/mozilla/embedding/tests/wxEmbed/BrowserFrame.cpp index c402c60a677..a1c547d548c 100644 --- a/mozilla/embedding/tests/wxEmbed/BrowserFrame.cpp +++ b/mozilla/embedding/tests/wxEmbed/BrowserFrame.cpp @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #include "global.h" #include "BrowserFrame.h" @@ -24,7 +55,10 @@ BrowserFrame::BrowserFrame(wxWindow* aParent) : mGeckoWnd = (GeckoWindow *) FindWindowById(XRCID("gecko"), this); if (mGeckoWnd) { - GeckoContainer *geckoContainer = new GeckoContainer(this); + // Note we pass in 'browser' as the role so that when the content + // wants to open a popup the window creator can say okay but deny it + // for other roles such as 'mail' or whatever. + GeckoContainer *geckoContainer = new GeckoContainer(this, "browser"); if (geckoContainer) { mGeckoWnd->SetGeckoContainer(geckoContainer); @@ -128,6 +162,18 @@ void BrowserFrame::OnBrowserHome(wxCommandEvent & WXUNUSED(event)) /////////////////////////////////////////////////////////////////////////////// // GeckoContainerUI overrides +nsresult BrowserFrame::CreateBrowserWindow(PRUint32 aChromeFlags, + nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **aNewWindow) +{ + // Create the main frame window + BrowserFrame* frame = new BrowserFrame(NULL); + if (!frame) + return NS_ERROR_OUT_OF_MEMORY; + frame->Show(TRUE); + GeckoContainer *container = frame->mGeckoWnd->GetGeckoContainer(); + return container->QueryInterface(NS_GET_IID(nsIWebBrowserChrome), (void **) aNewWindow); +} + void BrowserFrame::UpdateStatusBarText(const PRUnichar* aStatusText) { SetStatusText(aStatusText); diff --git a/mozilla/embedding/tests/wxEmbed/BrowserFrame.h b/mozilla/embedding/tests/wxEmbed/BrowserFrame.h index 1843ac81b9f..3a78fb9c208 100644 --- a/mozilla/embedding/tests/wxEmbed/BrowserFrame.h +++ b/mozilla/embedding/tests/wxEmbed/BrowserFrame.h @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #ifndef BROWSERFRAME_H #define BROWSERFRAME_H @@ -25,8 +56,10 @@ public : nsCOMPtr mWebbrowser; // GeckoContainerUI overrides - void UpdateStatusBarText(const PRUnichar* aStatusText); - void UpdateCurrentURI(); + virtual nsresult CreateBrowserWindow(PRUint32 aChromeFlags, + nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **aNewWindow); + virtual void UpdateStatusBarText(const PRUnichar* aStatusText); + virtual void UpdateCurrentURI(); }; #endif \ No newline at end of file diff --git a/mozilla/embedding/tests/wxEmbed/EmbedApp.cpp b/mozilla/embedding/tests/wxEmbed/EmbedApp.cpp index 243950b36cd..d69b890f43a 100644 --- a/mozilla/embedding/tests/wxEmbed/EmbedApp.cpp +++ b/mozilla/embedding/tests/wxEmbed/EmbedApp.cpp @@ -1,11 +1,44 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #include "global.h" #include "nsIProfile.h" +#include "nsIWindowWatcher.h" #include "nsMemory.h" #include "BrowserFrame.h" #include "MailFrame.h" #include "GeckoProtocolHandler.h" +#include "GeckoWindowCreator.h" class FooCallback : public GeckoChannelCallback { @@ -67,7 +100,6 @@ bool EmbedApp::OnInit() return FALSE; } - nsresult rv; nsCOMPtr profileService = do_GetService(NS_PROFILE_CONTRACTID, &rv); @@ -76,12 +108,28 @@ bool EmbedApp::OnInit() rv = profileService->SetCurrentProfile(L"wxEmbed"); if (NS_FAILED(rv)) return FALSE; + GeckoProtocolHandler::RegisterHandler("foo", "Test handler", new FooCallback); + + + // create an nsWindowCreator and give it to the WindowWatcher service + GeckoWindowCreator *creatorCallback = new GeckoWindowCreator(); + if (creatorCallback) + { + nsCOMPtr windowCreator(NS_STATIC_CAST(nsIWindowCreator *, creatorCallback)); + if (windowCreator) + { + nsCOMPtr wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); + if (wwatch) + { + wwatch->SetWindowCreator(windowCreator); + } + } + } // Create the main frame window BrowserFrame* frame = new BrowserFrame(NULL); frame->Show(TRUE); - GeckoProtocolHandler::RegisterHandler("foo", "Test handler", new FooCallback); SetTopWindow(frame); diff --git a/mozilla/embedding/tests/wxEmbed/GeckoContainer.cpp b/mozilla/embedding/tests/wxEmbed/GeckoContainer.cpp index 0fbacfa98fd..38860337770 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoContainer.cpp +++ b/mozilla/embedding/tests/wxEmbed/GeckoContainer.cpp @@ -25,6 +25,8 @@ * * Contributor(s): * + * Adam Lock + * * ***** END LICENSE BLOCK ***** */ // Mozilla Includes @@ -154,6 +156,11 @@ NS_IMETHODIMP GeckoContainer::GetRole(nsACString &aRole) return NS_OK; } +NS_IMETHODIMP GeckoContainer::GetContainerUI(GeckoContainerUI **pUI) +{ + *pUI = mUI; + return NS_OK; +} //***************************************************************************** // GeckoContainer::nsIInterfaceRequestor diff --git a/mozilla/embedding/tests/wxEmbed/GeckoContainer.h b/mozilla/embedding/tests/wxEmbed/GeckoContainer.h index c3ee8936696..55e573fb453 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoContainer.h +++ b/mozilla/embedding/tests/wxEmbed/GeckoContainer.h @@ -25,6 +25,8 @@ * * Contributor(s): * + * Adam Lock + * * ***** END LICENSE BLOCK ***** */ #ifndef __WebBrowserChrome__ @@ -64,6 +66,7 @@ public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IGECKOCONTAINER_IID) NS_IMETHOD GetRole(nsACString &aRole) = 0; + NS_IMETHOD GetContainerUI(GeckoContainerUI **pUI) = 0; }; #define NS_DECL_NSIGECKOCONTAINER @@ -101,7 +104,7 @@ public: // nsIGeckoContainer NS_IMETHOD GetRole(nsACString &aRole); - + NS_IMETHOD GetContainerUI(GeckoContainerUI **pUI); nsresult CreateBrowser(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, nativeWindow aParent, nsIWebBrowser **aBrowser); @@ -128,10 +131,9 @@ protected: class GeckoContainerUI { public: - static nsresult CreateBrowserWindow(PRUint32 aChromeFlags, - GeckoContainer *aParent, - GeckoContainer **aNewWindow); - + // Called by the window creator when a new browser window is requested + virtual nsresult CreateBrowserWindow(PRUint32 aChromeFlags, + nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **aNewWindow); // Called when the content wants to be destroyed (e.g. a window.close() happened) virtual void Destroy(); // Called when the Gecko has been torn down, allowing dangling references to be released diff --git a/mozilla/embedding/tests/wxEmbed/GeckoContainerUI.cpp b/mozilla/embedding/tests/wxEmbed/GeckoContainerUI.cpp index 901967b8a0b..7b81945d118 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoContainerUI.cpp +++ b/mozilla/embedding/tests/wxEmbed/GeckoContainerUI.cpp @@ -1,3 +1,33 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ #include "global.h" @@ -5,8 +35,7 @@ nsresult GeckoContainerUI::CreateBrowserWindow(PRUint32 aChromeFlags, - GeckoContainer *aParent, - GeckoContainer **aNewWindow) + nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **aNewWindow) { return NS_ERROR_FAILURE; } diff --git a/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp b/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp index 37086abd74f..2b7bcc0ca9a 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp +++ b/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * adamlock@netscape.com + * + * ***** END LICENSE BLOCK ***** */ + #include "GeckoProtocolHandler.h" #include "nsString.h" @@ -50,6 +81,42 @@ public: static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); }; + +class GeckoProtocolChannel : + public nsIChannel, + public nsIStreamListener +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIREQUEST + NS_DECL_NSICHANNEL + NS_DECL_NSIREQUESTOBSERVER + NS_DECL_NSISTREAMLISTENER + + GeckoProtocolChannel(); + nsresult Init(nsIURI *aURI); + +protected: + nsCOMPtr mURI; + nsCOMPtr mOriginalURI; + nsCOMPtr mCallbacks; + nsCOMPtr mProgressSink; + nsCOMPtr mOwner; + nsCOMPtr mLoadGroup; + nsCOMPtr mListener; + nsCOMPtr mListenerContext; + nsCOMPtr mContentStream; + nsCString mContentType; + nsCString mContentCharset; + PRUint32 mLoadFlags; + nsresult mStatus; + PRUint32 mContentLength; + void * mData; + nsCOMPtr mPump; + + virtual ~GeckoProtocolChannel(); +}; + nsresult GeckoProtocolHandler::RegisterHandler(const char *aScheme, const char *aDescription, GeckoChannelCallback *aCallback) { if (!aScheme || !aCallback) @@ -97,45 +164,10 @@ nsresult GeckoProtocolHandler::RegisterHandler(const char *aScheme, const char * /////////////////////////////////////////////////////////////////////////////// -class GeckoProtocolChannel : - public nsIChannel, - public nsIStreamListener -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIREQUEST - NS_DECL_NSICHANNEL - NS_DECL_NSIREQUESTOBSERVER - NS_DECL_NSISTREAMLISTENER - - GeckoProtocolChannel(); - nsresult Init(nsIURI *aURI); - -protected: - nsCOMPtr mURI; - nsCOMPtr mOriginalURI; - nsCOMPtr mCallbacks; - nsCOMPtr mProgressSink; - nsCOMPtr mOwner; - nsCOMPtr mLoadGroup; - nsCOMPtr mListener; - nsCOMPtr mListenerContext; - nsCOMPtr mContentStream; - nsCString mContentType; - nsCString mContentCharset; - PRUint32 mLoadFlags; - nsresult mStatus; - PRUint32 mContentLength; - void * mData; - nsCOMPtr mPump; - - virtual ~GeckoProtocolChannel(); -}; - GeckoProtocolChannel::GeckoProtocolChannel() : mContentLength(0), mData(nsnull), - mStatus(NS_OK), + mStatus(NS_ERROR_FAILURE), mLoadFlags(LOAD_NORMAL) { } diff --git a/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.h b/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.h index 72519c0fb66..622fdede48d 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.h +++ b/mozilla/embedding/tests/wxEmbed/GeckoProtocolHandler.h @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #ifndef GECKOPROTOCOLHANDLER_H #define GECKOPROTOCOLHANDLER_H diff --git a/mozilla/embedding/tests/wxEmbed/GeckoWindow.cpp b/mozilla/embedding/tests/wxEmbed/GeckoWindow.cpp index 1ca3d19ae1c..6b95b28bbd3 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoWindow.cpp +++ b/mozilla/embedding/tests/wxEmbed/GeckoWindow.cpp @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #include "global.h" #include "GeckoWindow.h" diff --git a/mozilla/embedding/tests/wxEmbed/GeckoWindow.h b/mozilla/embedding/tests/wxEmbed/GeckoWindow.h index 2fc72722b4c..425153b0973 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoWindow.h +++ b/mozilla/embedding/tests/wxEmbed/GeckoWindow.h @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #ifndef GECKOWND_H_270B94BB_E0EE_44bd_8983_CC43BFA39996 #define GECKOWND_H_270B94BB_E0EE_44bd_8983_CC43BFA39996 @@ -17,6 +48,7 @@ public: GeckoWindow(); virtual ~GeckoWindow(); void SetGeckoContainer(GeckoContainer *aGeckoContainer); + GeckoContainer *GetGeckoContainer() const { return mGeckoContainer; } }; #endif /* GECKOWND_H_270B94BB_E0EE_44bd_8983_CC43BFA39996 */ \ No newline at end of file diff --git a/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.cpp b/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.cpp index c170df76f77..0e3557d60af 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.cpp +++ b/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.cpp @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #include "GeckoWindowCreator.h" #include "GeckoContainer.h" @@ -19,8 +50,27 @@ GeckoWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *parent, nsIWebBrowserChrome **_retval) { NS_ENSURE_ARG_POINTER(_retval); -// AppCallbacks::CreateBrowserWindow(PRInt32(chromeFlags), parent, _retval); - // TODO QI nsIGeckoContainer + *_retval = nsnull; - return *_retval ? NS_OK : NS_ERROR_FAILURE; -} \ No newline at end of file + + if (!parent) + return NS_ERROR_FAILURE; + + nsCOMPtr geckoContainer = do_QueryInterface(parent); + if (!geckoContainer) + return NS_ERROR_FAILURE; + + nsCAutoString role; + geckoContainer->GetRole(role); + if (role.EqualsIgnoreCase("browser")) + { + GeckoContainerUI *pUI = NULL; + geckoContainer->GetContainerUI(&pUI); + if (pUI) + { + return pUI->CreateBrowserWindow(chromeFlags, parent, _retval); + } + } + + return NS_ERROR_FAILURE; +} diff --git a/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.h b/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.h index 71e87ae3322..6f18fd0c1ce 100644 --- a/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.h +++ b/mozilla/embedding/tests/wxEmbed/GeckoWindowCreator.h @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #ifndef GECKOWINDOWCREATOR_H #define GECKOWINDOWCREATOR_H diff --git a/mozilla/embedding/tests/wxEmbed/MailFrame.cpp b/mozilla/embedding/tests/wxEmbed/MailFrame.cpp index 850e27bfac2..a325d2a074a 100644 --- a/mozilla/embedding/tests/wxEmbed/MailFrame.cpp +++ b/mozilla/embedding/tests/wxEmbed/MailFrame.cpp @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #include "global.h" #include "MailFrame.h" @@ -63,7 +94,6 @@ MailFrame::MailFrame(wxWindow* aParent) : gMailChannelCallbackRegistered = TRUE; } - // Set up the article pane wxListCtrl *articleListCtrl = (wxListCtrl *) FindWindowById(XRCID("articles"), this); if (articleListCtrl) diff --git a/mozilla/embedding/tests/wxEmbed/MailFrame.h b/mozilla/embedding/tests/wxEmbed/MailFrame.h index e203393fa95..e7226fb18c7 100644 --- a/mozilla/embedding/tests/wxEmbed/MailFrame.h +++ b/mozilla/embedding/tests/wxEmbed/MailFrame.h @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #ifndef MAILFRAME_H #define MAILFRAME_H diff --git a/mozilla/embedding/tests/wxEmbed/global.h b/mozilla/embedding/tests/wxEmbed/global.h index 4312f0935bd..a1c7e26291b 100644 --- a/mozilla/embedding/tests/wxEmbed/global.h +++ b/mozilla/embedding/tests/wxEmbed/global.h @@ -1,3 +1,34 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + #ifndef GLOBAL_H_D5809FA6_E3E6_4726_9CD4_DE7330D9C2A1 #define GLOBAL_H_D5809FA6_E3E6_4726_9CD4_DE7330D9C2A1 diff --git a/mozilla/embedding/tests/wxEmbed/makefile.vc b/mozilla/embedding/tests/wxEmbed/makefile.vc index e411e505e47..ddfc545d06d 100644 --- a/mozilla/embedding/tests/wxEmbed/makefile.vc +++ b/mozilla/embedding/tests/wxEmbed/makefile.vc @@ -38,6 +38,7 @@ MOZINC = \ -I$(MOZSDK)\include\profile \ -I$(MOZSDK)\include\webbrwsr \ -I$(MOZSDK)\include\embed_base \ + -I$(MOZSDK)\include\windowwatcher \ $(NULL) # This isn't much better either!