Indentation stuff

This commit is contained in:
Tomeu Vizoso 2007-01-29 20:41:15 +01:00
parent d4fab7fc64
commit 4016f12d86
3 changed files with 75 additions and 72 deletions

View File

@ -6,15 +6,12 @@
class GeckoContentHandler : public nsIHelperAppLauncherDialog class GeckoContentHandler : public nsIHelperAppLauncherDialog
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIHELPERAPPLAUNCHERDIALOG NS_DECL_NSIHELPERAPPLAUNCHERDIALOG
GeckoContentHandler();
virtual ~GeckoContentHandler();
private:
GeckoContentHandler();
virtual ~GeckoContentHandler();
}; };
GeckoContentHandler::GeckoContentHandler() GeckoContentHandler::GeckoContentHandler()
@ -75,42 +72,47 @@ GeckoContentHandlerFactory::GeckoContentHandlerFactory() {
GeckoContentHandlerFactory::~GeckoContentHandlerFactory() { GeckoContentHandlerFactory::~GeckoContentHandlerFactory() {
} }
NS_IMETHODIMP GeckoContentHandlerFactory::CreateInstance(nsISupports *aOuter, const nsIID & aIID, void **aResult) NS_IMETHODIMP
GeckoContentHandlerFactory::CreateInstance(nsISupports *aOuter,
const nsIID & aIID,
void **aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);
*aResult = NULL; *aResult = NULL;
GeckoContentHandler *inst = new GeckoContentHandler; GeckoContentHandler *inst = new GeckoContentHandler;
if (!inst) if (!inst)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = inst->QueryInterface(aIID, aResult); nsresult rv = inst->QueryInterface(aIID, aResult);
if (rv != NS_OK) { if (rv != NS_OK) {
// We didn't get the right interface, so clean up // We didn't get the right interface, so clean up
delete inst; delete inst;
} }
return rv; return rv;
} }
NS_IMETHODIMP GeckoContentHandlerFactory::LockFactory(PRBool lock) NS_IMETHODIMP
GeckoContentHandlerFactory::LockFactory(PRBool lock)
{ {
return NS_OK; return NS_OK;
} }
//***************************************************************************** //*****************************************************************************
nsresult NS_NewGeckoContentHandlerFactory(nsIFactory** aFactory) nsresult
NS_NewGeckoContentHandlerFactory(nsIFactory** aFactory)
{ {
NS_ENSURE_ARG_POINTER(aFactory); NS_ENSURE_ARG_POINTER(aFactory);
*aFactory = nsnull; *aFactory = nsnull;
GeckoContentHandlerFactory *result = new GeckoContentHandlerFactory; GeckoContentHandlerFactory *result = new GeckoContentHandlerFactory;
if (!result) if (!result)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result); NS_ADDREF(result);
*aFactory = result; *aFactory = result;
return NS_OK; return NS_OK;
} }

View File

@ -153,11 +153,11 @@ GeckoDownload::OnSecurityChange (nsIWebProgress *aWebProgress,
class GeckoDownloadFactory : public nsIFactory { class GeckoDownloadFactory : public nsIFactory {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY NS_DECL_NSIFACTORY
GeckoDownloadFactory(); GeckoDownloadFactory();
virtual ~GeckoDownloadFactory(); virtual ~GeckoDownloadFactory();
}; };
//***************************************************************************** //*****************************************************************************
@ -170,42 +170,45 @@ GeckoDownloadFactory::GeckoDownloadFactory() {
GeckoDownloadFactory::~GeckoDownloadFactory() { GeckoDownloadFactory::~GeckoDownloadFactory() {
} }
NS_IMETHODIMP GeckoDownloadFactory::CreateInstance(nsISupports *aOuter, const nsIID & aIID, void **aResult) NS_IMETHODIMP
GeckoDownloadFactory::CreateInstance(nsISupports *aOuter, const nsIID & aIID, void **aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);
*aResult = NULL; *aResult = NULL;
GeckoDownload *inst = new GeckoDownload; GeckoDownload *inst = new GeckoDownload;
if (!inst) if (!inst)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = inst->QueryInterface(aIID, aResult); nsresult rv = inst->QueryInterface(aIID, aResult);
if (rv != NS_OK) { if (rv != NS_OK) {
// We didn't get the right interface, so clean up // We didn't get the right interface, so clean up
delete inst; delete inst;
} }
return rv; return rv;
} }
NS_IMETHODIMP GeckoDownloadFactory::LockFactory(PRBool lock) NS_IMETHODIMP
GeckoDownloadFactory::LockFactory(PRBool lock)
{ {
return NS_OK; return NS_OK;
} }
//***************************************************************************** //*****************************************************************************
nsresult NS_NewGeckoDownloadFactory(nsIFactory** aFactory) nsresult
NS_NewGeckoDownloadFactory(nsIFactory** aFactory)
{ {
NS_ENSURE_ARG_POINTER(aFactory); NS_ENSURE_ARG_POINTER(aFactory);
*aFactory = nsnull; *aFactory = nsnull;
GeckoDownloadFactory *result = new GeckoDownloadFactory; GeckoDownloadFactory *result = new GeckoDownloadFactory;
if (!result) if (!result)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result); NS_ADDREF(result);
*aFactory = result; *aFactory = result;
return NS_OK; return NS_OK;
} }

