Dullasync

Fixes scaling issue
Also fixes the openid cookie
This commit is contained in:
Lirusaito
2019-04-10 06:43:14 -04:00
parent 621a342809
commit 3462f403fe
8 changed files with 570 additions and 502 deletions

View File

@@ -1745,9 +1745,6 @@ bool LLAppViewer::cleanup()
removeDumpDir(); removeDumpDir();
writeDebugInfo(); writeDebugInfo();
if(!gDirUtilp->getLindenUserDir(true).empty())
LLViewerMedia::saveCookieFile();
// Stop the plugin read thread if it's running. // Stop the plugin read thread if it's running.
LLPluginProcessParent::setUseReadThread(false); LLPluginProcessParent::setUseReadThread(false);
// Stop curl responder call backs. // Stop curl responder call backs.

View File

@@ -70,14 +70,14 @@ LLMediaCtrl::Params::Params()
: start_url("start_url"), : start_url("start_url"),
border_visible("border_visible", false), border_visible("border_visible", false),
decouple_texture_size("decouple_texture_size", false), decouple_texture_size("decouple_texture_size", false),
trusted_content("trusted_content", false),
focus_on_click("focus_on_click", true),
texture_width("texture_width", 1024), texture_width("texture_width", 1024),
texture_height("texture_height", 1024), texture_height("texture_height", 1024),
caret_color("caret_color"), caret_color("caret_color"),
initial_mime_type("initial_mime_type"), initial_mime_type("initial_mime_type"),
error_page_url("error_page_url"),
media_id("media_id"), media_id("media_id"),
trusted_content("trusted_content", false), error_page_url("error_page_url")
focus_on_click("focus_on_click", true)
{ {
} }
@@ -85,25 +85,25 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
LLPanel( p.name, p.rect, FALSE), LLPanel( p.name, p.rect, FALSE),
LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()), LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
mTextureDepthBytes( 4 ), mTextureDepthBytes( 4 ),
mBorder(NULL), mBorder(nullptr),
mFrequentUpdates( true ), mFrequentUpdates( true ),
mForceUpdate( false ), mForceUpdate( false ),
mHomePageUrl( "" ), mTrusted(p.trusted_content),
mAlwaysRefresh( false ), mAlwaysRefresh( false ),
mMediaSource( 0 ),
mTakeFocusOnClick( p.focus_on_click ), mTakeFocusOnClick( p.focus_on_click ),
mCurrentNavUrl( "about:blank" ),
mStretchToFill( true ), mStretchToFill( true ),
mMaintainAspectRatio ( true ), mMaintainAspectRatio ( true ),
mClearCache(false),
mHoverTextChanged(false),
mDecoupleTextureSize ( false ), mDecoupleTextureSize ( false ),
mUpdateScrolls( false ),
mHomePageUrl( "" ),
mHomePageMimeType(p.initial_mime_type),
mCurrentNavUrl( "about:blank" ),
mErrorPageURL(p.error_page_url),
mMediaSource( nullptr ),
mTextureWidth ( 1024 ), mTextureWidth ( 1024 ),
mTextureHeight ( 1024 ), mTextureHeight ( 1024 ),
mClearCache(false),
mUpdateScrolls( false ),
mHomePageMimeType(p.initial_mime_type),
mErrorPageURL(p.error_page_url),
mTrusted(p.trusted_content),
mHoverTextChanged(false),
mContextMenu() mContextMenu()
{ {
{ {
@@ -141,6 +141,13 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
LLMediaCtrl::~LLMediaCtrl() LLMediaCtrl::~LLMediaCtrl()
{ {
auto menu = mContextMenu.get();
if (menu)
{
menu->die();
mContextMenu.markDead();
}
if (mMediaSource) if (mMediaSource)
{ {
mMediaSource->remObserver( this ); mMediaSource->remObserver( this );
@@ -158,7 +165,9 @@ void LLMediaCtrl::setBorderVisible( BOOL border_visible )
addChild( mBorder ); addChild( mBorder );
} }
if(mBorder) if(mBorder)
{
mBorder->setVisible(border_visible); mBorder->setVisible(border_visible);
}
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -241,7 +250,7 @@ BOOL LLMediaCtrl::handleMouseUp( S32 x, S32 y, MASK mask )
mMediaSource->mouseUp(x, y, mask); mMediaSource->mouseUp(x, y, mask);
} }
gFocusMgr.setMouseCapture( NULL ); gFocusMgr.setMouseCapture(nullptr );
return TRUE; return TRUE;
} }
@@ -286,7 +295,7 @@ BOOL LLMediaCtrl::handleRightMouseUp( S32 x, S32 y, MASK mask )
} }
} }
gFocusMgr.setMouseCapture( NULL ); gFocusMgr.setMouseCapture(nullptr );
return TRUE; return TRUE;
} }
@@ -310,12 +319,19 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask )
setFocus( TRUE ); setFocus( TRUE );
} }
LLMenuGL* menu = (LLMenuGL*)mContextMenu.get(); auto con_menu = (LLMenuGL*)mContextMenu.get();
if (menu) if (con_menu)
{ {
menu->buildDrawLabels(); /* Singu Note: Share your toys!!
menu->updateParent(LLMenuGL::sMenuContainer); // hide/show debugging options
LLMenuGL::showPopup(this,menu, x, y); bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
con_menu->setItemVisible("open_webinspector", media_plugin_debugging_enabled );
con_menu->setItemVisible("debug_separator", media_plugin_debugging_enabled );
*/
con_menu->buildDrawLabels();
con_menu->updateParent(LLMenuGL::sMenuContainer);
LLMenuGL::showPopup(this, con_menu, x, y);
} }
return TRUE; return TRUE;
@@ -367,7 +383,7 @@ void LLMediaCtrl::onFocusLost()
if( LLEditMenuHandler::gEditMenuHandler == mMediaSource ) if( LLEditMenuHandler::gEditMenuHandler == mMediaSource )
{ {
// Clear focus for edit menu items // Clear focus for edit menu items
LLEditMenuHandler::gEditMenuHandler = NULL; LLEditMenuHandler::gEditMenuHandler = nullptr;
} }
} }
@@ -380,13 +396,21 @@ void LLMediaCtrl::onFocusLost()
// //
BOOL LLMediaCtrl::postBuild () BOOL LLMediaCtrl::postBuild ()
{ {
LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_media_ctrl.xml",LLMenuGL::sMenuContainer); /*LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar;
registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this));
registar.add("Open.ViewSource", boost::bind(&LLMediaCtrl::onShowSource, this));
// stinson 05/05/2014 : use this as the parent of the context menu if the static menu
// container has yet to be created
LLView* menuParent = (gMenuHolder != nullptr) ? dynamic_cast<LLView*>(gMenuHolder) : dynamic_cast<LLView*>(this);
llassert(menuParent != NULL);*/
auto menu = LLUICtrlFactory::getInstance()->buildMenu("menu_media_ctrl.xml",LLMenuGL::sMenuContainer);
if(menu) if(menu)
{ {
mContextMenu = menu->getHandle(); mContextMenu = menu->getHandle();
} }
setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2)); setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2));
return true; return true;
} }
@@ -453,12 +477,9 @@ BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char)
{ {
BOOL result = FALSE; BOOL result = FALSE;
// only accept 'printable' characters, sigh... if (mMediaSource)
if (uni_char >= 32 // discard 'control' characters
&& uni_char != 127) // SDL thinks this is 'delete' - yuck.
{ {
if (mMediaSource) result = mMediaSource->handleUnicodeCharHere(uni_char);
result = mMediaSource->handleUnicodeCharHere(uni_char);
} }
if ( ! result ) if ( ! result )
@@ -469,7 +490,7 @@ BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
void LLMediaCtrl::onVisibilityChange ( const LLSD& new_visibility ) void LLMediaCtrl::onVisibilityChanged( const LLSD& new_visibility )
{ {
// set state of frequent updates automatically if visibility changes // set state of frequent updates automatically if visibility changes
if ( new_visibility.asBoolean() ) if ( new_visibility.asBoolean() )
@@ -568,7 +589,7 @@ void LLMediaCtrl::clearCache()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type) void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type, bool clean_browser)
{ {
// don't browse to anything that starts with secondlife:// or sl:// // don't browse to anything that starts with secondlife:// or sl://
const std::string protocol1 = "secondlife://"; const std::string protocol1 = "secondlife://";
@@ -585,7 +606,7 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type)
{ {
mCurrentNavUrl = url_in; mCurrentNavUrl = url_in;
mMediaSource->setSize(mTextureWidth, mTextureHeight); mMediaSource->setSize(mTextureWidth, mTextureHeight);
mMediaSource->navigateTo(url_in, mime_type, mime_type.empty()); mMediaSource->navigateTo(url_in, mime_type, mime_type.empty(), false, clean_browser);
} }
} }
@@ -768,8 +789,8 @@ void LLMediaCtrl::draw()
bool draw_media = false; bool draw_media = false;
LLPluginClassMedia* media_plugin = NULL; LLPluginClassMedia* media_plugin = nullptr;
LLViewerMediaTexture* media_texture = NULL; LLViewerMediaTexture* media_texture = nullptr;
if(mMediaSource && mMediaSource->hasMedia()) if(mMediaSource && mMediaSource->hasMedia())
{ {
@@ -806,52 +827,8 @@ void LLMediaCtrl::draw()
F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth(); F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth();
F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight(); F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight();
LLRect r = getRect(); S32 x_offset, y_offset, width, height;
S32 width, height; calcOffsetsAndSize(&x_offset, &y_offset, &width, &height);
S32 x_offset = 0;
S32 y_offset = 0;
if(mStretchToFill)
{
if(mMaintainAspectRatio)
{
F32 media_aspect = (F32)(media_plugin->getWidth()) / (F32)(media_plugin->getHeight());
F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
if(media_aspect > view_aspect)
{
// max width, adjusted height
width = r.getWidth();
height = llmin(llmax(ll_round(width / media_aspect), 0), r.getHeight());
}
else
{
// max height, adjusted width
height = r.getHeight();
width = llmin(llmax(ll_round(height * media_aspect), 0), r.getWidth());
}
}
else
{
width = r.getWidth();
height = r.getHeight();
}
}
else
{
width = llmin(media_plugin->getWidth(), r.getWidth());
height = llmin(media_plugin->getHeight(), r.getHeight());
}
x_offset = (r.getWidth() - width) / 2;
y_offset = (r.getHeight() - height) / 2;
/*if (mIgnoreUIScale)
{
x_offset = ll_round((F32)x_offset * LLUI::getScaleFactor().mV[VX]);
y_offset = ll_round((F32)y_offset * LLUI::getScaleFactor().mV[VY]);
width = ll_round((F32)width * LLUI::getScaleFactor().mV[VX]);
height = ll_round((F32)height * LLUI::getScaleFactor().mV[VY]);
}*/
// draw the browser // draw the browser
gGL.setSceneBlendType(LLRender::BT_REPLACE); gGL.setSceneBlendType(LLRender::BT_REPLACE);
@@ -910,6 +887,50 @@ void LLMediaCtrl::draw()
setBackgroundOpaque(background_opaque); setBackgroundOpaque(background_opaque);
} }
////////////////////////////////////////////////////////////////////////////////
//
void LLMediaCtrl::calcOffsetsAndSize(S32 *x_offset, S32 *y_offset, S32 *width, S32 *height)
{
const LLRect &r = getRect();
*x_offset = *y_offset = 0;
const auto& media_plugin = mMediaSource->getMediaPlugin();
if(mStretchToFill)
{
if(mMaintainAspectRatio)
{
F32 media_aspect = (F32)(media_plugin->getWidth()) / (F32)(media_plugin->getHeight());
F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
if(media_aspect > view_aspect)
{
// max width, adjusted height
*width = r.getWidth();
*height = llmin(llmax(ll_round(*width / media_aspect), 0), r.getHeight());
}
else
{
// max height, adjusted width
*height = r.getHeight();
*width = llmin(llmax(ll_round(*height * media_aspect), 0), r.getWidth());
}
}
else
{
*width = r.getWidth();
*height = r.getHeight();
}
}
else
{
*width = llmin(media_plugin->getWidth(), r.getWidth());
*height = llmin(media_plugin->getHeight(), r.getHeight());
}
*x_offset = (r.getWidth() - *width) / 2;
*y_offset = (r.getHeight() - *height) / 2;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
void LLMediaCtrl::convertInputCoords(S32& x, S32& y) void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
@@ -1013,17 +1034,24 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
case MEDIA_EVENT_CLICK_LINK_HREF: case MEDIA_EVENT_CLICK_LINK_HREF:
{ {
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL;
// retrieve the event parameters // retrieve the event parameters
std::string url = self->getClickURL(); std::string url = self->getClickURL();
std::string target = self->getClickTarget(); std::string target = self->getClickTarget();
std::string uuid = self->getClickUUID(); std::string uuid = self->getClickUUID();
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << target << "\", uri is " << url << LL_ENDL;
LLWeb::loadURL(url, target, std::string()); // try as slurl first
if (!LLURLDispatcher::dispatch(url, "clicked", nullptr, mTrusted))
{
LLWeb::loadURL(url, target, uuid);
}
//LLNotification::Params notify_params("PopupAttempt"); // CP: removing this code because we no longer support popups so this breaks the flow.
// replaced with a bare call to LLWeb::LoadURL(...)
//LLNotification::Params notify_params;
//notify_params.name = "PopupAttempt";
//notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID); //notify_params.payload = LLSD().with("target", target).with("url", url).with("uuid", uuid).with("media_id", mMediaTextureID);
//notify_params.functor(boost::bind(&LLMediaCtrl::onPopup, this, _1, _2)); //notify_params.functor.function = boost::bind(&LLMediaCtrl::onPopup, this, _1, _2);
//if (mTrusted) //if (mTrusted)
//{ //{
@@ -1111,7 +1139,24 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
case MEDIA_EVENT_DEBUG_MESSAGE: case MEDIA_EVENT_DEBUG_MESSAGE:
{ {
LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL; std::string level = self->getDebugMessageLevel();
if (level == "debug")
{
LL_DEBUGS("Media") << self->getDebugMessageText() << LL_ENDL;
}
else if (level == "info")
{
LL_INFOS("Media") << self->getDebugMessageText() << LL_ENDL;
}
else if (level == "warn")
{
LL_WARNS("Media") << self->getDebugMessageText() << LL_ENDL;
}
else if (level == "error")
{
LL_ERRS("Media") << self->getDebugMessageText() << LL_ENDL;
}
}; };
break; break;
@@ -1132,7 +1177,7 @@ std::string LLMediaCtrl::getCurrentNavUrl()
return mCurrentNavUrl; return mCurrentNavUrl;
} }
bool LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response)
{ {
if (response["open"]) if (response["open"])
{ {
@@ -1143,7 +1188,6 @@ bool LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response)
// Make sure the opening instance knows its window open request was denied, so it can clean things up. // Make sure the opening instance knows its window open request was denied, so it can clean things up.
LLViewerMedia::proxyWindowClosed(notification["payload"]["uuid"]); LLViewerMedia::proxyWindowClosed(notification["payload"]["uuid"]);
} }
return FALSE;
} }
void LLMediaCtrl::showNotification(LLNotificationPtr notify) void LLMediaCtrl::showNotification(LLNotificationPtr notify)

