From a2657be5782f20c3cbab542b5a3775d78e21cdfa Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 17 Aug 2010 17:56:54 -0700 Subject: Viewer side changes to support javascript window.close handling. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 3b00edec4e..2dc0c93521 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -539,6 +539,15 @@ private: // message.setValueBoolean("dead", (event.getIntValue() != 0)) sendMessage(message); } + + //////////////////////////////////////////////////////////////////////////////// + // virtual + void onWindowCloseRequested(const EventType& event) + { + llwarns << "onWindowCloseRequested " << llendl; + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "close_request"); + sendMessage(message); + } LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers) { -- cgit v1.2.3 From 24f308caaeda941a626b6143d95adbfe07450f97 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 10 Sep 2010 16:43:35 -0700 Subject: Added support for a media plugin message that asks the viewer to open a file picker on the plugin's behalf. Reviewed by Callum. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp') 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) { -- cgit v1.2.3 From 22172ce23d4abe7b50dc17ea7a67ecf55a4cd5b8 Mon Sep 17 00:00:00 2001 From: callum Date: Mon, 13 Sep 2010 14:59:05 -0700 Subject: EXP-56 - viewer side of support for file picker dialog requirement. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index a7189cb610..a2b1ff019b 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -543,6 +543,13 @@ private: LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "close_request"); sendMessage(message); } + + //////////////////////////////////////////////////////////////////////////////// + // virtual + std::string onRequestFilePicker( const EventType& eventIn ) + { + return blockingPickFile(); + } LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers) { -- cgit v1.2.3 From 531b77a9485db77df31a25a766e66ec1443a49f6 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Wed, 15 Sep 2010 14:39:42 -0700 Subject: Enable web popups to specify size and position of the Media Browser window from javascript. This includes a Mac build of llqtwebkit from the following sources: revision aacdf69cbf5aa12d77c179296e31ef643ed1ef4a of http://qt.gitorious.org/+lindenqt/qt/lindenqt (currently head of the 'lindenqt' branch) revision 81ab5ae326f0 of http://hg.secondlife.com/llqtwebkit (currently head of the default branch) Reviewed by Callum. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 45 +++++++++++++++++----- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index a2b1ff019b..67f49556c5 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -115,6 +115,7 @@ private: F32 mBackgroundR; F32 mBackgroundG; F32 mBackgroundB; + std::string mTarget; VolumeCatcher mVolumeCatcher; @@ -303,7 +304,7 @@ private: LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); // create single browser window - mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight ); + mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight, mTarget); // tell LLQtWebKit about the size of the browser window LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight ); @@ -313,9 +314,6 @@ private: // append details to agent string LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); - - // Set up window open behavior - LLQtWebKit::getInstance()->setWindowOpenBehavior(mBrowserWindowId, LLQtWebKit::WOB_SIMULATE_BLANK_HREF_CLICK); #if !LL_QTWEBKIT_USES_PIXMAPS // don't flip bitmap @@ -507,9 +505,9 @@ private: void onClickLinkHref(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href"); - message.setValue("uri", event.getStringValue()); - message.setValue("target", event.getStringValue2()); - message.setValueU32("target_type", event.getLinkType()); + message.setValue("uri", event.getEventUri()); + message.setValue("target", event.getStringValue()); + message.setValue("uuid", event.getStringValue2()); sendMessage(message); } @@ -518,7 +516,7 @@ private: void onClickLinkNoFollow(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_nofollow"); - message.setValue("uri", event.getStringValue()); + message.setValue("uri", event.getEventUri()); sendMessage(message); } @@ -539,8 +537,24 @@ private: // virtual void onWindowCloseRequested(const EventType& event) { - llwarns << "onWindowCloseRequested " << llendl; LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "close_request"); + message.setValue("uuid", event.getStringValue()); + sendMessage(message); + } + + //////////////////////////////////////////////////////////////////////////////// + // virtual + void onWindowGeometryChangeRequested(const EventType& event) + { + int x, y, width, height; + event.getRectValue(x, y, width, height); + + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "geometry_change"); + message.setValue("uuid", event.getStringValue()); + message.setValueS32("x", x); + message.setValueS32("y", y); + message.setValueS32("width", width); + message.setValueS32("height", height); sendMessage(message); } @@ -853,6 +867,8 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) { if(message_name == "init") { + mTarget = message_in.getValue("target"); + // This is the media init message -- all necessary data for initialization should have been received. if(initBrowser()) { @@ -1179,6 +1195,17 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) } } } + else if(message_name == "proxy_window_opened") + { + std::string target = message_in.getValue("target"); + std::string uuid = message_in.getValue("uuid"); + LLQtWebKit::getInstance()->proxyWindowOpened(mBrowserWindowId, target, uuid); + } + else if(message_name == "proxy_window_closed") + { + std::string uuid = message_in.getValue("uuid"); + LLQtWebKit::getInstance()->proxyWindowClosed(mBrowserWindowId, uuid); + } else { // std::cerr << "MediaPluginWebKit::receiveMessage: unknown media_browser message: " << message_string << std::endl; -- cgit v1.2.3 From 1c3b38cace6d3a673c83230f6f3f20b430738042 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 17 Sep 2010 16:39:22 -0700 Subject: Fix for EXP-78 (javascript window.open function with no size parameters opens a tiny window when all popups setting is enabled). --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 67f49556c5..bd1a44a930 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -549,21 +549,25 @@ private: int x, y, width, height; event.getRectValue(x, y, width, height); - LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "geometry_change"); - message.setValue("uuid", event.getStringValue()); - message.setValueS32("x", x); - message.setValueS32("y", y); - message.setValueS32("width", width); - message.setValueS32("height", height); - sendMessage(message); + // This sometimes gets called with a zero-size request. Don't pass these along. + if(width > 0 && height > 0) + { + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "geometry_change"); + message.setValue("uuid", event.getStringValue()); + message.setValueS32("x", x); + message.setValueS32("y", y); + message.setValueS32("width", width); + message.setValueS32("height", height); + sendMessage(message); + } } - //////////////////////////////////////////////////////////////////////////////// - // virtual - std::string onRequestFilePicker( const EventType& eventIn ) - { - return blockingPickFile(); - } + //////////////////////////////////////////////////////////////////////////////// + // virtual + std::string onRequestFilePicker( const EventType& eventIn ) + { + return blockingPickFile(); + } LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers) { -- cgit v1.2.3 From 5626cc0ccfabfaec74aee5d7bdf6b92d76d9951f Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Wed, 22 Sep 2010 16:25:47 -0700 Subject: Temporary changes to allow the viewer to build against an older version of llqtwebkit. NOTE: once updated builds of llqtwebkit are available on all platforms, this changeset should be backed out. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index bd1a44a930..c47052bae9 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -304,7 +304,11 @@ private: LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); // create single browser window +#if LLQTWEBKIT_API_VERSION < 2 + mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight); +#else mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight, mTarget); +#endif // tell LLQtWebKit about the size of the browser window LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight ); @@ -505,9 +509,14 @@ private: void onClickLinkHref(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href"); +#if LLQTWEBKIT_API_VERSION < 2 + message.setValue("uri", event.getStringValue()); + message.setValue("target", event.getStringValue2()); +#else message.setValue("uri", event.getEventUri()); message.setValue("target", event.getStringValue()); message.setValue("uuid", event.getStringValue2()); +#endif sendMessage(message); } @@ -516,7 +525,11 @@ private: void onClickLinkNoFollow(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_nofollow"); +#if LLQTWEBKIT_API_VERSION < 2 + message.setValue("uri", event.getStringValue()); +#else message.setValue("uri", event.getEventUri()); +#endif sendMessage(message); } @@ -538,7 +551,9 @@ private: void onWindowCloseRequested(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "close_request"); +#if LLQTWEBKIT_API_VERSION >= 2 message.setValue("uuid", event.getStringValue()); +#endif sendMessage(message); } @@ -1199,6 +1214,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) } } } +#if LLQTWEBKIT_API_VERSION >= 2 else if(message_name == "proxy_window_opened") { std::string target = message_in.getValue("target"); @@ -1210,6 +1226,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) std::string uuid = message_in.getValue("uuid"); LLQtWebKit::getInstance()->proxyWindowClosed(mBrowserWindowId, uuid); } +#endif else { // std::cerr << "MediaPluginWebKit::receiveMessage: unknown media_browser message: " << message_string << std::endl; -- cgit v1.2.3 From 0f391c6ac9734a6ed121c0930ba622bcd4284aa9 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 23 Sep 2010 13:46:00 +0100 Subject: Backed out changeset acb451f83a9d original commit log for acb451f83a9d was: "Temporary changes to allow the viewer to build against an older version of llqtwebkit. NOTE: once updated builds of llqtwebkit are available on all platforms, this changeset should be backed out." So, yes, I'm backing that out. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index c47052bae9..bd1a44a930 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -304,11 +304,7 @@ private: LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); // create single browser window -#if LLQTWEBKIT_API_VERSION < 2 - mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight); -#else mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight, mTarget); -#endif // tell LLQtWebKit about the size of the browser window LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight ); @@ -509,14 +505,9 @@ private: void onClickLinkHref(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href"); -#if LLQTWEBKIT_API_VERSION < 2 - message.setValue("uri", event.getStringValue()); - message.setValue("target", event.getStringValue2()); -#else message.setValue("uri", event.getEventUri()); message.setValue("target", event.getStringValue()); message.setValue("uuid", event.getStringValue2()); -#endif sendMessage(message); } @@ -525,11 +516,7 @@ private: void onClickLinkNoFollow(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_nofollow"); -#if LLQTWEBKIT_API_VERSION < 2 - message.setValue("uri", event.getStringValue()); -#else message.setValue("uri", event.getEventUri()); -#endif sendMessage(message); } @@ -551,9 +538,7 @@ private: void onWindowCloseRequested(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "close_request"); -#if LLQTWEBKIT_API_VERSION >= 2 message.setValue("uuid", event.getStringValue()); -#endif sendMessage(message); } @@ -1214,7 +1199,6 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) } } } -#if LLQTWEBKIT_API_VERSION >= 2 else if(message_name == "proxy_window_opened") { std::string target = message_in.getValue("target"); @@ -1226,7 +1210,6 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) std::string uuid = message_in.getValue("uuid"); LLQtWebKit::getInstance()->proxyWindowClosed(mBrowserWindowId, uuid); } -#endif else { // std::cerr << "MediaPluginWebKit::receiveMessage: unknown media_browser message: " << message_string << std::endl; -- cgit v1.2.3