diff options
author | Monroe Linden <monroe@lindenlab.com> | 2010-09-10 16:43:35 -0700 |
---|---|---|
committer | Monroe Linden <monroe@lindenlab.com> | 2010-09-10 16:43:35 -0700 |
commit | 24f308caaeda941a626b6143d95adbfe07450f97 (patch) | |
tree | 848fee057e9df5a1198dd3120ecf0fe920e713f9 /indra/media_plugins/webkit | |
parent | f6645b10dd391218edff67579a4388dc8bbac7d2 (diff) |
Added support for a media plugin message that asks the viewer to open a file picker on the plugin's behalf.
Reviewed by Callum.
Diffstat (limited to 'indra/media_plugins/webkit')
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index de4409fba7..a7189cb610 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -688,6 +688,26 @@ private: } } + + std::string mPickedFile; + + std::string blockingPickFile(void) + { + mPickedFile.clear(); + + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file"); + 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); + + return mPickedFile; + } + + void onPickFileResponse(const std::string &file) + { + mPickedFile = file; + } }; @@ -1045,10 +1065,14 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) LLQtWebKit::getInstance()->userAction( mBrowserWindowId, LLQtWebKit::UA_EDIT_PASTE ); checkEditState(); } + if(message_name == "pick_file_response") + { + onPickFileResponse(message_in.getValue("file")); + } else { // std::cerr << "MediaPluginWebKit::receiveMessage: unknown media message: " << message_string << std::endl; - }; + } } else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER) { |