View File

@@ -2,31 +2,25 @@
* @file llmediactrl.h * @file llmediactrl.h
* @brief Web browser UI control * @brief Web browser UI control
* *
* $LicenseInfo:firstyear=2006&license=viewergpl$ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
*
* Copyright (c) 2006-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -90,7 +84,7 @@ public:
// Defaults to true. // Defaults to true.
void setTakeFocusOnClick( bool take_focus ); void setTakeFocusOnClick( bool take_focus );
virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual LLXMLNodePtr getXML(bool save_children = true) const override;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
// handle mouse related methods // handle mouse related methods
@@ -104,7 +98,7 @@ public:
BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) override; BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) override;
// navigation // navigation
void navigateTo( std::string url_in, std::string mime_type = ""); void navigateTo( std::string url_in, std::string mime_type = "", bool clean_browser = false);
void navigateBack(); void navigateBack();
void navigateHome(); void navigateHome();
void navigateForward(); void navigateForward();
@@ -190,8 +184,11 @@ public:
void convertInputCoords(S32& x, S32& y); void convertInputCoords(S32& x, S32& y);
private: private:
void onVisibilityChange ( const LLSD& new_visibility ); void calcOffsetsAndSize(S32 *x_offset, S32 *y_offset, S32 *width, S32 *height);
bool onPopup(const LLSD& notification, const LLSD& response);
private:
void onVisibilityChanged ( const LLSD& new_visibility );
void onPopup(const LLSD& notification, const LLSD& response);
const S32 mTextureDepthBytes; const S32 mTextureDepthBytes;
LLUUID mMediaTextureID; LLUUID mMediaTextureID;

