1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
21 #include <cppuhelper/factory.hxx>
22 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
23 #include <cppuhelper/supportsservice.hxx>
24 #include <cppuhelper/weak.hxx>
25 #include "MMozillaBootstrap.hxx"
26 #include "MNSProfileDiscover.hxx"
28 using namespace com::sun::star::uno
;
29 using namespace com::sun::star::lang
;
30 using namespace com::sun::star::mozilla
;
31 using namespace connectivity::mozab
;
33 using ::com::sun::star::uno::Reference
;
34 using ::com::sun::star::uno::Sequence
;
35 using ::com::sun::star::lang::XSingleServiceFactory
;
36 using ::com::sun::star::lang::XMultiServiceFactory
;
38 MozillaBootstrap::MozillaBootstrap()
39 : OMozillaBootstrap_BASE(m_aMutex
)
41 m_ProfileAccess
.reset(new ProfileAccess
);
42 bootupProfile(css::mozilla::MozillaProductType_Mozilla
,OUString());
45 MozillaBootstrap::~MozillaBootstrap()
49 void MozillaBootstrap::disposing()
51 ::osl::MutexGuard
aGuard(m_aMutex
);
52 OMozillaBootstrap_BASE::disposing();
55 OUString SAL_CALL
MozillaBootstrap::getImplementationName( )
57 return "com.sun.star.comp.mozilla.MozillaBootstrap";
60 sal_Bool SAL_CALL
MozillaBootstrap::supportsService( const OUString
& _rServiceName
)
62 return cppu::supportsService(this, _rServiceName
);
65 Sequence
< OUString
> SAL_CALL
MozillaBootstrap::getSupportedServiceNames( )
67 // which service is supported
68 // for more information @see com.sun.star.mozilla.MozillaBootstrap
69 return { "com.sun.star.mozilla.MozillaBootstrap" };
74 ::sal_Int32 SAL_CALL
MozillaBootstrap::getProfileCount( css::mozilla::MozillaProductType product
)
76 return m_ProfileAccess
->getProfileCount(product
);
78 ::sal_Int32 SAL_CALL
MozillaBootstrap::getProfileList( css::mozilla::MozillaProductType product
, css::uno::Sequence
< OUString
>& list
)
80 return m_ProfileAccess
->getProfileList(product
,list
);
82 OUString SAL_CALL
MozillaBootstrap::getDefaultProfile( css::mozilla::MozillaProductType product
)
84 return m_ProfileAccess
->getDefaultProfile(product
);
86 OUString SAL_CALL
MozillaBootstrap::getProfilePath( css::mozilla::MozillaProductType product
, const OUString
& profileName
)
88 return m_ProfileAccess
->getProfilePath(product
,profileName
);
90 sal_Bool SAL_CALL
MozillaBootstrap::isProfileLocked( css::mozilla::MozillaProductType
/*product*/, const OUString
& /*profileName*/ )
94 sal_Bool SAL_CALL
MozillaBootstrap::getProfileExists( css::mozilla::MozillaProductType product
, const OUString
& profileName
)
96 return m_ProfileAccess
->getProfileExists(product
,profileName
);
100 ::sal_Int32 SAL_CALL
MozillaBootstrap::bootupProfile( css::mozilla::MozillaProductType
, const OUString
& )
104 ::sal_Int32 SAL_CALL
MozillaBootstrap::shutdownProfile( )
108 css::mozilla::MozillaProductType SAL_CALL
MozillaBootstrap::getCurrentProduct( )
110 return css::mozilla::MozillaProductType_Default
;
112 OUString SAL_CALL
MozillaBootstrap::getCurrentProfile( )
116 sal_Bool SAL_CALL
MozillaBootstrap::isCurrentProfileLocked( )
120 OUString SAL_CALL
MozillaBootstrap::setCurrentProfile( css::mozilla::MozillaProductType
, const OUString
& )
126 ::sal_Int32 SAL_CALL
MozillaBootstrap::Run( const css::uno::Reference
< css::mozilla::XCodeProxy
>& )
131 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
132 connectivity_moz_MozillaBootstrap_get_implementation(
133 css::uno::XComponentContext
* , css::uno::Sequence
<css::uno::Any
> const&)
135 return cppu::acquire(new connectivity::mozab::MozillaBootstrap());
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */