From d4668787addf870fca0dc1cbf03c756584838261 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 5 Aug 2010 11:16:13 -0700 Subject: Allow targeted links in the embedded browser to open multiple media browser windows. Added an optional "target" parameter" to LLWeb::loadURL and loadInternal. Made LLViewerMediaImpl::handleMediaEvent pass the target attribute of clicked links through. Set floater_media_browser.xml to allow multiple instances. Added LLFloaterMediaBrowser::create() and made LLFloaterMediaBrowser assume the incoming tag is the window's target, not the URL. Reviewed by Richard at http://codereview.lindenlab.com/2641050 --- indra/newview/llviewermedia.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 77f7740449..7a17bfeb46 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2826,25 +2826,18 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL; // retrieve the event parameters std::string url = plugin->getClickURL(); + std::string target = plugin->getClickTarget(); U32 target_type = plugin->getClickTargetType(); - + switch (target_type) { - case LLPluginClassMedia::TARGET_EXTERNAL: - // force url to external browser - LLWeb::loadURLExternal(url); - break; - case LLPluginClassMedia::TARGET_BLANK: - // open in SL media browser or external browser based on user pref - LLWeb::loadURL(url); - break; case LLPluginClassMedia::TARGET_NONE: // ignore this click and let media plugin handle it break; - case LLPluginClassMedia::TARGET_OTHER: - LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL; + default: + // loadURL now handles distinguishing between _blank, _external, and other named targets. + LLWeb::loadURL(url, target); break; - default: break; } }; break; -- cgit v1.2.3 From 74d4bbfa0a50df83a4fe419294609b6ef2af7a80 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 26 Aug 2010 12:26:31 -0700 Subject: Added the MediaEnablePopups setting as a global on/off switch for media popups. --- indra/newview/llviewermedia.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index d89ee13b95..6f824b84e3 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2835,8 +2835,11 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla // ignore this click and let media plugin handle it break; default: - // loadURL now handles distinguishing between _blank, _external, and other named targets. - LLWeb::loadURL(url, target); + if(gSavedSettings.getBOOL("MediaEnablePopups")) + { + // loadURL now handles distinguishing between _blank, _external, and other named targets. + LLWeb::loadURL(url, target); + } break; } }; -- 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/newview/llviewermedia.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 2e3570a3af..012a4d2920 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -51,6 +51,7 @@ #include "llvoavatarself.h" #include "llviewerregion.h" #include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this! +#include "llfilepicker.h" #include "llevent.h" // LLSimpleListener #include "llnotificationsutil.h" @@ -2967,6 +2968,22 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla } break; + case LLViewerMediaObserver::MEDIA_EVENT_PICK_FILE_REQUEST: + { + // Display a file picker + std::string response; + + LLFilePicker& picker = LLFilePicker::instance(); + if (!picker.getOpenFile(LLFilePicker::FFLOAD_ALL)) + { + // The user didn't pick a file -- the empty response string will indicate this. + } + + response = picker.getFirstFile(); + + plugin->sendPickFileResponse(response); + } + break; default: break; -- 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/newview/llviewermedia.cpp | 107 ++++++++++++++++++++++++++++++++-------- 1 file changed, 87 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 012a4d2920..860d0b9fd6 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -61,6 +61,8 @@ //#include "llfirstuse.h" #include "llwindow.h" +#include "llfloatermediabrowser.h" // for handling window close requests and geometry change requests in media browser windows. + #include // for SkinFolder listener #include @@ -1366,6 +1368,38 @@ void LLViewerMedia::openIDCookieResponse(const std::string &cookie) setOpenIDCookie(); } +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::proxyWindowOpened(const std::string &target, const std::string &uuid) +{ + if(uuid.empty()) + return; + + for (impl_list::iterator iter = sViewerMediaImplList.begin(); iter != sViewerMediaImplList.end(); iter++) + { + if((*iter)->mMediaSource && (*iter)->mMediaSource->pluginSupportsMediaBrowser()) + { + (*iter)->mMediaSource->proxyWindowOpened(target, uuid); + } + } +} + +///////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::proxyWindowClosed(const std::string &uuid) +{ + if(uuid.empty()) + return; + + for (impl_list::iterator iter = sViewerMediaImplList.begin(); iter != sViewerMediaImplList.end(); iter++) + { + if((*iter)->mMediaSource && (*iter)->mMediaSource->pluginSupportsMediaBrowser()) + { + (*iter)->mMediaSource->proxyWindowClosed(uuid); + } + } +} + bool LLViewerMedia::hasInWorldMedia() { if (sInWorldMediaDisabled) return false; @@ -1599,7 +1633,7 @@ void LLViewerMediaImpl::setMediaType(const std::string& media_type) ////////////////////////////////////////////////////////////////////////////////////////// /*static*/ -LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height) +LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target) { std::string plugin_basename = LLMIMETypes::implType(media_type); @@ -1655,7 +1689,9 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ // collect 'javascript enabled' setting from prefs and send to embedded browser bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" ); media_source->setJavascriptEnabled( javascript_enabled ); - + + media_source->setTarget(target); + if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))) { return media_source; @@ -1706,7 +1742,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) // Save the MIME type that really caused the plugin to load mCurrentMimeType = mMimeType; - LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight); + LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight, mTarget); if (media_source) { @@ -2806,6 +2842,7 @@ bool LLViewerMediaImpl::isPlayable() const ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent event) { + bool pass_through = true; switch(event) { case MEDIA_EVENT_CLICK_LINK_NOFOLLOW: @@ -2822,21 +2859,10 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla // retrieve the event parameters std::string url = plugin->getClickURL(); std::string target = plugin->getClickTarget(); - U32 target_type = plugin->getClickTargetType(); - - switch (target_type) - { - case LLPluginClassMedia::TARGET_NONE: - // ignore this click and let media plugin handle it - break; - default: - if(gSavedSettings.getBOOL("MediaEnablePopups")) - { - // loadURL now handles distinguishing between _blank, _external, and other named targets. - LLWeb::loadURL(url, target); - } - break; - } + std::string uuid = plugin->getClickUUID(); + + // loadURL now handles distinguishing between _blank, _external, and other named targets. + LLWeb::loadURL(url, target, uuid); }; break; case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH: @@ -2985,12 +3011,53 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla } break; + case LLViewerMediaObserver::MEDIA_EVENT_CLOSE_REQUEST: + { + std::string uuid = plugin->getClickUUID(); + + llinfos << "MEDIA_EVENT_CLOSE_REQUEST for uuid " << uuid << llendl; + + if(uuid.empty()) + { + // This close request is directed at this instance, let it fall through. + } + else + { + // This close request is directed at another instance + pass_through = false; + LLFloaterMediaBrowser::closeRequest(uuid); + } + } + break; + + case LLViewerMediaObserver::MEDIA_EVENT_GEOMETRY_CHANGE: + { + std::string uuid = plugin->getClickUUID(); + + llinfos << "MEDIA_EVENT_GEOMETRY_CHANGE for uuid " << uuid << llendl; + + if(uuid.empty()) + { + // This geometry change request is directed at this instance, let it fall through. + } + else + { + // This request is directed at another instance + pass_through = false; + LLFloaterMediaBrowser::geometryChanged(uuid, plugin->getGeometryX(), plugin->getGeometryY(), plugin->getGeometryWidth(), plugin->getGeometryHeight()); + } + } + break; + default: break; } - // Just chain the event to observers. - emitEvent(plugin, event); + if(pass_through) + { + // Just chain the event to observers. + emitEvent(plugin, event); + } } //////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 387011a1ff519d0e339b446ff5d02f0d009b7e5d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 Sep 2010 00:45:27 -0700 Subject: EXP-29 WIP Implement popup blocking added web popup notification overlay --- indra/newview/llviewermedia.cpp | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'indra/newview/llviewermedia.cpp') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 012a4d2920..31e4753553 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2819,24 +2819,6 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla case MEDIA_EVENT_CLICK_LINK_HREF: { LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL; - // retrieve the event parameters - std::string url = plugin->getClickURL(); - std::string target = plugin->getClickTarget(); - U32 target_type = plugin->getClickTargetType(); - - switch (target_type) - { - case LLPluginClassMedia::TARGET_NONE: - // ignore this click and let media plugin handle it - break; - default: - if(gSavedSettings.getBOOL("MediaEnablePopups")) - { - // loadURL now handles distinguishing between _blank, _external, and other named targets. - LLWeb::loadURL(url, target); - } - break; - } }; break; case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH: -- cgit v1.2.3