summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml2
-rw-r--r--indra/newview/llfloatermediabrowser.cpp93
-rw-r--r--indra/newview/llfloatermediabrowser.h9
-rw-r--r--indra/newview/llmediactrl.cpp16
-rw-r--r--indra/newview/llmediactrl.h3
-rw-r--r--indra/newview/llviewermedia.cpp107
-rw-r--r--indra/newview/llviewermedia.h8
-rw-r--r--indra/newview/llviewerparcelmedia.cpp6
-rw-r--r--indra/newview/llweb.cpp17
-rw-r--r--indra/newview/llweb.h9
10 files changed, 227 insertions, 43 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index efe418f0e8..f815ae3eb2 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5195,7 +5195,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
- <integer>0</integer>
+ <integer>1</integer>
</map>
<key>MediaOnAPrimUI</key>
<map>
diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp
index 5d0df1f037..5e06a2e078 100644
--- a/indra/newview/llfloatermediabrowser.cpp
+++ b/indra/newview/llfloatermediabrowser.cpp
@@ -45,7 +45,8 @@
#include "llviewermedia.h"
#include "llviewerparcelmedia.h"
#include "llcombobox.h"
-
+#include "llwindow.h"
+#include "lllayoutstack.h"
// TEMP
#include "llsdutil.h"
@@ -56,16 +57,25 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& key)
}
//static
-void LLFloaterMediaBrowser::create(const std::string &url, const std::string& target)
+void LLFloaterMediaBrowser::create(const std::string &url, const std::string& target, const std::string& uuid)
{
+ lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl;
+
std::string tag = target;
if(target.empty() || target == "_blank")
{
- // create a unique tag for this instance
- LLUUID id;
- id.generate();
- tag = id.asString();
+ if(!uuid.empty())
+ {
+ tag = uuid;
+ }
+ else
+ {
+ // create a unique tag for this instance
+ LLUUID id;
+ id.generate();
+ tag = id.asString();
+ }
}
S32 browser_window_limit = gSavedSettings.getS32("MediaBrowserWindowLimit");
@@ -98,11 +108,70 @@ void LLFloaterMediaBrowser::create(const std::string &url, const std::string& ta
llassert(browser);
if(browser)
{
+ browser->mUUID = uuid;
+
// tell the browser instance to load the specified URL
- browser->openMedia(url);
+ browser->openMedia(url, target);
+ LLViewerMedia::proxyWindowOpened(target, uuid);
}
}
+//static
+void LLFloaterMediaBrowser::closeRequest(const std::string &uuid)
+{
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("media_browser");
+ lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+ {
+ LLFloaterMediaBrowser* i = dynamic_cast<LLFloaterMediaBrowser*>(*iter);
+ lldebugs << " " << i->mUUID << llendl;
+ if (i && i->mUUID == uuid)
+ {
+ i->closeFloater(false);
+ return;
+ }
+ }
+}
+
+//static
+void LLFloaterMediaBrowser::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height)
+{
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("media_browser");
+ lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+ {
+ LLFloaterMediaBrowser* i = dynamic_cast<LLFloaterMediaBrowser*>(*iter);
+ lldebugs << " " << i->mUUID << llendl;
+ if (i && i->mUUID == uuid)
+ {
+ i->geometryChanged(x, y, width, height);
+ return;
+ }
+ }
+}
+
+void LLFloaterMediaBrowser::geometryChanged(S32 x, S32 y, S32 width, S32 height)
+{
+ // Make sure the layout of the browser control is updated, so this calculation is correct.
+ LLLayoutStack::updateClass();
+
+ // TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
+ LLCoordWindow window_size;
+ getWindow()->getSize(&window_size);
+
+ // Adjust width and height for the size of the chrome on the Media Browser window.
+ width += getRect().getWidth() - mBrowser->getRect().getWidth();
+ height += getRect().getHeight() - mBrowser->getRect().getHeight();
+
+ LLRect geom;
+ geom.setOriginAndSize(x, window_size.mY - (y + height), width, height);
+
+ lldebugs << "geometry change: " << geom << llendl;
+
+ handleReshape(geom,false);
+}
+
+
void LLFloaterMediaBrowser::draw()
{
getChildView("go")->setEnabled(!mAddressCombo->getValue().asString().empty());
@@ -161,6 +230,7 @@ BOOL LLFloaterMediaBrowser::postBuild()
childSetAction("assign", onClickAssign, this);
buildURLHistory();
+
return TRUE;
}
@@ -201,6 +271,7 @@ std::string LLFloaterMediaBrowser::getSupportURL()
//virtual
void LLFloaterMediaBrowser::onClose(bool app_quitting)
{
+ LLViewerMedia::proxyWindowClosed(mUUID);
//setVisible(FALSE);
destroy();
}
@@ -222,7 +293,12 @@ void LLFloaterMediaBrowser::handleMediaEvent(LLPluginClassMedia* self, EMediaEve
// The browser instance wants its window closed.
closeFloater();
}
+ else if(event == MEDIA_EVENT_GEOMETRY_CHANGE)
+ {
+ geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight());
+ }
}
+
void LLFloaterMediaBrowser::setCurrentURL(const std::string& url)
{
mCurrentURL = url;
@@ -368,9 +444,10 @@ void LLFloaterMediaBrowser::onClickSeek(void* user_data)
if(self->mBrowser->getMediaPlugin())
self->mBrowser->getMediaPlugin()->start(2.0f);
}
-void LLFloaterMediaBrowser::openMedia(const std::string& media_url)
+void LLFloaterMediaBrowser::openMedia(const std::string& media_url, const std::string& target)
{
mBrowser->setHomePageUrl(media_url);
+ mBrowser->setTarget(target);
mBrowser->navigateTo(media_url);
setCurrentURL(media_url);
}
diff --git a/indra/newview/llfloatermediabrowser.h b/indra/newview/llfloatermediabrowser.h
index ee4aef814f..5cb7377a36 100644
--- a/indra/newview/llfloatermediabrowser.h
+++ b/indra/newview/llfloatermediabrowser.h
@@ -42,7 +42,11 @@ public:
LOG_CLASS(LLFloaterMediaBrowser);
LLFloaterMediaBrowser(const LLSD& key);
- static void create(const std::string &url, const std::string& target);
+ static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null);
+
+ static void closeRequest(const std::string &uuid);
+ static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height);
+ void geometryChanged(S32 x, S32 y, S32 width, S32 height);
/*virtual*/ BOOL postBuild();
/*virtual*/ void onClose(bool app_quitting);
@@ -51,7 +55,7 @@ public:
// inherited from LLViewerMediaObserver
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
- void openMedia(const std::string& media_url);
+ void openMedia(const std::string& media_url, const std::string& target);
void buildURLHistory();
std::string getSupportURL();
void setCurrentURL(const std::string& url);
@@ -73,6 +77,7 @@ private:
LLMediaCtrl* mBrowser;
LLComboBox* mAddressCombo;
std::string mCurrentURL;
+ std::string mUUID;
};
#endif // LL_LLFLOATERMEDIABROWSER_H
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 1de249a3c1..635ceb8380 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -572,6 +572,15 @@ void LLMediaCtrl::setHomePageUrl( const std::string& urlIn, const std::string& m
}
}
+void LLMediaCtrl::setTarget(const std::string& target)
+{
+ mTarget = target;
+ if (mMediaSource)
+ {
+ mMediaSource->setTarget(mTarget);
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
//
bool LLMediaCtrl::setCaretColor(unsigned int red, unsigned int green, unsigned int blue)
@@ -613,6 +622,7 @@ bool LLMediaCtrl::ensureMediaSourceExists()
{
mMediaSource->setUsedInUI(true);
mMediaSource->setHomeURL(mHomePageUrl, mHomePageMimeType);
+ mMediaSource->setTarget(mTarget);
mMediaSource->setVisible( getVisible() );
mMediaSource->addObserver( this );
mMediaSource->setBackgroundColor( getBackgroundColor() );
@@ -962,6 +972,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
}
break;
+
+ case MEDIA_EVENT_GEOMETRY_CHANGE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;
+ }
+ break;
};
// chain all events to any potential observers of this object.
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 755d1e1b04..6fefd8f6d7 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -107,6 +107,8 @@ public:
void setHomePageUrl( const std::string& urlIn, const std::string& mime_type = LLStringUtil::null );
std::string getHomePageUrl();
+
+ void setTarget(const std::string& target);
// set/clear URL to visit when a 404 page is reached
void set404RedirectUrl( std::string redirect_url );
@@ -171,6 +173,7 @@ public:
std::string mHomePageUrl;
std::string mHomePageMimeType;
std::string mCurrentNavUrl;
+ std::string mTarget;
bool mIgnoreUIScale;
bool mAlwaysRefresh;
viewer_media_t mMediaSource;
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 <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
@@ -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);
+ }
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index e0cc26fa29..4025a4484f 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -152,6 +152,9 @@ public:
static void openIDSetup(const std::string &openid_url, const std::string &openid_token);
static void openIDCookieResponse(const std::string &cookie);
+ static void proxyWindowOpened(const std::string &target, const std::string &uuid);
+ static void proxyWindowClosed(const std::string &uuid);
+
private:
static void setOpenIDCookie();
static void onTeleportFinished();
@@ -271,8 +274,10 @@ public:
ECursorType getLastSetCursor() { return mLastSetCursor; }
+ void setTarget(const std::string& target) { mTarget = target; }
+
// utility function to create a ready-to-use media instance from a desired media type.
- static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height);
+ static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, const std::string target = LLStringUtil::null);
// Internally set our desired browser user agent string, including
// the Second Life version and skin name. Used because we can
@@ -438,6 +443,7 @@ private:
bool mNavigateSuspended;
bool mNavigateSuspendedDeferred;
bool mTrustedBrowser;
+ std::string mTarget;
private:
BOOL mIsUpdated ;
diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp
index 335776029f..99e869dafc 100644
--- a/indra/newview/llviewerparcelmedia.cpp
+++ b/indra/newview/llviewerparcelmedia.cpp
@@ -580,6 +580,12 @@ void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << LL_ENDL;
}
break;
+
+ case MEDIA_EVENT_GEOMETRY_CHANGE:
+ {
+ LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID() << LL_ENDL;
+ }
+ break;
};
}
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 298e5590d0..912413d06a 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -78,12 +78,12 @@ void LLWeb::initClass()
// static
-void LLWeb::loadURL(const std::string& url, const std::string& target)
+void LLWeb::loadURL(const std::string& url, const std::string& target, const std::string& uuid)
{
if(target == "_internal")
{
// Force load in the internal browser, as if with a blank target.
- loadURLInternal(url);
+ loadURLInternal(url, "", uuid);
}
else if (gSavedSettings.getBOOL("UseExternalBrowser") || (target == "_external"))
{
@@ -91,28 +91,31 @@ void LLWeb::loadURL(const std::string& url, const std::string& target)
}
else
{
- loadURLInternal(url, target);
+ loadURLInternal(url, target, uuid);
}
}
// static
-void LLWeb::loadURLInternal(const std::string &url, const std::string& target)
+void LLWeb::loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
{
- LLFloaterMediaBrowser::create(url, target);
+ LLFloaterMediaBrowser::create(url, target, uuid);
}
// static
-void LLWeb::loadURLExternal(const std::string& url)
+void LLWeb::loadURLExternal(const std::string& url, const std::string& uuid)
{
loadURLExternal(url, true);
}
// static
-void LLWeb::loadURLExternal(const std::string& url, bool async)
+void LLWeb::loadURLExternal(const std::string& url, bool async, const std::string& uuid)
{
+ // Act like the proxy window was closed, since we won't be able to track targeted windows in the external browser.
+ LLViewerMedia::proxyWindowClosed(uuid);
+
LLSD payload;
payload["url"] = url;
LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, boost::bind(on_load_url_external_response, _1, _2, async));
diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h
index 691b687fef..2915376583 100644
--- a/indra/newview/llweb.h
+++ b/indra/newview/llweb.h
@@ -43,18 +43,19 @@ public:
static void initClass();
/// Load the given url in the user's preferred web browser
- static void loadURL(const std::string& url, const std::string& target);
+ static void loadURL(const std::string& url, const std::string& target, const std::string& uuid = LLStringUtil::null);
static void loadURL(const std::string& url) { loadURL(url, LLStringUtil::null); }
/// Load the given url in the user's preferred web browser
static void loadURL(const char* url, const std::string& target) { loadURL( ll_safe_string(url), target); }
static void loadURL(const char* url) { loadURL( ll_safe_string(url), LLStringUtil::null ); }
/// Load the given url in the Second Life internal web browser
- static void loadURLInternal(const std::string &url, const std::string& target);
+ static void loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null);
static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null); }
/// Load the given url in the operating system's web browser, async if we want to return immediately
/// before browser has spawned
- static void loadURLExternal(const std::string& url);
- static void loadURLExternal(const std::string& url, bool async);
+ static void loadURLExternal(const std::string& url) { loadURLExternal(url, LLStringUtil::null); };
+ static void loadURLExternal(const std::string& url, const std::string& uuid);
+ static void loadURLExternal(const std::string& url, bool async, const std::string& uuid = LLStringUtil::null);
/// Returns escaped url (eg, " " to "%20") - used by all loadURL methods
static std::string escapeURL(const std::string& url);