View File

@@ -1140,9 +1140,7 @@ bool idle_startup()
// Load URL History File // Load URL History File
LLURLHistory::loadFile("url_history.xml"); LLURLHistory::loadFile("url_history.xml");
// Load media plugin cookies
LLViewerMedia::loadCookieFile();
//------------------------------------------------- //-------------------------------------------------
// Handle startup progress screen // Handle startup progress screen
//------------------------------------------------- //-------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -2,31 +2,25 @@
* @file llviewermedia.h * @file llviewermedia.h
* @brief Client interface to the media engine * @brief Client interface to the media engine
* *
* $LicenseInfo:firstyear=2007&license=viewergpl$ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
*
* Copyright (c) 2007-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -46,7 +40,6 @@
#include "llnotificationptr.h" #include "llnotificationptr.h"
#include "llurl.h" #include "llurl.h"
#include "llviewerpluginmanager.h" #include "llviewerpluginmanager.h"
class LLViewerMediaImpl; class LLViewerMediaImpl;
@@ -55,7 +48,6 @@ class LLViewerMediaTexture;
class LLMediaEntry; class LLMediaEntry;
class LLVOVolume; class LLVOVolume;
class LLMimeDiscoveryResponder; class LLMimeDiscoveryResponder;
class LLPluginCookieStore;
typedef LLPointer<LLViewerMediaImpl> viewer_media_t; typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@@ -111,10 +103,14 @@ public:
// Is any media currently "showing"? Includes Parcel Media. Does not include media in the UI. // Is any media currently "showing"? Includes Parcel Media. Does not include media in the UI.
static bool isAnyMediaShowing(); static bool isAnyMediaShowing();
// Shows if any media is playing, counts visible non time based media as playing. Does not include media in the UI.
static bool isAnyMediaPlaying();
// Set all media enabled or disabled, depending on val. Does not include media in the UI. // Set all media enabled or disabled, depending on val. Does not include media in the UI.
static void setAllMediaEnabled(bool val); static void setAllMediaEnabled(bool val);
// Set all media paused(stopped for non time based) or playing, depending on val. Does not include media in the UI.
static void setAllMediaPaused(bool val);
static void updateMedia(void* dummy_arg = NULL); static void updateMedia(void* dummy_arg = nullptr);
static void initClass(); static void initClass();
static void cleanupClass(); static void cleanupClass();
@@ -151,13 +147,6 @@ public:
// Set the proxy config for all loaded plugins // Set the proxy config for all loaded plugins
static void setProxyConfig(bool enable, const std::string &host, int port); static void setProxyConfig(bool enable, const std::string &host, int port);
static LLPluginCookieStore *getCookieStore();
static void loadCookieFile();
static void saveCookieFile();
static void addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path = std::string("/"), bool secure = false );
static void addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path = std::string("/"), bool secure = false );
static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") );
static void openIDSetup(const std::string &openid_url, const std::string &openid_token); static void openIDSetup(const std::string &openid_url, const std::string &openid_token);
static void openIDCookieResponse(const std::string &cookie); static void openIDCookieResponse(const std::string &cookie);
@@ -172,10 +161,12 @@ public:
static class AIHTTPHeaders getHeaders(); static class AIHTTPHeaders getHeaders();
private: private:
static bool parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path, bool& httponly, bool& secure);
static void setOpenIDCookie(); static void setOpenIDCookie();
static void onTeleportFinished(); static void onTeleportFinished();
static LLPluginCookieStore *sCookieStore; static void getOpenIDCookieCoro(std::string url);
static LLURL sOpenIDURL; static LLURL sOpenIDURL;
static std::string sOpenIDCookie; static std::string sOpenIDCookie;
static LLPluginClassMedia* sSpareBrowserMediaSource; static LLPluginClassMedia* sSpareBrowserMediaSource;
@@ -201,7 +192,7 @@ public:
~LLViewerMediaImpl(); ~LLViewerMediaImpl();
// Override inherited version from LLViewerMediaEventEmitter // Override inherited version from LLViewerMediaEventEmitter
virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event); void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event) override;
void createMediaSource(); void createMediaSource();
void destroyMediaSource(); void destroyMediaSource();
@@ -223,6 +214,7 @@ public:
void skipBack(F32 step_scale); void skipBack(F32 step_scale);
void skipForward(F32 step_scale); void skipForward(F32 step_scale);
void setVolume(F32 volume); void setVolume(F32 volume);
void setMute(bool mute);
void updateVolume(); void updateVolume();
F32 getVolume(); F32 getVolume();
void focus(bool focus); void focus(bool focus);
@@ -244,7 +236,7 @@ public:
void navigateReload(); void navigateReload();
void navigateHome(); void navigateHome();
void unload(); void unload();
void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false, bool server_request = false); void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false, bool server_request = false, bool clean_browser = false);
void navigateInternal(); void navigateInternal();
void navigateStop(); void navigateStop();
bool handleKeyHere(KEY key, MASK mask); bool handleKeyHere(KEY key, MASK mask);
@@ -301,7 +293,7 @@ public:
void setTarget(const std::string& target) { mTarget = target; } void setTarget(const std::string& target) { mTarget = target; }
// utility function to create a ready-to-use media instance from a desired media type. // 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, const std::string target = LLStringUtil::null); static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, F64 zoom_factor, const std::string target = LLStringUtil::null, bool clean_browser = false);
// Internally set our desired browser user agent string, including // Internally set our desired browser user agent string, including
// the Second Life version and skin name. Used because we can // the Second Life version and skin name. Used because we can
@@ -313,40 +305,51 @@ public:
static bool handleSkinCurrentChanged(const LLSD& newvalue); static bool handleSkinCurrentChanged(const LLSD& newvalue);
// need these to handle mouseup... // need these to handle mouseup...
/*virtual*/ void onMouseCaptureLost(); /*virtual*/ void onMouseCaptureLost() override;
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
// Grr... the only thing I want as an LLMouseHandler are the onMouseCaptureLost and handleMouseUp calls. // Grr... the only thing I want as an LLMouseHandler are the onMouseCaptureLost and handleMouseUp calls.
// Sadly, these are all pure virtual, so I have to supply implementations here: // Sadly, these are all pure virtual, so I have to supply implementations here:
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override { return FALSE; };
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; }; /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override { return FALSE; };
/*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; }; /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override { return FALSE; };
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; }; /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override { return FALSE; };
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override { return FALSE; };
/*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) { return FALSE; }; /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) override { return FALSE; };
/*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { return FALSE; }; /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) override { return FALSE; };
/*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; }; /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) override { return FALSE; };
/*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return FALSE; }; /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) override {return FALSE; };
/*virtual*/ const std::string& getName() const; /*virtual*/ const std::string& getName() const override;
/*virtual*/ BOOL isView() const { return FALSE; }; /*virtual*/ BOOL isView() const override { return FALSE; };
/*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {}; /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const override {};
/*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {}; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const override {};
/*virtual*/ BOOL hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; }; /*virtual*/ BOOL hasMouseCapture() override { return gFocusMgr.getMouseCapture() == this; };
// Inherited from LLPluginClassMediaOwner // Inherited from LLPluginClassMediaOwner
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent); /*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent) override;
/*virtual*/ void handleCookieSet(LLPluginClassMedia* self, const std::string &cookie);
// LLEditMenuHandler overrides // LLEditMenuHandler overrides
/*virtual*/ void cut(); /*virtual*/ void undo() override;
/*virtual*/ BOOL canCut() const; /*virtual*/ BOOL canUndo() const override;
/*virtual*/ void copy(); /*virtual*/ void redo() override;
/*virtual*/ BOOL canCopy() const; /*virtual*/ BOOL canRedo() const override;
/*virtual*/ void paste(); /*virtual*/ void cut() override;
/*virtual*/ BOOL canPaste() const; /*virtual*/ BOOL canCut() const override;
/*virtual*/ void copy() override;
/*virtual*/ BOOL canCopy() const override;
/*virtual*/ void paste() override;
/*virtual*/ BOOL canPaste() const override;
/*virtual*/ void doDelete() override;
/*virtual*/ BOOL canDoDelete() const override;
/*virtual*/ void selectAll() override;
/*virtual*/ BOOL canSelectAll() const override;
void addObject(LLVOVolume* obj) ; void addObject(LLVOVolume* obj) ;
void removeObject(LLVOVolume* obj) ; void removeObject(LLVOVolume* obj) ;
@@ -466,6 +469,7 @@ private:
bool mNavigateServerRequest; bool mNavigateServerRequest;
bool mMediaSourceFailed; bool mMediaSourceFailed;
F32 mRequestedVolume; F32 mRequestedVolume;
F32 mPreviousVolume;
bool mIsMuted; bool mIsMuted;
bool mNeedsMuteCheck; bool mNeedsMuteCheck;
int mPreviousMediaState; int mPreviousMediaState;
@@ -475,7 +479,6 @@ private:
S32 mProximity; S32 mProximity;
F64 mProximityDistance; F64 mProximityDistance;
F64 mProximityCamera; F64 mProximityCamera;
LLMimeDiscoveryResponder *mMimeTypeProbe;
bool mMediaAutoPlay; bool mMediaAutoPlay;
std::string mMediaEntryURL; std::string mMediaEntryURL;
bool mInNearbyMediaList; // used by LLPanelNearbyMedia::refreshList() for performance reasons bool mInNearbyMediaList; // used by LLPanelNearbyMedia::refreshList() for performance reasons
@@ -486,11 +489,15 @@ private:
bool mTrustedBrowser; bool mTrustedBrowser;
std::string mTarget; std::string mTarget;
LLNotificationPtr mNotification; LLNotificationPtr mNotification;
bool mCleanBrowser; // force the creation of a clean browsing target with full options enabled
static std::vector<std::string> sMimeTypesFailed;
private: private:
BOOL mIsUpdated ; BOOL mIsUpdated ;
std::list< LLVOVolume* > mObjectList ; std::list< LLVOVolume* > mObjectList ;
LLMimeDiscoveryResponder* mMimeProbe;
private: private:
LLViewerMediaTexture *updatePlaceholderImage(); LLViewerMediaTexture *updatePlaceholderImage();
}; };

