Kaydet (Commit) aa892d2b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Fix support for "dummy" content providers

...and use it so that private: URLs are not needlessly passed to the gio or
gnome-vfs "catch-all" UCPs.

Change-Id: I85d100567d1641130449fe21ccd072bcc0ec0979
üst dc2d4346
......@@ -42,6 +42,10 @@ namespace ucbhelper {
struct ContentProviderData
{
/** The UNO service name to use to instanciate the content provider.
If it is the empty string, a null provider will be used (see the
documentation of the Provider argument to
com.sun.star.ucb.XContentProviderManager.registerContentProvider).
*/
OUString ServiceName;
......@@ -71,7 +75,10 @@ typedef std::vector< ContentProviderData > ContentProviderDataList;
@param rServiceFactory A factory through which to obtain the required
services.
@param rName The service name of the content provider.
@param rName The service name of the content provider. If it is the empty
string, a null provider will be used (see the documentation of the Provider
argument to
com.sun.star.ucb.XContentProviderManager.registerContentProvider).
@param rArguments Any arguments to instantiate the content provider with.
......
......@@ -146,7 +146,7 @@ published interface XContentProviderManager: com::sun::star::uno::XInterface
a content identifier (i.e., a URL).
@returns
a content provider.
a content provider, or null.
*/
com::sun::star::ucb::XContentProvider queryContentProvider(
[in] string Identifier );
......
......@@ -188,6 +188,17 @@
<value/>
</prop>
</node>
<node oor:name="Provider900" oor:op="replace">
<prop oor:name="ServiceName">
<value/>
</prop>
<prop oor:name="URLTemplate">
<value>private</value>
</prop>
<prop oor:name="Arguments">
<value/>
</prop>
</node>
<!-- We want the Provider to be the final fallback provider -->
<node oor:name="Provider999" oor:op="replace" install:module="gio">
<prop oor:name="ServiceName">
......
......@@ -28,7 +28,7 @@
</info>
<prop oor:name="ServiceName" oor:type="xs:string">
<info>
<desc>Specifies the name of the UNO service to be used to instantiate the UCP.</desc>
<desc>Specifies the name of the UNO service to be used to instantiate the UCP. If it is the empty string, a null provider will be used (see the documentation of the Provider argument to com.sun.star.ucb.XContentProviderManager.registerContentProvider).</desc>
</info>
</prop>
<prop oor:name="URLTemplate" oor:type="xs:string">
......
......@@ -58,31 +58,35 @@ registerAtUcb(
copy(RTL_CONSTASCII_LENGTH("{noproxy}")) :
rArguments);
// First, try to instantiate proxy for provider:
uno::Reference< ucb::XContentProvider > xProvider;
if (!bNoProxy)
if (!rName.isEmpty())
{
uno::Reference< ucb::XContentProviderFactory > xProxyFactory;
try
// First, try to instantiate proxy for provider:
if (!bNoProxy)
{
xProxyFactory = ucb::ContentProviderProxyFactory::create( rxContext );
uno::Reference< ucb::XContentProviderFactory > xProxyFactory;
try
{
xProxyFactory = ucb::ContentProviderProxyFactory::create( rxContext );
}
catch (uno::Exception const &) {}
OSL_ENSURE(xProxyFactory.is(), "No ContentProviderProxyFactory");
if (xProxyFactory.is())
xProvider = xProxyFactory->createContentProvider(rName);
}
catch (uno::Exception const &) {}
OSL_ENSURE(xProxyFactory.is(), "No ContentProviderProxyFactory");
if (xProxyFactory.is())
xProvider = xProxyFactory->createContentProvider(rName);
}
// Then, try to instantiate provider directly:
if (!xProvider.is())
try
{
xProvider = uno::Reference< ucb::XContentProvider >(
rxContext->getServiceManager()->createInstanceWithContext(rName, rxContext),
uno::UNO_QUERY);
}
catch (uno::RuntimeException const &) { throw; }
catch (uno::Exception const &) {}
// Then, try to instantiate provider directly:
if (!xProvider.is())
try
{
xProvider = uno::Reference< ucb::XContentProvider >(
rxContext->getServiceManager()->createInstanceWithContext(rName, rxContext),
uno::UNO_QUERY);
}
catch (uno::RuntimeException const &) { throw; }
catch (uno::Exception const &) {}
}
uno::Reference< ucb::XParameterizedContentProvider >
xParameterized(xProvider, uno::UNO_QUERY);
......@@ -104,7 +108,7 @@ registerAtUcb(
}
bool bSuccess = false;
if (rManager.is() && xProvider.is())
if (rManager.is() && (rName.isEmpty() || xProvider.is()))
{
try
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment