X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=null_prompt_service.cpp;h=28156d58dcc378743888e1df432fe20a5006aec2;hp=878f7ff268f71057127e1f997287ad0b024d0077;hb=194f5f8a53d16a8a07c61df2311a13b3cd3994bf;hpb=c5f98ff303d670f72a5d491a5f4e1989d2043219 diff --git a/null_prompt_service.cpp b/null_prompt_service.cpp index 878f7ff..28156d5 100644 --- a/null_prompt_service.cpp +++ b/null_prompt_service.cpp @@ -1,6 +1,7 @@ // Copyright 2006 Ben Hutchings . // See the file "COPYING" for licence details. +#include #include #include @@ -9,11 +10,16 @@ #include #include #include -#include +#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) +# include +# include +#else +# include +#endif #include #include "null_prompt_service.hpp" -#include "webdvd.hpp" +#include "videolink.hpp" #include "xpcom_support.hpp" using xpcom_support::check; @@ -36,18 +42,20 @@ namespace if (!iid.Equals(prompt_service_iid)) return NS_ERROR_NO_INTERFACE; - try + if (null_prompt_service * service = + new (std::nothrow) null_prompt_service) { - *result = new null_prompt_service; + service->AddRef(); + *result = service; return NS_OK; } - catch (std::bad_alloc &) + else { return NS_ERROR_OUT_OF_MEMORY; } } - NS_IMETHODIMP null_prompt_service_factory::LockFactory(PRBool lock) + NS_IMETHODIMP null_prompt_service_factory::LockFactory(PRBool /*lock*/) { return NS_ERROR_NOT_IMPLEMENTED; } @@ -190,10 +198,21 @@ void null_prompt_service::install() {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0} }; nsCOMPtr prompt_factory(new null_prompt_service_factory); - check(nsComponentManager::RegisterFactory( - prompt_service_cid, - "Prompt Service", - "@mozilla.org/embedcomp/prompt-service;1", - prompt_factory, - PR_TRUE)); // replace existing +# if MOZ_VERSION_MAJOR > 1 \ + || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) + nsCOMPtr comp_registrar; + check(NS_GetComponentRegistrar(getter_AddRefs(comp_registrar))); + check(comp_registrar->RegisterFactory( + prompt_service_cid, + "Prompt Service", + "@mozilla.org/embedcomp/prompt-service;1", + prompt_factory)); +# else + check(nsComponentManager::RegisterFactory( + prompt_service_cid, + "Prompt Service", + "@mozilla.org/embedcomp/prompt-service;1", + prompt_factory, + PR_TRUE)); // replace existing +# endif }