Fixed web browser thanks to ArminW/Imprudence
This commit is contained in:
93
indra/llplugin/llpluginclassmedia.cpp
Normal file → Executable file
93
indra/llplugin/llpluginclassmedia.cpp
Normal file → Executable file
@@ -2,9 +2,10 @@
|
||||
* @file llpluginclassmedia.cpp
|
||||
* @brief LLPluginClassMedia handles a plugin which knows about the "media" message class.
|
||||
*
|
||||
* @cond
|
||||
* $LicenseInfo:firstyear=2008&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2008-2009, Linden Research, Inc.
|
||||
* Copyright (c) 2008-2010, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
@@ -12,13 +13,13 @@
|
||||
* ("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
|
||||
* online at http://secondlife.com/developers/opensource/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
* http://secondlife.com/developers/opensource/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
@@ -28,6 +29,8 @@
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
@@ -36,6 +39,8 @@
|
||||
#include "llpluginclassmedia.h"
|
||||
#include "llpluginmessageclasses.h"
|
||||
|
||||
#include "llqtwebkit.h"
|
||||
|
||||
static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256;
|
||||
|
||||
static int nextPowerOf2( int value )
|
||||
@@ -54,23 +59,31 @@ LLPluginClassMedia::LLPluginClassMedia(LLPluginClassMediaOwner *owner)
|
||||
mOwner = owner;
|
||||
mPlugin = NULL;
|
||||
reset();
|
||||
|
||||
//debug use
|
||||
mDeleteOK = true ;
|
||||
}
|
||||
|
||||
|
||||
LLPluginClassMedia::~LLPluginClassMedia()
|
||||
{
|
||||
llassert_always(mDeleteOK) ;
|
||||
reset();
|
||||
}
|
||||
|
||||
bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug, const std::string &user_data_path)
|
||||
bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug)
|
||||
{
|
||||
LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL;
|
||||
LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL;
|
||||
LL_DEBUGS("Plugin") << "user_data_path: " << user_data_path << LL_ENDL;
|
||||
|
||||
mPlugin = new LLPluginProcessParent(this);
|
||||
mPlugin->setSleepTime(mSleepTime);
|
||||
mPlugin->init(launcher_filename, plugin_filename, debug, user_data_path);
|
||||
|
||||
// Queue up the media init message -- it will be sent after all the currently queued messages.
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "init");
|
||||
sendMessage(message);
|
||||
|
||||
mPlugin->init(launcher_filename, plugin_filename, debug);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -101,6 +114,8 @@ void LLPluginClassMedia::reset()
|
||||
mSetMediaHeight = -1;
|
||||
mRequestedMediaWidth = 0;
|
||||
mRequestedMediaHeight = 0;
|
||||
mRequestedTextureWidth = 0;
|
||||
mRequestedTextureHeight = 0;
|
||||
mFullMediaWidth = 0;
|
||||
mFullMediaHeight = 0;
|
||||
mTextureWidth = 0;
|
||||
@@ -123,7 +138,8 @@ void LLPluginClassMedia::reset()
|
||||
mCanPaste = false;
|
||||
mMediaName.clear();
|
||||
mMediaDescription.clear();
|
||||
|
||||
mBackgroundColor = LLColor4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
// media_browser class
|
||||
mNavigateURI.clear();
|
||||
mNavigateResultCode = -1;
|
||||
@@ -132,6 +148,8 @@ void LLPluginClassMedia::reset()
|
||||
mHistoryForwardAvailable = false;
|
||||
mStatusText.clear();
|
||||
mProgressPercent = 0;
|
||||
mClickURL.clear();
|
||||
mClickTarget.clear();
|
||||
|
||||
// media_time class
|
||||
mCurrentTime = 0.0f;
|
||||
@@ -147,7 +165,7 @@ void LLPluginClassMedia::idle(void)
|
||||
mPlugin->idle();
|
||||
}
|
||||
|
||||
if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL))
|
||||
if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL) || (mPlugin->isBlocked()))
|
||||
{
|
||||
// Can't process a size change at this time
|
||||
}
|
||||
@@ -233,6 +251,10 @@ void LLPluginClassMedia::idle(void)
|
||||
message.setValueS32("height", mRequestedMediaHeight);
|
||||
message.setValueS32("texture_width", mRequestedTextureWidth);
|
||||
message.setValueS32("texture_height", mRequestedTextureHeight);
|
||||
message.setValueReal("background_r", mBackgroundColor.mV[VX]);
|
||||
message.setValueReal("background_g", mBackgroundColor.mV[VY]);
|
||||
message.setValueReal("background_b", mBackgroundColor.mV[VZ]);
|
||||
message.setValueReal("background_a", mBackgroundColor.mV[VW]);
|
||||
mPlugin->sendMessage(message); // DO NOT just use sendMessage() here -- we want this to jump ahead of the queue.
|
||||
|
||||
LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL;
|
||||
@@ -420,6 +442,12 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int
|
||||
{
|
||||
if(type == MOUSE_EVENT_MOVE)
|
||||
{
|
||||
if(!mPlugin || !mPlugin->isRunning() || mPlugin->isBlocked())
|
||||
{
|
||||
// Don't queue up mouse move events that can't be delivered.
|
||||
return;
|
||||
}
|
||||
|
||||
if((x == mLastMouseX) && (y == mLastMouseY))
|
||||
{
|
||||
// Don't spam unnecessary mouse move events.
|
||||
@@ -458,7 +486,7 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifiers)
|
||||
bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifiers, LLSD native_key_data)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
@@ -515,6 +543,7 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie
|
||||
message.setValueS32("key", key_code);
|
||||
|
||||
message.setValue("modifiers", translateModifiers(modifiers));
|
||||
message.setValueLLSD("native_key_data", native_key_data);
|
||||
|
||||
sendMessage(message);
|
||||
}
|
||||
@@ -533,12 +562,13 @@ void LLPluginClassMedia::scrollEvent(int x, int y, MASK modifiers)
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers)
|
||||
bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD native_key_data)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "text_event");
|
||||
|
||||
message.setValue("text", text);
|
||||
message.setValue("modifiers", translateModifiers(modifiers));
|
||||
message.setValueLLSD("native_key_data", native_key_data);
|
||||
|
||||
sendMessage(message);
|
||||
|
||||
@@ -663,6 +693,34 @@ void LLPluginClassMedia::paste()
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_user_data_path");
|
||||
message.setValue("path", user_data_path);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void LLPluginClassMedia::setLanguageCode(const std::string &language_code)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_language_code");
|
||||
message.setValue("language", language_code);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void LLPluginClassMedia::setPluginsEnabled(const bool enabled)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "plugins_enabled");
|
||||
message.setValueBoolean("enable", enabled);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void LLPluginClassMedia::setJavascriptEnabled(const bool enabled)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "javascript_enabled");
|
||||
message.setValueBoolean("enable", enabled);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
|
||||
{
|
||||
@@ -923,6 +981,13 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
|
||||
mClickTarget.clear();
|
||||
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW);
|
||||
}
|
||||
else if(message_name == "cookie_set")
|
||||
{
|
||||
if(mOwner)
|
||||
{
|
||||
mOwner->handleCookieSet(this, message.getValue("cookie"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
|
||||
@@ -1006,9 +1071,17 @@ void LLPluginClassMedia::clear_cookies()
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void LLPluginClassMedia::set_cookies(const std::string &cookies)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_cookies");
|
||||
message.setValue("cookies", cookies);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void LLPluginClassMedia::enable_cookies(bool enable)
|
||||
{
|
||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "enable_cookies");
|
||||
message.setValueBoolean("enable", enable);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user