diff options
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 20 | ||||
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 8 | ||||
| -rw-r--r-- | indra/llplugin/llpluginclassmediaowner.h | 4 | ||||
| -rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 41 | ||||
| -rw-r--r-- | indra/newview/llmediactrl.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llviewermedia.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llviewerparcelmedia.cpp | 6 | ||||
| -rw-r--r-- | indra/test_apps/llplugintest/llmediaplugintest.cpp | 9 | 
8 files changed, 101 insertions, 1 deletions
| diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 446df646fc..cd0689caa6 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -682,6 +682,20 @@ void LLPluginClassMedia::sendPickFileResponse(const std::string &file)  	sendMessage(message);  } +void LLPluginClassMedia::sendAuthResponse(bool ok, const std::string &username, const std::string &password) +{ +	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "auth_response"); +	message.setValueBoolean("ok", ok); +	message.setValue("username", username); +	message.setValue("password", password); +	if(mPlugin->isBlocked()) +	{ +		// If the plugin sent a blocking pick-file request, the response should unblock it. +		message.setValueBoolean("blocking_response", true); +	} +	sendMessage(message); +} +  void LLPluginClassMedia::cut()  {  	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "edit_cut"); @@ -947,6 +961,12 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)  		{  			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PICK_FILE_REQUEST);  		} +		else if(message_name == "auth_request") +		{ +			mAuthURL = message.getValue("url"); +			mAuthRealm = message.getValue("realm"); +			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_AUTH_REQUEST); +		}  		else  		{  			LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL; diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 938e5c1bf6..2b8a7238b5 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -159,6 +159,8 @@ public:  	void sendPickFileResponse(const std::string &file); +	void sendAuthResponse(bool ok, const std::string &username, const std::string &password); +  	// Valid after a MEDIA_EVENT_CURSOR_CHANGED event  	std::string getCursorName() const { return mCursorName; }; @@ -232,6 +234,10 @@ public:  	S32 getGeometryY() const { return mGeometryY; };  	S32 getGeometryWidth() const { return mGeometryWidth; };  	S32 getGeometryHeight() const { return mGeometryHeight; }; +	 +	// These are valid during MEDIA_EVENT_AUTH_REQUEST +	std::string	getAuthURL() const { return mAuthURL; }; +	std::string	getAuthRealm() const { return mAuthRealm; };  	std::string getMediaName() const { return mMediaName; };  	std::string getMediaDescription() const { return mMediaDescription; }; @@ -370,6 +376,8 @@ protected:  	S32				mGeometryY;  	S32				mGeometryWidth;  	S32				mGeometryHeight; +	std::string		mAuthURL; +	std::string		mAuthRealm;  	/////////////////////////////////////////  	// media_time class diff --git a/indra/llplugin/llpluginclassmediaowner.h b/indra/llplugin/llpluginclassmediaowner.h index c9efff216c..42a89baebc 100644 --- a/indra/llplugin/llpluginclassmediaowner.h +++ b/indra/llplugin/llpluginclassmediaowner.h @@ -59,7 +59,9 @@ public:  		MEDIA_EVENT_GEOMETRY_CHANGE,		// The plugin requested its window geometry be changed (per the javascript window interface)  		MEDIA_EVENT_PLUGIN_FAILED_LAUNCH,	// The plugin failed to launch  -		MEDIA_EVENT_PLUGIN_FAILED			// The plugin died unexpectedly +		MEDIA_EVENT_PLUGIN_FAILED,			// The plugin died unexpectedly + +		MEDIA_EVENT_AUTH_REQUEST			// The plugin wants to display an auth dialog  	} EMediaEvent; diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 15c107cbe1..5dbc2f9fdf 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -569,6 +569,43 @@ private:  		return blockingPickFile();  	} +	std::string mAuthUsername; +	std::string mAuthPassword; +	bool mAuthOK; +	 +	//////////////////////////////////////////////////////////////////////////////// +	// virtual +	bool onAuthRequest(const std::string &in_url, const std::string &in_realm, std::string &out_username, std::string &out_password) +	{ +		mAuthOK = false; + +		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "auth_request"); +		message.setValue("url", in_url); +		message.setValue("realm", in_realm); +		message.setValueBoolean("blocking_request", true); +				 +		// The "blocking_request" key in the message means this sendMessage call will block until a response is received. +		sendMessage(message); +		 +		if(mAuthOK) +		{ +			out_username = mAuthUsername; +			out_password = mAuthPassword; +		} +		 +		return mAuthOK; +	} +	 +	void authResponse(LLPluginMessage &message) +	{ +		mAuthOK = message.getValueBoolean("ok"); +		if(mAuthOK) +		{ +			mAuthUsername = message.getValue("username"); +			mAuthPassword = message.getValue("password"); +		} +	} +	  	LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers)  	{  		int result = 0; @@ -1096,6 +1133,10 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)  			{  				onPickFileResponse(message_in.getValue("file"));  			} +			if(message_name == "auth_response") +			{ +				authResponse(message_in); +			}  			else  			{  //				std::cerr << "MediaPluginWebKit::receiveMessage: unknown media message: " << message_string << std::endl; diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 5e27004ed8..0a5263d1ab 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1092,6 +1092,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)  			LL_DEBUGS("Media") << "Media event:  MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;  		}  		break; + +		case MEDIA_EVENT_AUTH_REQUEST: +		{ +			LL_DEBUGS("Media") <<  "Media event:  MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() << ", realm " << self->getAuthRealm() << LL_ENDL; +		} +		break;  	};  	// chain all events to any potential observers of this object. diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 7c65f375ca..0d13a0a263 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -3008,6 +3008,14 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla  			plugin->sendPickFileResponse(response);  		}  		break; + +		case LLViewerMediaObserver::MEDIA_EVENT_AUTH_REQUEST: +		{ +			llinfos <<  "MEDIA_EVENT_AUTH_REQUEST, url " << plugin->getAuthURL() << ", realm " << plugin->getAuthRealm() << LL_ENDL; +			 +			// TODO: open an auth dialog that will call this when complete +			plugin->sendAuthResponse(false, "", ""); +		}  		case LLViewerMediaObserver::MEDIA_EVENT_CLOSE_REQUEST:  		{ diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 99e869dafc..41e59c626d 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -586,6 +586,12 @@ void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent  			LL_DEBUGS("Media") << "Media event:  MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;  		}  		break; + +		case MEDIA_EVENT_AUTH_REQUEST: +		{ +			LL_DEBUGS("Media") <<  "Media event:  MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() << ", realm " << self->getAuthRealm() << LL_ENDL; +		} +		break;  	};  } diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index 873fa23db8..f2a10bc264 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -2220,6 +2220,15 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e  				<< ", height = " << self->getGeometryHeight()   				<< std::endl;  		break; + +		case MEDIA_EVENT_AUTH_REQUEST: +		{ +			std::cerr <<  "Media event:  MEDIA_EVENT_AUTH_REQUEST, url " << self->getAuthURL() ", realm " << self->getAuthRealm() << std::endl; + +			// TODO: display an auth dialog +			self->sendAuthResponse(false, "", ""); +		} +		break;  	}  } | 