View File

@@ -162,7 +162,7 @@ LLPluginClassMedia* LLStreamingAudio_MediaPlugins::initializeMedia(const std::st
{ {
LLPluginClassMediaOwner* owner = NULL; LLPluginClassMediaOwner* owner = NULL;
S32 default_size = 1; // audio-only - be minimal, doesn't matter S32 default_size = 1; // audio-only - be minimal, doesn't matter
LLPluginClassMedia* media_source = LLViewerMediaImpl::newSourceFromMediaType(media_type, owner, default_size, default_size); LLPluginClassMedia* media_source = LLViewerMediaImpl::newSourceFromMediaType(media_type, owner, default_size, default_size, 1.0);
if (media_source) if (media_source)
{ {

View File

@@ -1586,6 +1586,19 @@ Unable to download file
<tag>fail</tag> <tag>fail</tag>
</notification> </notification>
<notification
name="MediaFileDownloadUnsupported"
label=""
type="alert">
<unique/>
<tag>confirm</tag>
You have requested a file download, which is not supported within [SECOND_LIFE].
<usetemplate
ignoretext="Warn about unsupported file downloads"
name="okignore"
yestext="OK"/>
</notification>
<notification <notification
icon="alertmodal.tga" icon="alertmodal.tga"
name="CannotWriteFile" name="CannotWriteFile"