From 5668e73beb30b95abc6520b7432c54972ca3ab2c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 20 Nov 2013 14:43:45 +0100 Subject: avmedia: Implement "block untrusted referer links" feature See f0a9ca24fd4bf79cac908bf0d6fdb8905dc504db "rhbz#887420 Implement 'block untrusted referer links' feature" for details. This adds some further /*TODO?*/ comments, and one known problem (marked /*TODO!*/) is that movies/sounds are not blocked during a slideshow presentation. Change-Id: Ib2d0c7e4f7b02c4bdec0d8a90cee5e7e1bee8325 --- include/avmedia/mediaitem.hxx | 5 ++++- include/avmedia/mediaplayer.hxx | 2 +- include/avmedia/mediawindow.hxx | 8 ++++---- include/svx/svdomedia.hxx | 2 +- include/svx/unoapi.hxx | 2 +- include/svx/unoshape.hxx | 5 ++++- 6 files changed, 15 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx index 0e39e31870d5..7304e40095d4 100644 --- a/include/avmedia/mediaitem.hxx +++ b/include/avmedia/mediaitem.hxx @@ -106,11 +106,14 @@ public: ::com::sun::star::media::ZoomLevel getZoom() const; void setURL( const OUString& rURL, - const OUString& rTempURL); + const OUString& rTempURL, + const OUString& rReferer); const OUString& getURL() const; const OUString& getTempURL() const; + const OUString& getReferer() const; + private: struct Impl; diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx index bd7706c64d8b..dbcbe6fc9ba3 100644 --- a/include/avmedia/mediaplayer.hxx +++ b/include/avmedia/mediaplayer.hxx @@ -46,7 +46,7 @@ public: MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, Window* pParent ); ~MediaFloater(); - void setURL( const OUString& rURL, bool bPlayImmediately ); + void setURL( const OUString& rURL, const OUString& rReferer, bool bPlayImmediately ); void dispatchCurrentURL(); diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx index 74ef95da9f75..b2bca33302fe 100644 --- a/include/avmedia/mediawindow.hxx +++ b/include/avmedia/mediawindow.hxx @@ -57,7 +57,7 @@ namespace avmedia MediaWindow( Window* parent, bool bInternalMediaControl ); virtual ~MediaWindow(); - void setURL( const OUString& rURL ); + void setURL( const OUString& rURL, const OUString& rReferer ); const OUString& getURL() const; bool isValid() const; @@ -101,11 +101,11 @@ namespace avmedia static bool executeMediaURLDialog( Window* pParent, OUString& rURL, bool *const o_pbLink ); static void executeFormatErrorBox( Window* pParent ); - static bool isMediaURL( const OUString& rURL, bool bDeep = false, Size* pPreferredSizePixel = NULL ); + static bool isMediaURL( const OUString& rURL, const OUString& rReferer, bool bDeep = false, Size* pPreferredSizePixel = NULL ); - static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL ); + static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL, const OUString& rReferer ); - static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > grabFrame( const OUString& rURL, + static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > grabFrame( const OUString& rURL, const OUString& rReferer, bool bAllowToCreateReplacementGraphic = false, double fMediaTime = AVMEDIA_FRAMEGRABBER_DEFAULTFRAME ); diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx index 849f8ef0bb90..018adfe5e2b6 100644 --- a/include/svx/svdomedia.hxx +++ b/include/svx/svdomedia.hxx @@ -60,7 +60,7 @@ public: public: - void setURL( const OUString& rURL ); + void setURL( const OUString& rURL, const OUString& rReferer ); const OUString& getURL() const; void setMediaProperties( const ::avmedia::MediaItem& rState ); diff --git a/include/svx/unoapi.hxx b/include/svx/unoapi.hxx index 3bab954c37ae..1f81aa9e218c 100644 --- a/include/svx/unoapi.hxx +++ b/include/svx/unoapi.hxx @@ -38,7 +38,7 @@ class SfxItemPool; * Creates a StarOffice API wrapper with the given type and inventor * Deprecated: This will be replaced with a function returning XShape. */ -SVX_DLLPUBLIC SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw(); +SVX_DLLPUBLIC SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, OUString const & referer ) throw(); /** Returns a StarOffice API wrapper for the given SdrObject */ SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw (); diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index f7558b834fdf..c27f8b7c6bf1 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -857,13 +857,16 @@ public: class SvxMediaShape : public SvxShape { public: - SvxMediaShape( SdrObject* pObj ) throw(); + SvxMediaShape( SdrObject* pObj, OUString const & referer ) throw(); virtual ~SvxMediaShape() throw(); protected: // overide these for special property handling in subcasses. Return true if property is handled virtual bool setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); virtual bool getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + +private: + OUString referer_; }; #endif -- cgit v1.2.3