View File

@ -116,23 +116,23 @@ sugar_browser_startup(const char *profile_path, const char *profile_name)
NS_GetComponentRegistrar(getter_AddRefs(componentRegistrar)); NS_GetComponentRegistrar(getter_AddRefs(componentRegistrar));
NS_ENSURE_TRUE (componentRegistrar, FALSE); NS_ENSURE_TRUE (componentRegistrar, FALSE);
nsCOMPtr<nsIFactory> contentHandlerFactory; nsCOMPtr<nsIFactory> contentHandlerFactory;
rv = NS_NewGeckoContentHandlerFactory(getter_AddRefs(contentHandlerFactory)); rv = NS_NewGeckoContentHandlerFactory(getter_AddRefs(contentHandlerFactory));
rv = componentRegistrar->RegisterFactory(sSugarComponents[0].mCID, rv = componentRegistrar->RegisterFactory(sSugarComponents[0].mCID,
sSugarComponents[0].mDescription, sSugarComponents[0].mDescription,
sSugarComponents[0].mContractID, sSugarComponents[0].mContractID,
contentHandlerFactory); contentHandlerFactory);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
g_warning ("Failed to register factory for %s\n", sSugarComponents[0].mDescription); g_warning ("Failed to register factory for %s\n", sSugarComponents[0].mDescription);
return FALSE; return FALSE;
} }
nsCOMPtr<nsIFactory> downloadFactory; nsCOMPtr<nsIFactory> downloadFactory;
rv = NS_NewGeckoDownloadFactory(getter_AddRefs(downloadFactory)); rv = NS_NewGeckoDownloadFactory(getter_AddRefs(downloadFactory));
rv = componentRegistrar->RegisterFactory(sSugarComponents[1].mCID, rv = componentRegistrar->RegisterFactory(sSugarComponents[1].mCID,
sSugarComponents[1].mDescription, sSugarComponents[1].mDescription,
sSugarComponents[1].mContractID, sSugarComponents[1].mContractID,
downloadFactory); downloadFactory);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
g_warning ("Failed to register factory for %s\n", sSugarComponents[1].mDescription); g_warning ("Failed to register factory for %s\n", sSugarComponents[1].mDescription);
return FALSE; return FALSE;
@ -372,7 +372,6 @@ sugar_browser_scroll_pixels(SugarBrowser *browser,
int dx, int dx,
int dy) int dy)
{ {
#ifndef HAVE_GECKO_1_9
nsCOMPtr<nsIWebBrowser> webBrowser; nsCOMPtr<nsIWebBrowser> webBrowser;
gtk_moz_embed_get_nsIWebBrowser (GTK_MOZ_EMBED(browser), gtk_moz_embed_get_nsIWebBrowser (GTK_MOZ_EMBED(browser),
getter_AddRefs(webBrowser)); getter_AddRefs(webBrowser));
@ -390,7 +389,6 @@ sugar_browser_scroll_pixels(SugarBrowser *browser,
NS_ENSURE_TRUE (DOMWindow, ); NS_ENSURE_TRUE (DOMWindow, );
DOMWindow->ScrollBy (dx, dy); DOMWindow->ScrollBy (dx, dy);
#endif
} }
void void