From f39a87ef8384ede25a6597e678ac7609e9e64cc5 Mon Sep 17 00:00:00 2001
From: skolb <none@none>
Date: Mon, 8 Mar 2010 14:54:19 -0800
Subject: https://jira.secondlife.com/browse/EXT-5884

Added code to support SLAPPS for Media on a Prim
Reviewed by Monroe and Callum via Code Collab (Review 143).
---
 indra/newview/llmediactrl.cpp   | 16 ++++++----------
 indra/newview/llmediactrl.h     |  1 -
 indra/newview/llviewermedia.cpp |  5 +++--
 indra/newview/llviewermedia.h   |  4 ++++
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index c244bc38ed..e0069e7438 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -80,8 +80,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
 	mForceUpdate( false ),
 	mOpenLinksInExternalBrowser( false ),
 	mOpenLinksInInternalBrowser( false ),
-	mTrusted( false ),
 	mHomePageUrl( "" ),
+	mTrusted(false),
 	mIgnoreUIScale( true ),
 	mAlwaysRefresh( false ),
 	mMediaSource( 0 ),
@@ -183,6 +183,10 @@ void LLMediaCtrl::setOpenInInternalBrowser( bool valIn )
 ////////////////////////////////////////////////////////////////////////////////
 void LLMediaCtrl::setTrusted( bool valIn )
 {
+	if(mMediaSource)
+	{
+		mMediaSource->setTrustedBrowser(valIn);
+	}
 	mTrusted = valIn;
 }
 
@@ -632,6 +636,7 @@ bool LLMediaCtrl::ensureMediaSourceExists()
 			mMediaSource->setVisible( getVisible() );
 			mMediaSource->addObserver( this );
 			mMediaSource->setBackgroundColor( getBackgroundColor() );
+			mMediaSource->setTrustedBrowser(mTrusted);
 			if(mClearCache)
 			{
 				mMediaSource->clearCache();
@@ -1055,15 +1060,6 @@ void LLMediaCtrl::clickLinkWithTarget(const std::string& url, const S32& target_
 	}
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// 
-void LLMediaCtrl::onClickLinkNoFollow( LLPluginClassMedia* self )
-{
-	// let the dispatcher handle blocking/throttling of SLURLs
-	std::string url = self->getClickURL();
-	LLURLDispatcher::dispatch(url, this, mTrusted);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // 
 std::string LLMediaCtrl::getCurrentNavUrl()
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 60e0c4073b..e55d2f7cd0 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -164,7 +164,6 @@ public:
 
 		// handlers for individual events (could be done inside the switch in handleMediaEvent, they're just individual functions for clarity)
 		void onClickLinkHref( LLPluginClassMedia* self );
-		void onClickLinkNoFollow( LLPluginClassMedia* self );
 		
 	protected:
 		void convertInputCoords(S32& x, S32& y);
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 4620ce6354..7e08464cd0 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1091,7 +1091,8 @@ LLViewerMediaImpl::LLViewerMediaImpl(	  const LLUUID& texture_id,
 	mBackgroundColor(LLColor4::white),
 	mNavigateSuspended(false),
 	mNavigateSuspendedDeferred(false),
-	mIsUpdated(false)
+	mIsUpdated(false),
+	mTrustedBrowser(false)
 { 
 
 	// Set up the mute list observer if it hasn't been set up already.
@@ -2345,7 +2346,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
 		{
 			LL_DEBUGS("Media") << "MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is: " << plugin->getClickURL() << LL_ENDL; 
 			std::string url = plugin->getClickURL();
-			LLURLDispatcher::dispatch(url, NULL, false);
+			LLURLDispatcher::dispatch(url, NULL, mTrustedBrowser);
 
 		}
 		break;
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 9dbffa78b3..bc51e713a1 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -322,6 +322,9 @@ public:
 	void setLowPrioritySizeLimit(int size);
 
 	void setTextureID(LLUUID id = LLUUID::null);
+
+	bool isTrustedBrowser() { return mTrustedBrowser; }
+	void setTrustedBrowser(bool trusted) { mTrustedBrowser = trusted; }
 	
 	typedef enum 
 	{
@@ -405,6 +408,7 @@ private:
 	LLColor4 mBackgroundColor;
 	bool mNavigateSuspended;
 	bool mNavigateSuspendedDeferred;
+	bool mTrustedBrowser;
 	
 private:
 	BOOL mIsUpdated ;
-- 
cgit v1.2.3