diff --git a/camino/src/application/AppDirServiceProvider.cpp b/camino/src/application/AppDirServiceProvider.cpp index 11cc36f8af7..ff11116535b 100644 --- a/camino/src/application/AppDirServiceProvider.cpp +++ b/camino/src/application/AppDirServiceProvider.cpp @@ -53,7 +53,6 @@ AppDirServiceProvider::AppDirServiceProvider(const nsACString& productDirName) { - NS_INIT_ISUPPORTS(); mProductDirName.Assign(productDirName); } diff --git a/camino/src/application/JSConsole.mm b/camino/src/application/JSConsole.mm index 66b1a0365f5..115bb99b52c 100644 --- a/camino/src/application/JSConsole.mm +++ b/camino/src/application/JSConsole.mm @@ -66,7 +66,6 @@ NS_IMPL_ISUPPORTS1(nsConsoleListener, nsIConsoleListener) nsConsoleListener::nsConsoleListener() { - NS_INIT_ISUPPORTS(); } nsConsoleListener::~nsConsoleListener() diff --git a/camino/src/browser/CocoaPromptService.mm b/camino/src/browser/CocoaPromptService.mm index da215b67be5..006600a29ef 100644 --- a/camino/src/browser/CocoaPromptService.mm +++ b/camino/src/browser/CocoaPromptService.mm @@ -50,7 +50,6 @@ CocoaPromptService::CocoaPromptService() { - NS_INIT_ISUPPORTS(); } CocoaPromptService::~CocoaPromptService() diff --git a/camino/src/browser/ContentClickListener.mm b/camino/src/browser/ContentClickListener.mm index 860d4960731..011bef8b907 100644 --- a/camino/src/browser/ContentClickListener.mm +++ b/camino/src/browser/ContentClickListener.mm @@ -58,7 +58,6 @@ NS_IMPL_ISUPPORTS2(ContentClickListener, nsIDOMMouseListener, nsIDOMEventListene ContentClickListener::ContentClickListener(id aBrowserController) :mBrowserController(aBrowserController) { - NS_INIT_ISUPPORTS(); } ContentClickListener::~ContentClickListener() diff --git a/camino/src/browser/RemoteDataProvider.mm b/camino/src/browser/RemoteDataProvider.mm index 1faf3319b57..5d87aacae6c 100644 --- a/camino/src/browser/RemoteDataProvider.mm +++ b/camino/src/browser/RemoteDataProvider.mm @@ -65,7 +65,6 @@ public: , mUserData(inUserData) , mURI(inURI) { - NS_INIT_ISUPPORTS(); [mLoadListener retain]; } @@ -129,7 +128,6 @@ protected: RemoteURILoadManager::RemoteURILoadManager() { - NS_INIT_ISUPPORTS(); } RemoteURILoadManager::~RemoteURILoadManager() diff --git a/camino/src/browser/SecurityDialogs.mm b/camino/src/browser/SecurityDialogs.mm index 2d8c345026e..b6fb52f62b9 100644 --- a/camino/src/browser/SecurityDialogs.mm +++ b/camino/src/browser/SecurityDialogs.mm @@ -50,7 +50,6 @@ SecurityDialogs::SecurityDialogs() { - NS_INIT_ISUPPORTS(); } SecurityDialogs::~SecurityDialogs() diff --git a/camino/src/download/SaveHeaderSniffer.mm b/camino/src/download/SaveHeaderSniffer.mm index 3d55034955b..7e0d2434993 100644 --- a/camino/src/download/SaveHeaderSniffer.mm +++ b/camino/src/download/SaveHeaderSniffer.mm @@ -70,7 +70,6 @@ nsHeaderSniffer::nsHeaderSniffer(nsIWebBrowserPersist* aPersist, nsIFile* aFile, , mBypassCache(aBypassCache) , mFilterView(aFilterView) { - NS_INIT_ISUPPORTS(); } nsHeaderSniffer::~nsHeaderSniffer() diff --git a/camino/src/embedding/CHBrowserListener.mm b/camino/src/embedding/CHBrowserListener.mm index 58681e5b4ca..c5c22a0f68c 100644 --- a/camino/src/embedding/CHBrowserListener.mm +++ b/camino/src/embedding/CHBrowserListener.mm @@ -61,7 +61,6 @@ CHBrowserListener::CHBrowserListener(CHBrowserView* aView) : mView(aView), mContainer(nsnull), mIsModal(PR_FALSE), mChromeFlags(0) { - NS_INIT_ISUPPORTS(); mListeners = [[NSMutableArray alloc] init]; } diff --git a/camino/src/embedding/CHClickListener.mm b/camino/src/embedding/CHClickListener.mm index 6096ce997e7..d66dd08b113 100644 --- a/camino/src/embedding/CHClickListener.mm +++ b/camino/src/embedding/CHClickListener.mm @@ -106,7 +106,6 @@ NS_IMPL_ISUPPORTS2(CHClickListener, nsIDOMMouseListener, nsIDOMEventListener) CHClickListener::CHClickListener() { - NS_INIT_ISUPPORTS(); } CHClickListener::~CHClickListener() diff --git a/camino/src/embedding/CHDownloadFactories.mm b/camino/src/embedding/CHDownloadFactories.mm index ff0a00b0fd0..9fd64d80161 100644 --- a/camino/src/embedding/CHDownloadFactories.mm +++ b/camino/src/embedding/CHDownloadFactories.mm @@ -67,7 +67,6 @@ protected: DownloadListenerFactory::DownloadListenerFactory() : mControllerFactory(nil) { - NS_INIT_ISUPPORTS(); mControllerFactory = [[ChimeraDownloadControllerFactory alloc] init]; } diff --git a/camino/src/embedding/CHDownloadProgressDisplay.mm b/camino/src/embedding/CHDownloadProgressDisplay.mm index fe2ab4bb6ab..5afa48489e7 100644 --- a/camino/src/embedding/CHDownloadProgressDisplay.mm +++ b/camino/src/embedding/CHDownloadProgressDisplay.mm @@ -45,7 +45,6 @@ CHDownloader::CHDownloader() , mDownloadDisplay(nil) , mIsFileSave(PR_FALSE) { - NS_INIT_ISUPPORTS(); } CHDownloader::~CHDownloader() diff --git a/camino/src/history/HistoryDataSource.mm b/camino/src/history/HistoryDataSource.mm index 6c0aac4ff10..1aae4770f37 100644 --- a/camino/src/history/HistoryDataSource.mm +++ b/camino/src/history/HistoryDataSource.mm @@ -68,7 +68,6 @@ public: HistoryRDFObserver(HistoryDataSource* dataSource) : mHistoryDataSource(dataSource) { - NS_INIT_ISUPPORTS(); } virtual ~HistoryRDFObserver() { } diff --git a/embedding/browser/cocoa/src/CHBrowserListener.mm b/embedding/browser/cocoa/src/CHBrowserListener.mm index 4f55b87ccac..e69de29bb2d 100644 --- a/embedding/browser/cocoa/src/CHBrowserListener.mm +++ b/embedding/browser/cocoa/src/CHBrowserListener.mm @@ -1,609 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Chimera code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import - -#import "NSString+Utils.h" - -// Embedding includes -#include "nsIWebBrowser.h" -#include "nsIWebNavigation.h" -#include "nsIURI.h" -#include "nsIDOMWindow.h" -//#include "nsIWidget.h" - -// XPCOM and String includes -#include "nsCRT.h" -#include "nsString.h" -#include "nsCOMPtr.h" - -#import "CHBrowserView.h" - -#include "CHBrowserListener.h" - - -CHBrowserListener::CHBrowserListener(CHBrowserView* aView) - : mView(aView), mContainer(nsnull), mIsModal(PR_FALSE), mChromeFlags(0) -{ - NS_INIT_ISUPPORTS(); - mListeners = [[NSMutableArray alloc] init]; -} - -CHBrowserListener::~CHBrowserListener() -{ - [mListeners release]; - mView = nsnull; - if (mContainer) { - [mContainer release]; - } -} - -NS_IMPL_ISUPPORTS9(CHBrowserListener, - nsIInterfaceRequestor, - nsIWebBrowserChrome, - nsIWindowCreator, - nsIEmbeddingSiteWindow, - nsIEmbeddingSiteWindow2, - nsIWebProgressListener, - nsISupportsWeakReference, - nsIContextMenuListener, - nsITooltipListener) - -// Implementation of nsIInterfaceRequestor -NS_IMETHODIMP -CHBrowserListener::GetInterface(const nsIID &aIID, void** aInstancePtr) -{ - if (aIID.Equals(NS_GET_IID(nsIDOMWindow))) { - nsCOMPtr browser = dont_AddRef([mView getWebBrowser]); - if (browser) - return browser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr); - } - - return QueryInterface(aIID, aInstancePtr); -} - -// Implementation of nsIWindowCreator. The CocoaBrowserService forwards requests -// for a new window that have a parent to us, and we take over from there. -/* nsIWebBrowserChrome createChromeWindow (in nsIWebBrowserChrome parent, in PRUint32 chromeFlags); */ -NS_IMETHODIMP -CHBrowserListener::CreateChromeWindow(nsIWebBrowserChrome *parent, - PRUint32 chromeFlags, - nsIWebBrowserChrome **_retval) -{ - if (parent != this) { -#if DEBUG - NSLog(@"Mismatch in CHBrowserListener::CreateChromeWindow. We should be the owning parent."); -#endif - return NS_ERROR_FAILURE; - } - - CHBrowserView* childView = [mContainer createBrowserWindow: chromeFlags]; - if (!childView) { -#if DEBUG - NSLog(@"No CHBrowserView hooked up for a newly created window yet."); -#endif - return NS_ERROR_FAILURE; - } - - CHBrowserListener* listener = [childView getCocoaBrowserListener]; - if (!listener) { -#if DEBUG - NSLog(@"Uh-oh! No listener yet for a newly created window (nsCocoaBrowserlistener)"); - return NS_ERROR_FAILURE; -#endif - } - -#if DEBUG - NSLog(@"Made a chrome window."); -#endif - - *_retval = listener; - NS_IF_ADDREF(*_retval); - return NS_OK; -} - -// Implementation of nsIContextMenuListener -NS_IMETHODIMP -CHBrowserListener::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent* aEvent, nsIDOMNode* aNode) -{ - [mContainer onShowContextMenu: aContextFlags domEvent: aEvent domNode: aNode]; - return NS_OK; -} - -// Implementation of nsITooltipListener -NS_IMETHODIMP -CHBrowserListener::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) -{ - NSPoint where; - where.x = aXCoords; where.y = aYCoords; - [mContainer onShowTooltip:where withText:[NSString stringWithPRUnichars:aTipText]]; - return NS_OK; -} - -NS_IMETHODIMP -CHBrowserListener::OnHideTooltip() -{ - [mContainer onHideTooltip]; - return NS_OK; -} - -// Implementation of nsIWebBrowserChrome -/* void setStatus (in unsigned long statusType, in wstring status); */ -NS_IMETHODIMP -CHBrowserListener::SetStatus(PRUint32 statusType, const PRUnichar *status) -{ - if (!mContainer) { - return NS_ERROR_FAILURE; - } - - NSString* str = nsnull; - if (status && (*status != PRUnichar(0))) { - str = [NSString stringWithPRUnichars:status]; - } - - [mContainer setStatus:str ofType:(NSStatusType)statusType]; - - return NS_OK; -} - -/* attribute nsIWebBrowser webBrowser; */ -NS_IMETHODIMP -CHBrowserListener::GetWebBrowser(nsIWebBrowser * *aWebBrowser) -{ - NS_ENSURE_ARG_POINTER(aWebBrowser); - if (!mView) { - return NS_ERROR_FAILURE; - } - *aWebBrowser = [mView getWebBrowser]; - - return NS_OK; -} -NS_IMETHODIMP -CHBrowserListener::SetWebBrowser(nsIWebBrowser * aWebBrowser) -{ - if (!mView) { - return NS_ERROR_FAILURE; - } - - [mView setWebBrowser:aWebBrowser]; - - return NS_OK; -} - -/* attribute unsigned long chromeFlags; */ -NS_IMETHODIMP -CHBrowserListener::GetChromeFlags(PRUint32 *aChromeFlags) -{ - NS_ENSURE_ARG_POINTER(aChromeFlags); - *aChromeFlags = mChromeFlags; - return NS_OK; -} -NS_IMETHODIMP -CHBrowserListener::SetChromeFlags(PRUint32 aChromeFlags) -{ - // XXX Do nothing with them for now - mChromeFlags = aChromeFlags; - return NS_OK; -} - -/* void destroyBrowserWindow (); */ -NS_IMETHODIMP -CHBrowserListener::DestroyBrowserWindow() -{ - // XXX Could send this up to the container, but for now, - // we just destroy the enclosing window. - NSWindow* window = [mView window]; - - if (window) { - [window close]; - } - - return NS_OK; -} - -/* void sizeBrowserTo (in long aCX, in long aCY); */ -NS_IMETHODIMP -CHBrowserListener::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY) -{ - if (mContainer) { - NSSize size; - - size.width = (float)aCX; - size.height = (float)aCY; - - [mContainer sizeBrowserTo:size]; - } - - return NS_OK; -} - -/* void showAsModal (); */ -NS_IMETHODIMP -CHBrowserListener::ShowAsModal() -{ - if (!mView) { - return NS_ERROR_FAILURE; - } - - NSWindow* window = [mView window]; - - if (!window) { - return NS_ERROR_FAILURE; - } - - mIsModal = PR_TRUE; - //int result = [NSApp runModalForWindow:window]; - mIsModal = PR_FALSE; - - return NS_OK; -} - -/* boolean isWindowModal (); */ -NS_IMETHODIMP -CHBrowserListener::IsWindowModal(PRBool *_retval) -{ - NS_ENSURE_ARG_POINTER(_retval); - - *_retval = mIsModal; - - return NS_OK; -} - -/* void exitModalEventLoop (in nsresult aStatus); */ -NS_IMETHODIMP -CHBrowserListener::ExitModalEventLoop(nsresult aStatus) -{ -// [NSApp stopModalWithCode:(int)aStatus]; - - return NS_OK; -} - -// Implementation of nsIEmbeddingSiteWindow2 -NS_IMETHODIMP -CHBrowserListener::Blur() -{ - return NS_OK; -} - -// Implementation of nsIEmbeddingSiteWindow -/* void setDimensions (in unsigned long flags, in long x, in long y, in long cx, in long cy); */ -NS_IMETHODIMP -CHBrowserListener::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) -{ - if (!mView) - return NS_ERROR_FAILURE; - - NSWindow* window = [mView window]; - if (!window) - return NS_ERROR_FAILURE; - - if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { - NSPoint origin; - origin.x = (float)x; - origin.y = (float)y; - - // websites assume the origin is the topleft of the window and that the screen origin - // is "topleft" (quickdraw coordinates). As a result, we have to convert it. - GDHandle screenDevice = ::GetMainDevice(); - Rect screenRect = (**screenDevice).gdRect; - short screenHeight = screenRect.bottom - screenRect.top; - origin.y = screenHeight - origin.y; - - [window setFrameTopLeftPoint:origin]; - } - - if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) { - NSRect frame = [window frame]; - frame.size.width = (float)cx; - frame.size.height = (float)cy; - [window setFrame:frame display:YES]; - } - else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) { - NSSize size; - size.width = (float)cx; - size.height = (float)cy; - [window setContentSize:size]; - } - - return NS_OK; -} - -/* void getDimensions (in unsigned long flags, out long x, out long y, out long cx, out long cy); */ -NS_IMETHODIMP -CHBrowserListener::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy) -{ - if (!mView) - return NS_ERROR_FAILURE; - - NSWindow* window = [mView window]; - if (!window) - return NS_ERROR_FAILURE; - - NSRect frame = [window frame]; - if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { - if ( x ) - *x = (PRInt32)frame.origin.x; - if ( y ) - *y = (PRInt32)frame.origin.y; - } - if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) { - if ( cx ) - *cx = (PRInt32)frame.size.width; - if ( cy ) - *cy = (PRInt32)frame.size.height; - } - else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) { - NSView* contentView = [window contentView]; - NSRect contentFrame = [contentView frame]; - if ( cx ) - *cx = (PRInt32)contentFrame.size.width; - if ( cy ) - *cy = (PRInt32)contentFrame.size.height; - } - - return NS_OK; -} - -/* void setFocus (); */ -NS_IMETHODIMP -CHBrowserListener::SetFocus() -{ - if (!mView) { - return NS_ERROR_FAILURE; - } - - NSWindow* window = [mView window]; - if (!window) { - return NS_ERROR_FAILURE; - } - - [window makeKeyAndOrderFront:window]; - - return NS_OK; -} - -/* attribute boolean visibility; */ -NS_IMETHODIMP -CHBrowserListener::GetVisibility(PRBool *aVisibility) -{ - NS_ENSURE_ARG_POINTER(aVisibility); - - if (!mView) { - return NS_ERROR_FAILURE; - } - - NSWindow* window = [mView window]; - if (!window) { - return NS_ERROR_FAILURE; - } - - *aVisibility = [window isMiniaturized]; - - return NS_OK; -} -NS_IMETHODIMP -CHBrowserListener::SetVisibility(PRBool aVisibility) -{ - if (!mView) { - return NS_ERROR_FAILURE; - } - - NSWindow* window = [mView window]; - if (!window) { - return NS_ERROR_FAILURE; - } - - if (aVisibility) { - [window deminiaturize:window]; - } - else { - [window miniaturize:window]; - } - - return NS_OK; -} - -/* attribute wstring title; */ -NS_IMETHODIMP -CHBrowserListener::GetTitle(PRUnichar * *aTitle) -{ - NS_ENSURE_ARG_POINTER(aTitle); - - if (!mContainer) { - return NS_ERROR_FAILURE; - } - - NSString* title = [mContainer title]; - unsigned int length = [title length]; - if (length) { - *aTitle = (PRUnichar*)nsMemory::Alloc((length+1)*sizeof(PRUnichar)); - if (!*aTitle) { - return NS_ERROR_OUT_OF_MEMORY; - } - [title getCharacters:*aTitle]; - } - else { - *aTitle = nsnull; - } - - return NS_OK; -} -NS_IMETHODIMP -CHBrowserListener::SetTitle(const PRUnichar * aTitle) -{ - NS_ENSURE_ARG(aTitle); - - if (!mContainer) { - return NS_ERROR_FAILURE; - } - - NSString* str = [NSString stringWithPRUnichars:aTitle]; - [mContainer setTitle:str]; - - return NS_OK; -} - -/* [noscript] readonly attribute voidPtr siteWindow; */ -NS_IMETHODIMP -CHBrowserListener::GetSiteWindow(void * *aSiteWindow) -{ - NS_ENSURE_ARG_POINTER(aSiteWindow); - *aSiteWindow = nsnull; - if (!mView) { - return NS_ERROR_FAILURE; - } - - NSWindow* window = [mView window]; - if (!window) { - return NS_ERROR_FAILURE; - } - - *aSiteWindow = (void*)window; - - return NS_OK; -} - - -// -// Implementation of nsIWebProgressListener -// - -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in unsigned long aStatus); */ -NS_IMETHODIMP -CHBrowserListener::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRUint32 aStateFlags, PRUint32 aStatus) -{ - NSEnumerator* enumerator = [mListeners objectEnumerator]; - id obj; - - if (aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK) { - if (aStateFlags & nsIWebProgressListener::STATE_START) { - while ((obj = [enumerator nextObject])) - [obj onLoadingStarted]; - } - else if (aStateFlags & nsIWebProgressListener::STATE_STOP) { - while ((obj = [enumerator nextObject])) - [obj onLoadingCompleted:(NS_SUCCEEDED(aStatus))]; - } - } - - return NS_OK; -} - -/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ -NS_IMETHODIMP -CHBrowserListener::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, - PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) -{ - NSEnumerator* enumerator = [mListeners objectEnumerator]; - id obj; - while ((obj = [enumerator nextObject])) - [obj onProgressChange:aCurTotalProgress outOf:aMaxTotalProgress]; - - return NS_OK; -} - -/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ -NS_IMETHODIMP -CHBrowserListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, - nsIURI *location) -{ - if (!location) - return NS_ERROR_FAILURE; - - nsCAutoString spec; - location->GetSpec(spec); - NSString* str = [NSString stringWithCString:spec.get()]; - - NSEnumerator* enumerator = [mListeners objectEnumerator]; - id obj; - while ((obj = [enumerator nextObject])) - [obj onLocationChange:str]; - - return NS_OK; -} - -/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP -CHBrowserListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, - const PRUnichar *aMessage) -{ - NSString* str = [NSString stringWithPRUnichars:aMessage]; - - NSEnumerator* enumerator = [mListeners objectEnumerator]; - id obj; - while ((obj = [enumerator nextObject])) - [obj onStatusChange: str]; - - return NS_OK; -} - -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ -NS_IMETHODIMP -CHBrowserListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) -{ - NSEnumerator* enumerator = [mListeners objectEnumerator]; - id obj; - while ((obj = [enumerator nextObject])) - [obj onSecurityStateChange: state]; - - return NS_OK; -} - -void -CHBrowserListener::AddListener(id aListener) -{ - [mListeners addObject:aListener]; -} - -void -CHBrowserListener::RemoveListener(id aListener) -{ - [mListeners removeObject:aListener]; -} - -void -CHBrowserListener::SetContainer(id aContainer) -{ - [mContainer autorelease]; - - mContainer = aContainer; - - [mContainer retain]; -} - diff --git a/embedding/browser/cocoa/src/CHBrowserService.mm b/embedding/browser/cocoa/src/CHBrowserService.mm index 40c675d9c7e..fd659b35f12 100644 --- a/embedding/browser/cocoa/src/CHBrowserService.mm +++ b/embedding/browser/cocoa/src/CHBrowserService.mm @@ -63,7 +63,6 @@ PRBool CHBrowserService::sCanTerminate = PR_FALSE; // CHBrowserService implementation CHBrowserService::CHBrowserService() { - NS_INIT_ISUPPORTS(); } CHBrowserService::~CHBrowserService() diff --git a/embedding/browser/cocoa/src/CHClickListener.mm b/embedding/browser/cocoa/src/CHClickListener.mm index a8ef0a0d57f..da70b3cd326 100644 --- a/embedding/browser/cocoa/src/CHClickListener.mm +++ b/embedding/browser/cocoa/src/CHClickListener.mm @@ -108,7 +108,6 @@ NS_IMPL_ISUPPORTS2(CHClickListener, nsIDOMMouseListener, nsIDOMEventListener) CHClickListener::CHClickListener() { - NS_INIT_ISUPPORTS(); } CHClickListener::~CHClickListener() diff --git a/embedding/browser/cocoa/src/CHDownloadFactories.mm b/embedding/browser/cocoa/src/CHDownloadFactories.mm index 07fc6dcd7e5..e69de29bb2d 100644 --- a/embedding/browser/cocoa/src/CHDownloadFactories.mm +++ b/embedding/browser/cocoa/src/CHDownloadFactories.mm @@ -1,122 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Chimera code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -// This file contains implementations of factories for various -// downloading-related interfaces. - -#warning ProgressDlgController shouldnt be included in embedding -#import "ProgressDlgController.h" - -#import "CHDownloadProgressDisplay.h" - -#include "nsCOMPtr.h" -#include "nsIFactory.h" - -#include "nsDownloadListener.h" -#include "CHDownloadFactories.h" - -// factory for nsIDownload objects -// XXX replace with generic factory stuff -class DownloadListenerFactory : public nsIFactory -{ -public: - DownloadListenerFactory(); - virtual ~DownloadListenerFactory(); - - NS_DECL_ISUPPORTS - NS_DECL_NSIFACTORY - -protected: - - DownloadControllerFactory* mControllerFactory; // factory which creates the Cocoa window controller -}; - - -DownloadListenerFactory::DownloadListenerFactory() -: mControllerFactory(nil) -{ - NS_INIT_ISUPPORTS(); - mControllerFactory = [[ChimeraDownloadControllerFactory alloc] init]; -} - -DownloadListenerFactory::~DownloadListenerFactory() -{ - [mControllerFactory release]; -} - -NS_IMPL_ISUPPORTS1(DownloadListenerFactory, nsIFactory) - -/* void createInstance (in nsISupports aOuter, in nsIIDRef iid, [iid_is (iid), retval] out nsQIResult result); */ -NS_IMETHODIMP -DownloadListenerFactory::CreateInstance(nsISupports *aOuter, const nsIID& aIID, void* *aResult) -{ - nsresult rv; - - if (aIID.Equals(NS_GET_IID(nsIDownload))) - { - nsDownloadListener* downloadListener = new nsDownloadListener(mControllerFactory); - if (!downloadListener) return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(downloadListener); - rv = downloadListener->QueryInterface(aIID, aResult); - NS_RELEASE(downloadListener); - return rv; - } - - return NS_ERROR_NO_INTERFACE; -} - -/* void lockFactory (in PRBool lock); */ -NS_IMETHODIMP -DownloadListenerFactory::LockFactory(PRBool lock) -{ - return NS_OK; -} - -#pragma mark - - -nsresult NewDownloadListenerFactory(nsIFactory* *outFactory) -{ - DownloadListenerFactory* newFactory = new DownloadListenerFactory(); - if (!newFactory) return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(newFactory); - nsresult rv = newFactory->QueryInterface(NS_GET_IID(nsIFactory), (void **)outFactory); - NS_RELEASE(newFactory); - return rv; -} - diff --git a/embedding/browser/cocoa/src/CHDownloadProgressDisplay.mm b/embedding/browser/cocoa/src/CHDownloadProgressDisplay.mm index f33349c987c..e69de29bb2d 100644 --- a/embedding/browser/cocoa/src/CHDownloadProgressDisplay.mm +++ b/embedding/browser/cocoa/src/CHDownloadProgressDisplay.mm @@ -1,76 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Chimera code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import "CHDownloadProgressDisplay.h" - - -@implementation DownloadControllerFactory - -- (NSWindowController *)createDownloadController -{ - // a dummy implementation. You should provide a subclass that - // returns an instance of your progress dialog controller. - return nil; -} - -@end - -#pragma mark - - -// see the header file for comments -CHDownloader::CHDownloader(DownloadControllerFactory* inControllerFactory) -: mControllerFactory(inControllerFactory) -, mDownloadDisplay(nil) -, mIsFileSave(PR_FALSE) -{ - NS_INIT_ISUPPORTS(); - [mControllerFactory retain]; -} - -CHDownloader::~CHDownloader() -{ - [mControllerFactory release]; -} - -NS_IMPL_ISUPPORTS1(CHDownloader, nsISupports) - -void -CHDownloader::CreateDownloadDisplay() -{ - mDownloadDisplay = [mControllerFactory createDownloadController]; - [mDownloadDisplay setDownloadListener:this]; -} diff --git a/embedding/browser/cocoa/src/SaveHeaderSniffer.mm b/embedding/browser/cocoa/src/SaveHeaderSniffer.mm index de5c7f4c5f8..2b90f513d36 100644 --- a/embedding/browser/cocoa/src/SaveHeaderSniffer.mm +++ b/embedding/browser/cocoa/src/SaveHeaderSniffer.mm @@ -66,7 +66,6 @@ nsHeaderSniffer::nsHeaderSniffer(nsIWebBrowserPersist* aPersist, nsIFile* aFile, , mFilterView(aFilterView) , mFilterList(aFilterList) { - NS_INIT_ISUPPORTS(); } nsHeaderSniffer::~nsHeaderSniffer() diff --git a/embedding/browser/photon/src/EmbedEventListener.cpp b/embedding/browser/photon/src/EmbedEventListener.cpp index 3f7a6e38fb2..1da6171c7e8 100644 --- a/embedding/browser/photon/src/EmbedEventListener.cpp +++ b/embedding/browser/photon/src/EmbedEventListener.cpp @@ -30,7 +30,6 @@ EmbedEventListener::EmbedEventListener(void) { - NS_INIT_ISUPPORTS(); mOwner = nsnull; } diff --git a/embedding/browser/photon/src/EmbedProgress.cpp b/embedding/browser/photon/src/EmbedProgress.cpp index 9ae3977cd7c..e40e2640024 100644 --- a/embedding/browser/photon/src/EmbedProgress.cpp +++ b/embedding/browser/photon/src/EmbedProgress.cpp @@ -47,7 +47,6 @@ EmbedProgress::EmbedProgress(void) { - NS_INIT_ISUPPORTS(); mOwner = nsnull; mSkipOnState = mDownloadDocument = 0; } diff --git a/embedding/browser/photon/src/EmbedStream.cpp b/embedding/browser/photon/src/EmbedStream.cpp index 2afcd90ad04..787dd619b0d 100644 --- a/embedding/browser/photon/src/EmbedStream.cpp +++ b/embedding/browser/photon/src/EmbedStream.cpp @@ -41,7 +41,6 @@ NS_IMPL_ISUPPORTS1(EmbedStream, nsIInputStream) EmbedStream::EmbedStream() { - NS_INIT_ISUPPORTS(); mOwner = nsnull; mOffset = 0; mDoingStream = PR_FALSE; diff --git a/embedding/browser/photon/src/EmbedWindow.cpp b/embedding/browser/photon/src/EmbedWindow.cpp index 02b9243378f..3d18d728a5c 100644 --- a/embedding/browser/photon/src/EmbedWindow.cpp +++ b/embedding/browser/photon/src/EmbedWindow.cpp @@ -51,7 +51,6 @@ PtWidget_t *EmbedWindow::sTipWindow = nsnull; EmbedWindow::EmbedWindow(void) { - NS_INIT_ISUPPORTS(); mOwner = nsnull; mVisibility = PR_FALSE; mIsModal = PR_FALSE; diff --git a/embedding/browser/photon/src/EmbedWindowCreator.cpp b/embedding/browser/photon/src/EmbedWindowCreator.cpp index e6c4f504a1f..fa166fedfbf 100644 --- a/embedding/browser/photon/src/EmbedWindowCreator.cpp +++ b/embedding/browser/photon/src/EmbedWindowCreator.cpp @@ -29,7 +29,6 @@ EmbedWindowCreator::EmbedWindowCreator(void) { - NS_INIT_ISUPPORTS(); } EmbedWindowCreator::~EmbedWindowCreator() diff --git a/embedding/browser/photon/src/PromptService.cpp b/embedding/browser/photon/src/PromptService.cpp index b44631973c7..f4d23ccb493 100644 --- a/embedding/browser/photon/src/PromptService.cpp +++ b/embedding/browser/photon/src/PromptService.cpp @@ -84,7 +84,6 @@ NS_IMPL_ISUPPORTS2(CPromptService, nsIPromptService, nsPIPromptService) CPromptService::CPromptService() : mWWatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")) { - NS_INIT_ISUPPORTS(); } CPromptService::~CPromptService() { @@ -386,7 +385,6 @@ NS_IMPL_ISUPPORTS1(CPromptServiceFactory, nsIFactory) CPromptServiceFactory::CPromptServiceFactory() { - NS_INIT_ISUPPORTS(); } CPromptServiceFactory::~CPromptServiceFactory() { diff --git a/embedding/browser/photon/src/nsPrintSettingsImpl.cpp b/embedding/browser/photon/src/nsPrintSettingsImpl.cpp index a995963fecf..94987164922 100644 --- a/embedding/browser/photon/src/nsPrintSettingsImpl.cpp +++ b/embedding/browser/photon/src/nsPrintSettingsImpl.cpp @@ -66,8 +66,6 @@ nsPrintSettings::nsPrintSettings() : mPrintPageDelay(500), mPrintSilent(PR_FALSE) { - NS_INIT_ISUPPORTS(); - /* member initializers and constructor code */ nscoord halfInch = NS_INCHES_TO_TWIPS(0.5); mMargin.SizeTo(halfInch, halfInch, halfInch, halfInch); diff --git a/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp b/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp index cb600c9b513..4a44f05d533 100644 --- a/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp +++ b/embedding/browser/photon/src/nsUnknownContentTypeHandler.cpp @@ -53,7 +53,6 @@ #include nsUnknownContentTypeHandler::nsUnknownContentTypeHandler( ) { - NS_INIT_ISUPPORTS(); } nsUnknownContentTypeHandler::~nsUnknownContentTypeHandler( ) { } @@ -153,7 +152,6 @@ PtWidget_t *nsUnknownContentTypeHandler::GetWebBrowser(nsIDOMWindow *aWindow) NS_IMPL_ISUPPORTS2(nsWebProgressListener, nsIWebProgressListener, nsISupportsWeakReference) nsWebProgressListener::nsWebProgressListener() { - NS_INIT_ISUPPORTS(); } nsWebProgressListener::~nsWebProgressListener() { } diff --git a/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp b/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp index 975a576edbd..2e38e57fea9 100644 --- a/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp +++ b/extensions/layout-debug/src/nsLayoutDebuggingTools.cpp @@ -137,8 +137,6 @@ nsLayoutDebuggingTools::nsLayoutDebuggingTools() mCrossingEventDumping(PR_FALSE), mReflowCounts(PR_FALSE) { - NS_INIT_ISUPPORTS(); - NewURILoaded(); } diff --git a/extensions/p3p/src/nsPolicyReference.cpp b/extensions/p3p/src/nsPolicyReference.cpp index 480587a315b..0406bb963e8 100755 --- a/extensions/p3p/src/nsPolicyReference.cpp +++ b/extensions/p3p/src/nsPolicyReference.cpp @@ -78,7 +78,6 @@ nsPolicyReference::nsPolicyReference() : mFlags (0), mError (0) { - NS_INIT_ISUPPORTS(); } nsPolicyReference::~nsPolicyReference() diff --git a/extensions/spellcheck/myspell/src/mozMySpell.cpp b/extensions/spellcheck/myspell/src/mozMySpell.cpp index a525807d2dc..522382a46d8 100644 --- a/extensions/spellcheck/myspell/src/mozMySpell.cpp +++ b/extensions/spellcheck/myspell/src/mozMySpell.cpp @@ -73,7 +73,6 @@ const PRInt32 kFirstDirSize=8; mozMySpell::mozMySpell() { - NS_INIT_ISUPPORTS(); } mozMySpell::~mozMySpell() diff --git a/extensions/spellcheck/src/mozGenericWordUtils.cpp b/extensions/spellcheck/src/mozGenericWordUtils.cpp index 5bc32b9a3bd..ad795891852 100644 --- a/extensions/spellcheck/src/mozGenericWordUtils.cpp +++ b/extensions/spellcheck/src/mozGenericWordUtils.cpp @@ -42,7 +42,6 @@ NS_IMPL_ISUPPORTS1(mozGenericWordUtils, mozISpellI18NUtil) mozGenericWordUtils::mozGenericWordUtils() { - NS_INIT_ISUPPORTS(); /* member initializers and constructor code */ } diff --git a/extensions/spellcheck/src/mozSpellChecker.cpp b/extensions/spellcheck/src/mozSpellChecker.cpp index ddd2bc7dbe3..62de8346b3b 100644 --- a/extensions/spellcheck/src/mozSpellChecker.cpp +++ b/extensions/spellcheck/src/mozSpellChecker.cpp @@ -44,7 +44,6 @@ NS_IMPL_ISUPPORTS1(mozSpellChecker, nsISpellChecker) mozSpellChecker::mozSpellChecker() { - NS_INIT_ISUPPORTS(); mDictionaryName.SetLength(0); nsresult rv; diff --git a/extensions/spellcheck/src/mozSpellI18NManager.cpp b/extensions/spellcheck/src/mozSpellI18NManager.cpp index 7f7aa3b8c0c..a60545cf4dd 100644 --- a/extensions/spellcheck/src/mozSpellI18NManager.cpp +++ b/extensions/spellcheck/src/mozSpellI18NManager.cpp @@ -44,7 +44,6 @@ NS_IMPL_ISUPPORTS1(mozSpellI18NManager, mozISpellI18NManager) mozSpellI18NManager::mozSpellI18NManager() { - NS_INIT_ISUPPORTS(); /* member initializers and constructor code */ } diff --git a/extensions/sql/base/src/mozSqlConnection.cpp b/extensions/sql/base/src/mozSqlConnection.cpp index 14e3b03ece5..dea0422cdaa 100644 --- a/extensions/sql/base/src/mozSqlConnection.cpp +++ b/extensions/sql/base/src/mozSqlConnection.cpp @@ -9,7 +9,6 @@ mozSqlConnection::mozSqlConnection() mShutdown(PR_FALSE), mWaiting(PR_FALSE) { - NS_INIT_ISUPPORTS(); mExecLock = PR_NewLock(); } diff --git a/extensions/sql/base/src/mozSqlRequest.cpp b/extensions/sql/base/src/mozSqlRequest.cpp index 6a84819761f..a7bedd37bbb 100644 --- a/extensions/sql/base/src/mozSqlRequest.cpp +++ b/extensions/sql/base/src/mozSqlRequest.cpp @@ -6,7 +6,6 @@ mozSqlRequest::mozSqlRequest(mozISqlConnection* aConnection) mIsQuery(PR_TRUE), mStatus(mozISqlRequest::STATUS_NONE) { - NS_INIT_ISUPPORTS(); mConnection = do_GetWeakReference(aConnection); } diff --git a/extensions/sql/base/src/mozSqlResult.cpp b/extensions/sql/base/src/mozSqlResult.cpp index c3c4bc51715..2fe076c6da8 100644 --- a/extensions/sql/base/src/mozSqlResult.cpp +++ b/extensions/sql/base/src/mozSqlResult.cpp @@ -31,7 +31,6 @@ mozSqlResult::mozSqlResult(mozISqlConnection* aConnection, mCanUpdate(-1), mCanDelete(-1) { - NS_INIT_ISUPPORTS(); } nsresult @@ -1177,7 +1176,6 @@ mozSqlResultEnumerator::mozSqlResultEnumerator(mozSqlResult* aResult) mCurrentIndex(-1), mCurrentRow(nsnull) { - NS_INIT_ISUPPORTS(); NS_ADDREF(mResult); mBuffer = Row::Create(mResult->mAllocator, nsnull, mResult->mColumnInfo); @@ -1778,7 +1776,6 @@ mozSqlResultStream::mozSqlResultStream(mozSqlResult* aResult) mLength(0), mPosition(0) { - NS_INIT_ISUPPORTS(); NS_ADDREF(mResult); } diff --git a/extensions/sql/base/src/mozSqlService.cpp b/extensions/sql/base/src/mozSqlService.cpp index 298b2575314..674033b0334 100644 --- a/extensions/sql/base/src/mozSqlService.cpp +++ b/extensions/sql/base/src/mozSqlService.cpp @@ -33,7 +33,6 @@ nsIRDFResource* mozSqlService::kSQL_Database; mozSqlService::mozSqlService() : mConnectionCache(nsnull) { - NS_INIT_ISUPPORTS(); } mozSqlService::~mozSqlService() diff --git a/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp b/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp index a439179f21e..352ac767b4b 100644 --- a/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp +++ b/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp @@ -49,7 +49,6 @@ nsDeviceContextSpecFactoryPh :: nsDeviceContextSpecFactoryPh() { - NS_INIT_ISUPPORTS(); } nsDeviceContextSpecFactoryPh :: ~nsDeviceContextSpecFactoryPh() diff --git a/gfx/src/photon/nsDeviceContextSpecPh.cpp b/gfx/src/photon/nsDeviceContextSpecPh.cpp index a44d9e2451d..823053d8af7 100644 --- a/gfx/src/photon/nsDeviceContextSpecPh.cpp +++ b/gfx/src/photon/nsDeviceContextSpecPh.cpp @@ -58,7 +58,6 @@ nsDeviceContextSpecPh :: nsDeviceContextSpecPh() { - NS_INIT_ISUPPORTS(); mPC = PpCreatePC(); } @@ -186,7 +185,6 @@ PpPrintContext_t *nsDeviceContextSpecPh :: GetPrintContext() //*********************************************************** nsPrinterEnumeratorPh::nsPrinterEnumeratorPh() { - NS_INIT_ISUPPORTS(); } nsPrinterEnumeratorPh::~nsPrinterEnumeratorPh() diff --git a/gfx/src/photon/nsDrawingSurfacePh.cpp b/gfx/src/photon/nsDrawingSurfacePh.cpp index 74bf3656f61..8042e8b16e6 100644 --- a/gfx/src/photon/nsDrawingSurfacePh.cpp +++ b/gfx/src/photon/nsDrawingSurfacePh.cpp @@ -72,8 +72,6 @@ NS_IMPL_ISUPPORTS2( nsDrawingSurfacePh, nsIDrawingSurface, nsIDrawingSurfacePh ) nsDrawingSurfacePh :: nsDrawingSurfacePh( ) { - NS_INIT_ISUPPORTS(); - mDrawContext = nsnull; mGC = nsnull; mWidth = 0; diff --git a/gfx/src/photon/nsFontMetricsPh.cpp b/gfx/src/photon/nsFontMetricsPh.cpp index c2d8ddae39f..18c38b2a971 100644 --- a/gfx/src/photon/nsFontMetricsPh.cpp +++ b/gfx/src/photon/nsFontMetricsPh.cpp @@ -61,7 +61,6 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); nsFontMetricsPh::nsFontMetricsPh() { - NS_INIT_ISUPPORTS(); mDeviceContext = nsnull; mFont = nsnull; @@ -300,7 +299,6 @@ struct nsFontFamily // The Font Enumerator nsFontEnumeratorPh::nsFontEnumeratorPh() { - NS_INIT_ISUPPORTS(); } NS_IMPL_ISUPPORTS1(nsFontEnumeratorPh, nsIFontEnumerator) diff --git a/gfx/src/photon/nsImagePh.cpp b/gfx/src/photon/nsImagePh.cpp index 5f76939b6c9..e2e0873e384 100644 --- a/gfx/src/photon/nsImagePh.cpp +++ b/gfx/src/photon/nsImagePh.cpp @@ -187,7 +187,6 @@ NS_IMPL_ISUPPORTS1(nsImagePh, nsIImage) // ---------------------------------------------------------------- nsImagePh :: nsImagePh() { - NS_INIT_ISUPPORTS(); mImageBits = nsnull; mWidth = 0; mHeight = 0; diff --git a/gfx/src/photon/nsRegionPh.h b/gfx/src/photon/nsRegionPh.h index 42e1e1db721..c778828af2c 100644 --- a/gfx/src/photon/nsRegionPh.h +++ b/gfx/src/photon/nsRegionPh.h @@ -48,14 +48,12 @@ class nsRegionPh : public nsIRegion public: inline nsRegionPh() { - NS_INIT_ISUPPORTS(); mRegion = NULL; mRegionType = eRegionComplexity_empty; } inline nsRegionPh(PhTile_t *tiles) { - NS_INIT_ISUPPORTS(); mRegion = tiles; /* assume ownership */ mRegionType = (mRegion == NULL) ? eRegionComplexity_empty : eRegionComplexity_complex; } diff --git a/gfx/src/photon/nsRenderingContextPh.cpp b/gfx/src/photon/nsRenderingContextPh.cpp index 941d5103ac1..1db13dbb779 100644 --- a/gfx/src/photon/nsRenderingContextPh.cpp +++ b/gfx/src/photon/nsRenderingContextPh.cpp @@ -62,8 +62,6 @@ NS_IMPL_ISUPPORTS1(nsRenderingContextPh, nsIRenderingContext) nsRenderingContextPh :: nsRenderingContextPh() { - NS_INIT_ISUPPORTS(); - mGC = nsnull; mTranMatrix = nsnull; mClipRegion = nsnull; diff --git a/gfx/src/photon/nsScreenManagerPh.cpp b/gfx/src/photon/nsScreenManagerPh.cpp index d9afbac9da9..4132430c73e 100644 --- a/gfx/src/photon/nsScreenManagerPh.cpp +++ b/gfx/src/photon/nsScreenManagerPh.cpp @@ -42,7 +42,6 @@ #include "nsPhGfxLog.h" nsScreenManagerPh :: nsScreenManagerPh( ) { - NS_INIT_ISUPPORTS(); // nothing else to do. I guess we could cache a bunch of information // here, but we want to ask the device at runtime in case anything // has changed. diff --git a/gfx/src/photon/nsScreenPh.cpp b/gfx/src/photon/nsScreenPh.cpp index 1cf9b5ffa38..bb7e5b6bc62 100644 --- a/gfx/src/photon/nsScreenPh.cpp +++ b/gfx/src/photon/nsScreenPh.cpp @@ -49,8 +49,6 @@ nsScreenPh :: nsScreenPh ( ) { PhRid_t rid; PhRegion_t region; - NS_INIT_ISUPPORTS(); - p = NULL; /* Initialize the data members */ diff --git a/intl/ctl/src/nsUnicodeToSunIndic.cpp b/intl/ctl/src/nsUnicodeToSunIndic.cpp index d4e836917cd..545a5c3a456 100644 --- a/intl/ctl/src/nsUnicodeToSunIndic.cpp +++ b/intl/ctl/src/nsUnicodeToSunIndic.cpp @@ -50,8 +50,6 @@ nsUnicodeToSunIndic::nsUnicodeToSunIndic() static NS_DEFINE_CID(kLECID, NS_ULE_CID); nsresult rv; - NS_INIT_ISUPPORTS(); - mCtlObj = do_CreateInstance(kLECID, &rv); if (NS_FAILED(rv)) { diff --git a/intl/ctl/src/nsUnicodeToTIS620.cpp b/intl/ctl/src/nsUnicodeToTIS620.cpp index 15914e486b0..1bf535e2a3b 100644 --- a/intl/ctl/src/nsUnicodeToTIS620.cpp +++ b/intl/ctl/src/nsUnicodeToTIS620.cpp @@ -48,8 +48,6 @@ nsUnicodeToTIS620::nsUnicodeToTIS620() static NS_DEFINE_CID(kLECID, NS_ULE_CID); nsresult rv; - NS_INIT_ISUPPORTS(); - mCtlObj = do_CreateInstance(kLECID, &rv); if (NS_FAILED(rv)) { #ifdef DEBUG_prabhath diff --git a/intl/unicharutil/src/nsUnicodeNormalizer.cpp b/intl/unicharutil/src/nsUnicodeNormalizer.cpp index 252c64bf685..e239c307044 100644 --- a/intl/unicharutil/src/nsUnicodeNormalizer.cpp +++ b/intl/unicharutil/src/nsUnicodeNormalizer.cpp @@ -98,7 +98,6 @@ NS_IMPL_ISUPPORTS1(nsUnicodeNormalizer, nsIUnicodeNormalizer) nsUnicodeNormalizer::nsUnicodeNormalizer() { - NS_INIT_ISUPPORTS(); } nsUnicodeNormalizer::~nsUnicodeNormalizer() diff --git a/ipc/ipcd/client/src/ipcService.cpp b/ipc/ipcd/client/src/ipcService.cpp index 0ea7b5d8b9b..10287a64f6d 100644 --- a/ipc/ipcd/client/src/ipcService.cpp +++ b/ipc/ipcd/client/src/ipcService.cpp @@ -152,8 +152,6 @@ ipcService::ipcService() : mTransport(nsnull) , mClientID(0) { - NS_INIT_ISUPPORTS(); - IPC_InitLog(">>>"); } diff --git a/ipc/ipcd/test/TestIPC.cpp b/ipc/ipcd/test/TestIPC.cpp index 0fe0ee95e34..44de0440775 100644 --- a/ipc/ipcd/test/TestIPC.cpp +++ b/ipc/ipcd/test/TestIPC.cpp @@ -96,7 +96,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_IPCIMESSAGEOBSERVER - myIpcMessageObserver() { NS_INIT_ISUPPORTS(); } + myIpcMessageObserver() {} }; NS_IMPL_ISUPPORTS1(myIpcMessageObserver, ipcIMessageObserver) diff --git a/mailnews/base/src/nsMessengerContentHandler.cpp b/mailnews/base/src/nsMessengerContentHandler.cpp index b43da8855f0..f1f95cbc941 100644 --- a/mailnews/base/src/nsMessengerContentHandler.cpp +++ b/mailnews/base/src/nsMessengerContentHandler.cpp @@ -50,7 +50,6 @@ nsMessengerContentHandler::nsMessengerContentHandler() { - NS_INIT_ISUPPORTS(); } /* the following macro actually implement addref, release and query interface for our component. */ diff --git a/netwerk/dns/src/nsIDNService.cpp b/netwerk/dns/src/nsIDNService.cpp index 51b0eaa564f..c9aaf87f9dd 100644 --- a/netwerk/dns/src/nsIDNService.cpp +++ b/netwerk/dns/src/nsIDNService.cpp @@ -106,8 +106,6 @@ NS_IMETHODIMP nsIDNService::Observe(nsISupports *aSubject, nsIDNService::nsIDNService() { - NS_INIT_ISUPPORTS(); - nsresult rv; // initialize to the official prefix (RFC 3490 "5. ACE prefix") diff --git a/widget/src/photon/nsAppShell.cpp b/widget/src/photon/nsAppShell.cpp index 23c2868fd13..c1800afa2a9 100644 --- a/widget/src/photon/nsAppShell.cpp +++ b/widget/src/photon/nsAppShell.cpp @@ -81,7 +81,6 @@ static NS_DEFINE_CID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID); //------------------------------------------------------------------------- nsAppShell::nsAppShell() { - NS_INIT_ISUPPORTS(); mEventQueue = nsnull; mFD = -1; } diff --git a/widget/src/photon/nsBidiKeyboard.cpp b/widget/src/photon/nsBidiKeyboard.cpp index 01ee6bc749e..3771c6bc4e9 100644 --- a/widget/src/photon/nsBidiKeyboard.cpp +++ b/widget/src/photon/nsBidiKeyboard.cpp @@ -41,7 +41,6 @@ NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard) nsBidiKeyboard::nsBidiKeyboard() : nsIBidiKeyboard() { - NS_INIT_ISUPPORTS(); } nsBidiKeyboard::~nsBidiKeyboard() diff --git a/widget/src/photon/nsButton.cpp b/widget/src/photon/nsButton.cpp index 5fcb234ebaa..e69de29bb2d 100644 --- a/widget/src/photon/nsButton.cpp +++ b/widget/src/photon/nsButton.cpp @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsButton.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" -#include - -#include "nsILookAndFeel.h" -#include "nsWidgetsCID.h" -#include "nsIComponentManager.h" - -#include "nsIDeviceContext.h" -#include "nsIFontMetrics.h" - -#include "nsPhWidgetLog.h" - - - -NS_IMPL_ISUPPORTS_INHERITED1(nsButton, nsWidget, nsIButton) -//------------------------------------------------------------------------- -// -// nsButton constructor -// -//------------------------------------------------------------------------- -nsButton::nsButton() : nsWidget(), nsIButton() -{ - NS_INIT_ISUPPORTS(); -} - -//------------------------------------------------------------------------- -// -// nsButton destructor -// -//------------------------------------------------------------------------- -nsButton::~nsButton() -{ -} - -//------------------------------------------------------------------------- -// -// Set this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsButton::SetLabel(const nsString& aText) -{ - mLabel = aText; - - if( mWidget ) - { - PtArg_t arg; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, - NS_ConvertUCS2toUTF8(aText).get(), 0 ); - PtSetResources( mWidget, 1, &arg ); - } - - return NS_OK; -} - -//------------------------------------------------------------------------- -// -// Get this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsButton::GetLabel(nsString& aBuffer) -{ - aBuffer = mLabel; - return NS_OK; -} - -//------------------------------------------------------------------------- -// -// move, paint, resizes message - ignore -// -//------------------------------------------------------------------------- -// Not Implemented -PRBool nsButton::OnMove(PRInt32, PRInt32) -{ - return PR_FALSE; -} - -// Not Implemented -PRBool nsButton::OnPaint() -{ - return PR_FALSE; -} - -// Not Implemented -PRBool nsButton::OnResize(nsRect &aWindowRect) -{ - return PR_FALSE; -} - - -/** - * Renders the Button for Printing - * - **/ -// Not Implemented -NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - return NS_OK; -} - - -NS_METHOD nsButton::CreateNative( PtWidget_t* aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[5]; - PhPoint_t pos; - PhDim_t dim; - const unsigned short BorderWidth = 2; - - NS_PRECONDITION(aParent, "nsButton::CreateNative aParent is NULL"); - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width - (2*BorderWidth); // Correct for border width - dim.h = mBounds.height - (2*BorderWidth); - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, BorderWidth, 0 ); - - mWidget = PtCreateWidget( PtButton, aParent, 3, arg ); - if( mWidget ) - { - PtAddEventHandler( mWidget, - Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY, - RawEventHandler, this ); - - res = NS_OK; - } - - NS_POSTCONDITION(mWidget, "nsButton::CreateNative Failed to create Native Button"); - - return res; -} - diff --git a/widget/src/photon/nsCheckButton.cpp b/widget/src/photon/nsCheckButton.cpp index f93e0421cd4..e69de29bb2d 100644 --- a/widget/src/photon/nsCheckButton.cpp +++ b/widget/src/photon/nsCheckButton.cpp @@ -1,295 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsCheckButton.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" -#include - -#include "nsILookAndFeel.h" -#include "nsWidgetsCID.h" -#include "nsIComponentManager.h" - -#include "nsIDeviceContext.h" -#include "nsIFontMetrics.h" - -#include "nsPhWidgetLog.h" - - - -NS_IMPL_ADDREF(nsCheckButton) -NS_IMPL_RELEASE(nsCheckButton) - -//------------------------------------------------------------------------- -// -// nsCheckButton constructor -// -//------------------------------------------------------------------------- -nsCheckButton::nsCheckButton() : nsWidget(), nsICheckButton(), - mState(PR_FALSE) -{ - NS_INIT_ISUPPORTS(); -} - -//------------------------------------------------------------------------- -// -// nsCheckButton destructor -// -//------------------------------------------------------------------------- -nsCheckButton::~nsCheckButton() -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::~nsCheckButton - Not Implemented!\n")); -} - -/** - * Implement the standard QueryInterface for NS_IWIDGET_IID and NS_ISUPPORTS_IID - * @modify gpk 8/4/98 - * @param aIID The name of the class implementing the method - * @param _classiiddef The name of the #define symbol that defines the IID - * for the class (e.g. NS_ISUPPORTS_IID) - * -*/ -nsresult nsCheckButton::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton:QueryInterface, mWidget=%p\n", mWidget)); - - if (NULL == aInstancePtr) - { - return NS_ERROR_NULL_POINTER; - } - - static NS_DEFINE_IID(kICheckButton, NS_ICHECKBUTTON_IID); - if (aIID.Equals(kICheckButton)) { - *aInstancePtr = (void*) ((nsICheckButton*)this); - NS_ADDREF_THIS(); - return NS_OK; - } - - return nsWidget::QueryInterface(aIID,aInstancePtr); -} - -//------------------------------------------------------------------------- -// -// Set the CheckButton State -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::SetState(const PRBool aState) -{ -// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:SetState, mWidget=%p new state is <%d>\n", mWidget, aState)); - nsresult res = NS_ERROR_FAILURE; - - mState = aState; - if (mWidget) - { - PtArg_t arg; - - if (mState) - PtSetArg( &arg, Pt_ARG_FLAGS, Pt_SET, Pt_SET ); - else - PtSetArg( &arg, Pt_ARG_FLAGS, 0, Pt_SET ); - - if( PtSetResources( mWidget, 1, &arg ) == 0 ) - res = NS_OK; - } - - return res; -} - -//------------------------------------------------------------------------- -// -// Get the CheckButton State -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::GetState(PRBool & aState) -{ -// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:GetState, mWidget=%p\n", mWidget)); - nsresult res = NS_ERROR_FAILURE; - - if (mWidget) - { - PtArg_t arg; - long *flags; - - PtSetArg( &arg, Pt_ARG_FLAGS, &flags, 0); - if( PtGetResources( mWidget, 1, &arg ) == 0 ) - { - if( *flags & Pt_SET ) - mState = PR_TRUE; - else - mState = PR_FALSE; - res = NS_OK; - } - } - - aState = mState; - - return res; -} - -//------------------------------------------------------------------------- -// -// Set this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::SetLabel(const nsString& aText) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:SetLabel, mWidget=%p\n", mWidget)); - if( mWidget ) - { - PtArg_t arg; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, - NS_ConvertUCS2toUTF8(aText).get(), 0 ); - if( PtSetResources( mWidget, 1, &arg ) == 0 ) - res = NS_OK; - } - - return res; -} - -//------------------------------------------------------------------------- -// -// Get this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::GetLabel(nsString& aBuffer) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::GetLabel\n")); - - aBuffer.SetLength(0); - - if( mWidget ) - { - PtArg_t arg; - char *label; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, &label, 0 ); - if( PtGetResources( mWidget, 1, &arg ) == 0 ) - { - aBuffer.Append( label ); - res = NS_OK; - } - } - - return res; -} - -//------------------------------------------------------------------------- -// -// move, paint, resizes message - ignore -// -//------------------------------------------------------------------------- -PRBool nsCheckButton::OnMove(PRInt32, PRInt32) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnMove - Not Implemented\n")); - return PR_FALSE; -} - -PRBool nsCheckButton::OnPaint() -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnPaint - Not Implemented\n")); - return PR_FALSE; -} - -PRBool nsCheckButton::OnResize(nsRect &aWindowRect) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnResize - Not Implemented\n")); - return PR_FALSE; -} - - -/** - * Renders the CheckButton for Printing - * - **/ -NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::Paint - Not Implemented\n")); - return NS_OK; -} - - -NS_METHOD nsCheckButton::CreateNative( PtWidget_t* aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[15]; - PhPoint_t pos; - PhDim_t dim; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton::CreateNative this=<%p>\n", this)); - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width; // Correct for border width - dim.h = mBounds.height; - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 0, 0 ); - PtSetArg( &arg[3], Pt_ARG_INDICATOR_TYPE, Pt_CHECK, 0 ); - PtSetArg( &arg[4], Pt_ARG_INDICATOR_COLOR, Pg_BLACK, 0 ); - PtSetArg( &arg[5], Pt_ARG_SPACING, 0, 0 ); - PtSetArg( &arg[6], Pt_ARG_MARGIN_TOP, 0, 0 ); - PtSetArg( &arg[7], Pt_ARG_MARGIN_LEFT, 0, 0 ); - PtSetArg( &arg[8], Pt_ARG_MARGIN_BOTTOM, 0, 0 ); - PtSetArg( &arg[9], Pt_ARG_MARGIN_RIGHT, 0, 0 ); - PtSetArg( &arg[10], Pt_ARG_MARGIN_WIDTH, 0, 0 ); - PtSetArg( &arg[11], Pt_ARG_MARGIN_HEIGHT, 0, 0 ); - PtSetArg( &arg[12], Pt_ARG_VERTICAL_ALIGNMENT, Pt_TOP, 0 ); - PtSetArg( &arg[13], Pt_ARG_FLAGS, 0, Pt_SELECTABLE ); - - mWidget = PtCreateWidget( PtToggleButton, aParent, 14, arg ); - if( mWidget ) - { - PtAddEventHandler( mWidget, - Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY, - RawEventHandler, this ); - - res = NS_OK; - } - - return res; -} - - diff --git a/widget/src/photon/nsClipboard.cpp b/widget/src/photon/nsClipboard.cpp index d9c226d8c10..4e72cbe50a9 100644 --- a/widget/src/photon/nsClipboard.cpp +++ b/widget/src/photon/nsClipboard.cpp @@ -79,7 +79,6 @@ nsClipboard::nsClipboard() printf("nsClipboard::nsClipboard()\n"); #endif /* DEBUG_CLIPBOARD */ - NS_INIT_ISUPPORTS(); mIgnoreEmptyNotification = PR_FALSE; mGlobalTransferable = nsnull; mSelectionTransferable = nsnull; diff --git a/widget/src/photon/nsDragService.cpp b/widget/src/photon/nsDragService.cpp index 446caf586d9..5cad6ba00a8 100644 --- a/widget/src/photon/nsDragService.cpp +++ b/widget/src/photon/nsDragService.cpp @@ -60,7 +60,6 @@ NS_IMPL_QUERY_INTERFACE2(nsDragService, nsIDragService, nsIDragSession) //------------------------------------------------------------------------- nsDragService::nsDragService() { - NS_INIT_ISUPPORTS(); mDndWidget = nsnull; mDndEvent = nsnull; mNativeCtrl = nsnull; diff --git a/widget/src/photon/nsFilePicker.cpp b/widget/src/photon/nsFilePicker.cpp index 0b131de7fbe..64a38bee8e7 100644 --- a/widget/src/photon/nsFilePicker.cpp +++ b/widget/src/photon/nsFilePicker.cpp @@ -55,7 +55,6 @@ nsFilePicker::nsFilePicker() , mUnicodeEncoder(nsnull) , mUnicodeDecoder(nsnull) { - NS_INIT_ISUPPORTS(); mDisplayDirectory = do_CreateInstance("@mozilla.org/file/local;1"); char *path = getenv( "HOME" ); if( path ) { diff --git a/widget/src/photon/nsLabel.cpp b/widget/src/photon/nsLabel.cpp index 44ad91e4046..e69de29bb2d 100644 --- a/widget/src/photon/nsLabel.cpp +++ b/widget/src/photon/nsLabel.cpp @@ -1,226 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsLabel.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" -#include - -#include "nsPhWidgetLog.h" - -NS_IMPL_ADDREF_INHERITED(nsLabel, nsWidget) -NS_IMPL_RELEASE_INHERITED(nsLabel, nsWidget) - -//------------------------------------------------------------------------- -// -// nsLabel constructor -// -//------------------------------------------------------------------------- -nsLabel::nsLabel() : nsWidget(), nsILabel() -{ - NS_INIT_ISUPPORTS(); - mAlignment = eAlign_Left; -} - -//------------------------------------------------------------------------- -// -// nsLabel destructor -// -//------------------------------------------------------------------------- -nsLabel::~nsLabel() -{ -} - - -//------------------------------------------------------------------------- -// -// Create the nativeLabel widget -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::CreateNative( PtWidget_t *aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[5]; - PhPoint_t pos; - PhDim_t dim; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel::CreateNative at (%d,%d) for (%d,%d)\n",mBounds.x,mBounds.y, mBounds.width, mBounds.height)); - NS_PRECONDITION(aParent, "nsLabel::CreateNative aParent is NULL"); - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width; - dim.h = mBounds.height; - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 0, 0 ); - - mWidget = PtCreateWidget( PtButton, aParent, 3, arg ); - if( mWidget ) - { - res = NS_OK; - } - - NS_POSTCONDITION(mWidget, "nsLabel::CreateNative Failed to create native label"); - - return res; -} - - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::PreCreateWidget(nsWidgetInitData *aInitData) -{ - if (nsnull != aInitData) { - nsLabelInitData* data = (nsLabelInitData *) aInitData; - mAlignment = data->mAlignment; - } - return NS_OK; -} - - -//------------------------------------------------------------------------- -// -// Set alignment -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment) -{ - mAlignment = aAlignment; - return NS_OK; -} - - -//------------------------------------------------------------------------- -// -// Query interface implementation -// -//------------------------------------------------------------------------- -nsresult nsLabel::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - - nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr); - - static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID); - if (result == NS_NOINTERFACE && aIID.Equals(kILabelIID)) { - *aInstancePtr = (void*) ((nsILabel*)this); - AddRef(); - result = NS_OK; - } - - return result; -} - - -//------------------------------------------------------------------------- -// -// Set this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::SetLabel(const nsString& aText) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel:SetLabel\n")); - - if( mWidget ) - { - PtArg_t arg; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, - NS_ConvertUCS2toUTF8(aText).get(), 0 ); - if( PtSetResources( mWidget, 1, &arg ) == 0 ) - res = NS_OK; - } - - return res; -} - -//------------------------------------------------------------------------- -// -// Get this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::GetLabel(nsString& aBuffer) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel:GetLabel\n")); - - aBuffer.SetLength(0); - - if( mWidget ) - { - PtArg_t arg; - char *label; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, &label, 0 ); - if( PtGetResources( mWidget, 1, &arg ) == 0 ) - { - aBuffer.Append( label ); - res = NS_OK; - } - } - - return res; -} - -//------------------------------------------------------------------------- -// -// paint message. Don't send the paint out -// -//------------------------------------------------------------------------- -PRBool nsLabel::OnMove(PRInt32, PRInt32) -{ - return PR_FALSE; -} - -PRBool nsLabel::OnPaint(nsPaintEvent &aEvent) -{ - //printf("** nsLabel::OnPaint **\n"); - return PR_FALSE; -} - -PRBool nsLabel::OnResize(nsSizeEvent &aEvent) -{ - return PR_FALSE; -} diff --git a/widget/src/photon/nsSound.cpp b/widget/src/photon/nsSound.cpp index a9115cac9c6..c1e9a547275 100644 --- a/widget/src/photon/nsSound.cpp +++ b/widget/src/photon/nsSound.cpp @@ -55,7 +55,6 @@ NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver) //////////////////////////////////////////////////////////////////////// nsSound::nsSound() { - NS_INIT_ISUPPORTS(); mInited = PR_FALSE; } diff --git a/widget/src/photon/nsTextWidget.cpp b/widget/src/photon/nsTextWidget.cpp index 7ab2cb5ee53..e69de29bb2d 100644 --- a/widget/src/photon/nsTextWidget.cpp +++ b/widget/src/photon/nsTextWidget.cpp @@ -1,167 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsTextWidget.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" - -#include "nsILookAndFeel.h" -#include "nsWidgetsCID.h" -#include "nsIComponentManager.h" - -#include "nsIDeviceContext.h" -#include "nsIFontMetrics.h" - -#include -#include "nsPhWidgetLog.h" - - -NS_IMPL_ADDREF(nsTextWidget) -NS_IMPL_RELEASE(nsTextWidget) - - -//------------------------------------------------------------------------- -// -// nsTextWidget constructor -// -//------------------------------------------------------------------------- -nsTextWidget::nsTextWidget() : nsTextHelper() -{ - NS_INIT_ISUPPORTS(); - mBackground = NS_RGB(124, 124, 124); -} - -//------------------------------------------------------------------------- -// -// nsTextWidget destructor -// -//------------------------------------------------------------------------- -nsTextWidget::~nsTextWidget() -{ -} - -//------------------------------------------------------------------------- -// -// Query interface implementation -// -//------------------------------------------------------------------------- -nsresult nsTextWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr); - - static NS_DEFINE_IID(kInsTextWidgetIID, NS_ITEXTWIDGET_IID); - if (result == NS_NOINTERFACE && aIID.Equals(kInsTextWidgetIID)) { - *aInstancePtr = (void*) ((nsITextWidget*)this); - NS_ADDREF_THIS(); - result = NS_OK; - } - - return result; -} - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -PRBool nsTextWidget::OnPaint() -{ - return PR_FALSE; -} - -PRBool nsTextWidget::OnResize(nsRect &aWindowRect) -{ - return PR_FALSE; -} - -NS_METHOD nsTextWidget::CreateNative( PtWidget_t* aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[5]; - PhPoint_t pos; - PhDim_t dim; - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width - 4; // Correct for border width - dim.h = mBounds.height - 4; - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 2, 0 ); - mWidget = PtCreateWidget( PtText, aParent, 3, arg ); - if( mWidget ) - { - res = NS_OK; - PtAddEventHandler(mWidget, Ph_EV_KEY, RawEventHandler, this); - - /* Add an Activate Callback */ - PtAddCallback(mWidget, Pt_CB_ACTIVATE, handle_activate_event, this); - } - - return res; -} - -int nsTextWidget::RawEventHandler(PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbInfo ) -{ - nsTextWidget *me = (nsTextWidget *) aData; /* Mozilla object that created the event */ - - if( aCbInfo->reason == Pt_CB_RAW ) - { - PhEvent_t* event = aCbInfo->event; - - switch( event->type ) - { - case Ph_EV_KEY: - { - PhKeyEvent_t* keyev = (PhKeyEvent_t*) PhGetData( event ); - me->DispatchKeyEvent(keyev); - break; - } - default: - break; - } - } - - return (Pt_CONTINUE); -} - -int nsTextWidget::handle_activate_event (PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbinfo ) -{ - return (Pt_CONTINUE); -} diff --git a/widget/src/photon/nsToolkit.cpp b/widget/src/photon/nsToolkit.cpp index 04202d71cd9..c5bfdfb8e1e 100644 --- a/widget/src/photon/nsToolkit.cpp +++ b/widget/src/photon/nsToolkit.cpp @@ -55,7 +55,6 @@ NS_IMPL_ISUPPORTS1(nsToolkit,nsIToolkit) //------------------------------------------------------------------------- nsToolkit::nsToolkit() { - NS_INIT_ISUPPORTS(); } diff --git a/widget/src/photon/nsWidget.cpp b/widget/src/photon/nsWidget.cpp index 4ec53cd1130..aa411a1cd41 100644 --- a/widget/src/photon/nsWidget.cpp +++ b/widget/src/photon/nsWidget.cpp @@ -90,9 +90,6 @@ PRBool nsWidget::sJustGotDeactivated = PR_FALSE; nsWidget::nsWidget() { - // XXX Shouldn't this be done in nsBaseWidget? - // NS_INIT_ISUPPORTS(); - if (!sLookAndFeel) { if (NS_OK != nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull,