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 { ...@@ -42,6 +42,10 @@ namespace ucbhelper {
struct ContentProviderData struct ContentProviderData
{ {
/** The UNO service name to use to instanciate the content provider. /** 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; OUString ServiceName;
...@@ -71,7 +75,10 @@ typedef std::vector< ContentProviderData > ContentProviderDataList; ...@@ -71,7 +75,10 @@ typedef std::vector< ContentProviderData > ContentProviderDataList;
@param rServiceFactory A factory through which to obtain the required @param rServiceFactory A factory through which to obtain the required
services. 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. @param rArguments Any arguments to instantiate the content provider with.
......
...@@ -146,7 +146,7 @@ published interface XContentProviderManager: com::sun::star::uno::XInterface ...@@ -146,7 +146,7 @@ published interface XContentProviderManager: com::sun::star::uno::XInterface
a content identifier (i.e., a URL). a content identifier (i.e., a URL).
@returns @returns
a content provider. a content provider, or null.
*/ */
com::sun::star::ucb::XContentProvider queryContentProvider( com::sun::star::ucb::XContentProvider queryContentProvider(
[in] string Identifier ); [in] string Identifier );
......
...@@ -188,6 +188,17 @@ ...@@ -188,6 +188,17 @@
<value/> <value/>
</prop> </prop>
</node> </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 --> <!-- We want the Provider to be the final fallback provider -->
<node oor:name="Provider999" oor:op="replace" install:module="gio"> <node oor:name="Provider999" oor:op="replace" install:module="gio">
<prop oor:name="ServiceName"> <prop oor:name="ServiceName">
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</info> </info>
<prop oor:name="ServiceName" oor:type="xs:string"> <prop oor:name="ServiceName" oor:type="xs:string">
<info> <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> </info>
</prop> </prop>
<prop oor:name="URLTemplate" oor:type="xs:string"> <prop oor:name="URLTemplate" oor:type="xs:string">
......
...@@ -58,8 +58,11 @@ registerAtUcb( ...@@ -58,8 +58,11 @@ registerAtUcb(
copy(RTL_CONSTASCII_LENGTH("{noproxy}")) : copy(RTL_CONSTASCII_LENGTH("{noproxy}")) :
rArguments); rArguments);
// First, try to instantiate proxy for provider:
uno::Reference< ucb::XContentProvider > xProvider; uno::Reference< ucb::XContentProvider > xProvider;
if (!rName.isEmpty())
{
// First, try to instantiate proxy for provider:
if (!bNoProxy) if (!bNoProxy)
{ {
uno::Reference< ucb::XContentProviderFactory > xProxyFactory; uno::Reference< ucb::XContentProviderFactory > xProxyFactory;
...@@ -83,6 +86,7 @@ registerAtUcb( ...@@ -83,6 +86,7 @@ registerAtUcb(
} }
catch (uno::RuntimeException const &) { throw; } catch (uno::RuntimeException const &) { throw; }
catch (uno::Exception const &) {} catch (uno::Exception const &) {}
}
uno::Reference< ucb::XParameterizedContentProvider > uno::Reference< ucb::XParameterizedContentProvider >
xParameterized(xProvider, uno::UNO_QUERY); xParameterized(xProvider, uno::UNO_QUERY);
...@@ -104,7 +108,7 @@ registerAtUcb( ...@@ -104,7 +108,7 @@ registerAtUcb(
} }
bool bSuccess = false; bool bSuccess = false;
if (rManager.is() && xProvider.is()) if (rManager.is() && (rName.isEmpty() || xProvider.is()))
{ {
try 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