summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorcallum_linden <none@none>2015-10-21 09:05:19 -0700
committercallum_linden <none@none>2015-10-21 09:05:19 -0700
commit8c74ed2a58f5443b931374489b04ba80fb11a590 (patch)
tree00fded78f1ecc33c82875f9e04e888cd6026cc33 /indra
parent0c3c3347c79e61a34dfebc01ca75100d2afb4073 (diff)
Fix windows line endings
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llplugin/llpluginclassmedia.cpp267
-rw-r--r--indra/media_plugins/cef/media_plugin_cef.cpp17
-rwxr-xr-xindra/newview/llviewermedia.cpp624
3 files changed, 453 insertions, 455 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index fd04fc4b62..c4b57aab1d 100755
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file llpluginclassmedia.cpp
* @brief LLPluginClassMedia handles a plugin which knows about the "media" message class.
*
@@ -6,21 +6,21 @@
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
* @endcond
@@ -41,7 +41,7 @@ static int nextPowerOf2( int value )
{
next_power_of_2 <<= 1;
}
-
+
return next_power_of_2;
}
@@ -63,19 +63,19 @@ LLPluginClassMedia::~LLPluginClassMedia()
}
bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_dir, const std::string &plugin_filename, bool debug)
-{
+{
LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL;
LL_DEBUGS("Plugin") << "dir: " << plugin_dir << LL_ENDL;
LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL;
-
+
mPlugin = new LLPluginProcessParent(this);
mPlugin->setSleepTime(mSleepTime);
-
+
// Queue up the media init message -- it will be sent after all the currently queued messages.
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "init");
message.setValue("target", mTarget);
sendMessage(message);
-
+
mPlugin->init(launcher_filename, plugin_dir, plugin_filename, debug);
return true;
@@ -115,7 +115,7 @@ void LLPluginClassMedia::reset()
mTextureHeight = 0;
mMediaWidth = 0;
mMediaHeight = 0;
- mDirtyRect = LLRect::null;
+ mDirtyRect = LLRect::null;
mAutoScaleMedia = false;
mRequestedVolume = 1.0f;
mPriority = PRIORITY_NORMAL;
@@ -132,7 +132,7 @@ void LLPluginClassMedia::reset()
mMediaName.clear();
mMediaDescription.clear();
mBackgroundColor = LLColor4(1.0f, 1.0f, 1.0f, 1.0f);
-
+
// media_browser class
mNavigateURI.clear();
mNavigateResultCode = -1;
@@ -140,15 +140,15 @@ void LLPluginClassMedia::reset()
mHistoryBackAvailable = false;
mHistoryForwardAvailable = false;
mStatusText.clear();
- mProgressPercent = 0;
+ mProgressPercent = 0;
mClickURL.clear();
mClickNavType.clear();
mClickTarget.clear();
mClickUUID.clear();
mStatusCode = 0;
-
+
mClickEnforceTarget = false;
-
+
// media_time class
mCurrentTime = 0.0f;
mDuration = 0.0f;
@@ -162,7 +162,7 @@ void LLPluginClassMedia::idle(void)
{
mPlugin->idle();
}
-
+
if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL) || (mPlugin->isBlocked()) || (mOwner == NULL))
{
// Can't process a size change at this time
@@ -179,7 +179,7 @@ void LLPluginClassMedia::idle(void)
else
{
mRequestedTextureWidth = mRequestedMediaWidth;
-
+
if(mPadding > 1)
{
// Pad up to a multiple of the specified number of bytes per row
@@ -189,7 +189,7 @@ void LLPluginClassMedia::idle(void)
{
rowbytes += mPadding - pad;
}
-
+
if(rowbytes % mRequestedTextureDepth == 0)
{
mRequestedTextureWidth = rowbytes / mRequestedTextureDepth;
@@ -201,7 +201,7 @@ void LLPluginClassMedia::idle(void)
}
}
-
+
// Size change has been requested but not initiated yet.
size_t newsize = mRequestedTextureWidth * mRequestedTextureHeight * mRequestedTextureDepth;
@@ -216,22 +216,22 @@ void LLPluginClassMedia::idle(void)
mPlugin->removeSharedMemory(mTextureSharedMemoryName);
mTextureSharedMemoryName.clear();
}
-
+
mTextureSharedMemorySize = newsize;
mTextureSharedMemoryName = mPlugin->addSharedMemory(mTextureSharedMemorySize);
if(!mTextureSharedMemoryName.empty())
{
void *addr = mPlugin->getSharedMemoryAddress(mTextureSharedMemoryName);
-
+
// clear texture memory to avoid random screen visual fuzz from uninitialized texture data
memset( addr, 0x00, newsize );
-
+
// We could do this to force an update, but textureValid() will still be returning false until the first roundtrip to the plugin,
// so it may not be worthwhile.
// mDirtyRect.setOriginAndSize(0, 0, mRequestedMediaWidth, mRequestedMediaHeight);
}
}
-
+
// This is our local indicator that a change is in progress.
mTextureWidth = -1;
mTextureHeight = -1;
@@ -240,7 +240,7 @@ void LLPluginClassMedia::idle(void)
// This invalidates any existing dirty rect.
resetDirty();
-
+
// Send a size change message to the plugin
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change");
@@ -254,11 +254,11 @@ void LLPluginClassMedia::idle(void)
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;
}
}
-
+
if(mPlugin && mPlugin->isRunning())
{
// Send queued messages
@@ -324,11 +324,11 @@ void LLPluginClassMedia::setSizeInternal(void)
mRequestedMediaWidth = mDefaultMediaWidth;
mRequestedMediaHeight = mDefaultMediaHeight;
}
-
+
// Save these for size/interest calculations
mFullMediaWidth = mRequestedMediaWidth;
mFullMediaHeight = mRequestedMediaHeight;
-
+
if(mAllowDownsample)
{
switch(mPriority)
@@ -342,19 +342,19 @@ void LLPluginClassMedia::setSizeInternal(void)
mRequestedMediaHeight /= 2;
}
break;
-
+
default:
// Don't adjust texture size
break;
}
}
-
+
if(mAutoScaleMedia)
{
mRequestedMediaWidth = nextPowerOf2(mRequestedMediaWidth);
mRequestedMediaHeight = nextPowerOf2(mRequestedMediaHeight);
}
-
+
if(mRequestedMediaWidth > 2048)
mRequestedMediaWidth = 2048;
@@ -382,9 +382,9 @@ bool LLPluginClassMedia::textureValid(void)
mRequestedMediaWidth != mMediaWidth ||
mRequestedMediaHeight != mMediaHeight ||
getBitsData() == NULL
- )
+ )
return false;
-
+
return true;
}
@@ -408,8 +408,8 @@ void LLPluginClassMedia::resetDirty(void)
std::string LLPluginClassMedia::translateModifiers(MASK modifiers)
{
std::string result;
-
-
+
+
if(modifiers & MASK_CONTROL)
{
result += "control|";
@@ -432,7 +432,7 @@ std::string LLPluginClassMedia::translateModifiers(MASK modifiers)
{
result += "meta|";
}
-*/
+*/
return result;
}
@@ -540,11 +540,11 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int
// Don't spam unnecessary mouse move events.
return;
}
-
+
mLastMouseX = x;
mLastMouseY = y;
}
-
+
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "mouse_event");
std::string temp;
switch(type)
@@ -559,7 +559,7 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int
message.setValueS32("button", button);
message.setValueS32("x", x);
-
+
// Incoming coordinates are OpenGL-style ((0,0) = lower left), so flip them here if the plugin has requested it.
if(!mRequestedTextureCoordsOpenGL)
{
@@ -569,42 +569,42 @@ void LLPluginClassMedia::mouseEvent(EMouseEventType type, int button, int x, int
message.setValueS32("y", y);
message.setValue("modifiers", translateModifiers(modifiers));
-
+
sendMessage(message);
}
bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifiers, LLSD native_key_data)
{
bool result = true;
-
+
// FIXME:
// HACK: we don't have an easy way to tell if the plugin is going to handle a particular keycode.
// For now, return false for the ones the webkit plugin won't handle properly.
-
+
switch(key_code)
{
- case KEY_BACKSPACE:
- case KEY_TAB:
- case KEY_RETURN:
- case KEY_PAD_RETURN:
- case KEY_SHIFT:
- case KEY_CONTROL:
- case KEY_ALT:
- case KEY_CAPSLOCK:
- case KEY_ESCAPE:
- case KEY_PAGE_UP:
- case KEY_PAGE_DOWN:
- case KEY_END:
- case KEY_HOME:
- case KEY_LEFT:
- case KEY_UP:
- case KEY_RIGHT:
- case KEY_DOWN:
- case KEY_INSERT:
+ case KEY_BACKSPACE:
+ case KEY_TAB:
+ case KEY_RETURN:
+ case KEY_PAD_RETURN:
+ case KEY_SHIFT:
+ case KEY_CONTROL:
+ case KEY_ALT:
+ case KEY_CAPSLOCK:
+ case KEY_ESCAPE:
+ case KEY_PAGE_UP:
+ case KEY_PAGE_DOWN:
+ case KEY_END:
+ case KEY_HOME:
+ case KEY_LEFT:
+ case KEY_UP:
+ case KEY_RIGHT:
+ case KEY_DOWN:
+ case KEY_INSERT:
case KEY_DELETE:
- // These will be handled
+ // These will be handled
break;
-
+
default:
// regular ASCII characters will also be handled
if(key_code >= KEY_SPECIAL)
@@ -615,7 +615,7 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie
break;
}
-#if LL_DARWIN
+#if LL_DARWIN
if(modifiers & MASK_ALT)
{
// Option-key modified characters should be handled by the unicode input path instead of this one.
@@ -634,15 +634,15 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie
case KEY_EVENT_REPEAT: temp = "repeat"; break;
}
message.setValue("event", temp);
-
+
message.setValueS32("key", key_code);
message.setValue("modifiers", translateModifiers(modifiers));
message.setValueLLSD("native_key_data", native_key_data);
-
+
sendMessage(message);
}
-
+
return result;
}
@@ -653,10 +653,10 @@ void LLPluginClassMedia::scrollEvent(int x, int y, MASK modifiers)
message.setValueS32("x", x);
message.setValueS32("y", y);
message.setValue("modifiers", translateModifiers(modifiers));
-
+
sendMessage(message);
}
-
+
bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD native_key_data)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "text_event");
@@ -664,31 +664,31 @@ bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD
message.setValue("text", text);
message.setValue("modifiers", translateModifiers(modifiers));
message.setValueLLSD("native_key_data", native_key_data);
-
+
sendMessage(message);
-
+
return true;
}
-void LLPluginClassMedia::setCookie(std::string uri, std::string name, std::string value, std::string domain, std::string path)
-{
- LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_cookie");
-
- message.setValue("uri", uri);
- message.setValue("name", name);
- message.setValue("value", value);
- message.setValue("domain", domain);
- message.setValue("path", path);
-
- sendMessage(message);
-}
+void LLPluginClassMedia::setCookie(std::string uri, std::string name, std::string value, std::string domain, std::string path)
+{
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_cookie");
+
+ message.setValue("uri", uri);
+ message.setValue("name", name);
+ message.setValue("value", value);
+ message.setValue("domain", domain);
+ message.setValue("path", path);
+
+ sendMessage(message);
+}
void LLPluginClassMedia::loadURI(const std::string &uri)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "load_uri");
message.setValue("uri", uri);
-
+
sendMessage(message);
}
@@ -705,7 +705,7 @@ const char* LLPluginClassMedia::priorityToString(EPriority priority)
case PRIORITY_NORMAL: result = "normal"; break;
case PRIORITY_HIGH: result = "high"; break;
}
-
+
return result;
}
@@ -716,44 +716,44 @@ void LLPluginClassMedia::setPriority(EPriority priority)
mPriority = priority;
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_priority");
-
+
std::string priority_string = priorityToString(priority);
switch(priority)
{
- case PRIORITY_UNLOADED:
+ case PRIORITY_UNLOADED:
mSleepTime = 1.0f;
break;
- case PRIORITY_STOPPED:
+ case PRIORITY_STOPPED:
mSleepTime = 1.0f;
break;
- case PRIORITY_HIDDEN:
+ case PRIORITY_HIDDEN:
mSleepTime = 1.0f;
break;
case PRIORITY_SLIDESHOW:
mSleepTime = 1.0f;
break;
- case PRIORITY_LOW:
+ case PRIORITY_LOW:
mSleepTime = 1.0f / 25.0f;
break;
- case PRIORITY_NORMAL:
+ case PRIORITY_NORMAL:
mSleepTime = 1.0f / 50.0f;
break;
- case PRIORITY_HIGH:
+ case PRIORITY_HIGH:
mSleepTime = 1.0f / 100.0f;
break;
}
-
+
message.setValue("priority", priority_string);
sendMessage(message);
-
+
if(mPlugin)
{
mPlugin->setSleepTime(mSleepTime);
}
-
+
LL_DEBUGS("PluginPriority") << this << ": setting priority to " << priority_string << LL_ENDL;
-
+
// This may affect the calculated size, so recalculate it here.
setSizeInternal();
}
@@ -774,12 +774,12 @@ void LLPluginClassMedia::setLowPrioritySizeLimit(int size)
F64 LLPluginClassMedia::getCPUUsage()
{
F64 result = 0.0f;
-
+
if(mPlugin)
{
result = mPlugin->getCPUUsage();
}
-
+
return result;
}
@@ -868,11 +868,11 @@ void LLPluginClassMedia::setTarget(const std::string &target)
mTarget = target;
}
-/* virtual */
+/* virtual */
void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
-
+
if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
{
std::string message_name = message.getName();
@@ -883,21 +883,21 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mRequestedTextureFormat = message.getValueU32("format");
mRequestedTextureType = message.getValueU32("type");
mRequestedTextureSwapBytes = message.getValueBoolean("swap_bytes");
- mRequestedTextureCoordsOpenGL = message.getValueBoolean("coords_opengl");
-
+ mRequestedTextureCoordsOpenGL = message.getValueBoolean("coords_opengl");
+
// These two are optional, and will default to 0 if they're not specified.
mDefaultMediaWidth = message.getValueS32("default_width");
mDefaultMediaHeight = message.getValueS32("default_height");
-
+
mAllowDownsample = message.getValueBoolean("allow_downsample");
mPadding = message.getValueS32("padding");
setSizeInternal();
-
+
mTextureParamsReceived = true;
}
else if(message_name == "updated")
- {
+ {
if(message.hasValue("left"))
{
LLRect newDirtyRect;
@@ -905,7 +905,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
newDirtyRect.mTop = message.getValueS32("top");
newDirtyRect.mRight = message.getValueS32("right");
newDirtyRect.mBottom = message.getValueS32("bottom");
-
+
// The plugin is likely to have top and bottom switched, due to vertical flip and OpenGL coordinate confusion.
// If they're backwards, swap them.
if(newDirtyRect.mTop < newDirtyRect.mBottom)
@@ -914,7 +914,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
newDirtyRect.mTop = newDirtyRect.mBottom;
newDirtyRect.mBottom = temp;
}
-
+
if(mDirtyRect.isEmpty())
{
mDirtyRect = newDirtyRect;
@@ -924,7 +924,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mDirtyRect.unionWith(newDirtyRect);
}
- LL_DEBUGS("Plugin") << "adjusted incoming rect is: ("
+ LL_DEBUGS("Plugin") << "adjusted incoming rect is: ("
<< newDirtyRect.mLeft << ", "
<< newDirtyRect.mTop << ", "
<< newDirtyRect.mRight << ", "
@@ -934,10 +934,10 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
<< mDirtyRect.mRight << ", "
<< mDirtyRect.mBottom << ")"
<< LL_ENDL;
-
+
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CONTENT_UPDATED);
- }
-
+ }
+
bool time_duration_updated = false;
int previous_percent = mProgressPercent;
@@ -957,7 +957,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
mCurrentRate = message.getValueReal("current_rate");
}
-
+
if(message.hasValue("loaded_duration"))
{
mLoadedDuration = message.getValueReal("loaded_duration");
@@ -968,7 +968,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
// If the message doesn't contain a loaded_duration param, assume it's equal to duration
mLoadedDuration = mDuration;
}
-
+
// Calculate a percentage based on the loaded duration and total duration.
if(mDuration != 0.0f) // Don't divide by zero.
{
@@ -979,7 +979,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_TIME_DURATION_UPDATED);
}
-
+
if(previous_percent != mProgressPercent)
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PROGRESS_UPDATED);
@@ -988,9 +988,9 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
else if(message_name == "media_status")
{
std::string status = message.getValue("status");
-
+
LL_DEBUGS("Plugin") << "Status changed to: " << status << LL_ENDL;
-
+
if(status == "loading")
{
mStatus = LLPluginClassMediaOwner::MEDIA_LOADING;
@@ -1030,24 +1030,24 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
// TODO: check that name matches?
mNaturalMediaWidth = width;
mNaturalMediaHeight = height;
-
+
setSizeInternal();
}
else if(message_name == "size_change_response")
{
std::string name = message.getValue("name");
-
+
// TODO: check that name matches?
-
+
mTextureWidth = message.getValueS32("texture_width");
mTextureHeight = message.getValueS32("texture_height");
mMediaWidth = message.getValueS32("width");
mMediaHeight = message.getValueS32("height");
-
+
// This invalidates any existing dirty rect.
resetDirty();
-
- // TODO: should we verify that the plugin sent back the right values?
+
+ // TODO: should we verify that the plugin sent back the right values?
// Two size changes in a row may cause them to not match, due to queueing, etc.
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_SIZE_CHANGED);
@@ -1114,7 +1114,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mNavigateResultString = message.getValue("result_string");
mHistoryBackAvailable = message.getValueBoolean("history_back_available");
mHistoryForwardAvailable = message.getValueBoolean("history_forward_available");
-
+
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE);
}
else if(message_name == "progress")
@@ -1169,7 +1169,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mGeometryY = message.getValueS32("y");
mGeometryWidth = message.getValueS32("width");
mGeometryHeight = message.getValueS32("height");
-
+
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_GEOMETRY_CHANGE);
}
else if(message_name == "link_hovered")
@@ -1178,7 +1178,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mHoverLink = message.getValue("link");
mHoverText = message.getValue("title");
// message.getValue("text");
-
+
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_LINK_HOVERED);
}
else
@@ -1194,7 +1194,7 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
// if(message_name == "message_name")
// {
// }
-// else
+// else
{
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
}
@@ -1202,13 +1202,13 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
}
-/* virtual */
+/* virtual */
void LLPluginClassMedia::pluginLaunchFailed()
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PLUGIN_FAILED_LAUNCH);
}
-/* virtual */
+/* virtual */
void LLPluginClassMedia::pluginDied()
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PLUGIN_FAILED);
@@ -1248,7 +1248,7 @@ void LLPluginClassMedia::focus(bool focused)
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "focus");
message.setValueBoolean("focused", focused);
-
+
sendMessage(message);
}
@@ -1275,7 +1275,7 @@ void LLPluginClassMedia::clear_cookies()
void LLPluginClassMedia::set_cookies(const std::string &cookies)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_cookies");
- message.setValue("cookies", cookies);
+ message.setValue("cookies", cookies);
sendMessage(message);
}
@@ -1308,7 +1308,7 @@ void LLPluginClassMedia::browse_reload(bool ignore_cache)
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "browse_reload");
message.setValueBoolean("ignore_cache", ignore_cache);
-
+
sendMessage(message);
}
@@ -1428,7 +1428,7 @@ void LLPluginClassMedia::seek(float time)
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME, "seek");
message.setValueReal("time", time);
-
+
sendMessage(message);
}
@@ -1446,11 +1446,11 @@ void LLPluginClassMedia::setVolume(float volume)
if(volume != mRequestedVolume)
{
mRequestedVolume = volume;
-
+
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME, "set_volume");
message.setValueReal("volume", volume);
-
+
sendMessage(message);
}
}
@@ -1469,4 +1469,3 @@ void LLPluginClassMedia::initializeUrlHistory(const LLSD& url_history)
LL_DEBUGS("Plugin") << "Sending history" << LL_ENDL;
}
-
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index 7f538e16d8..5b08807619 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -479,14 +479,14 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
std::string uri = message_in.getValue("uri");
mLLCEFLib->navigate(uri);
}
- else if (message_name == "set_cookie")
- {
- std::string uri = message_in.getValue("uri");
- std::string name = message_in.getValue("name");
- std::string value = message_in.getValue("value");
- std::string domain = message_in.getValue("domain");
- std::string path = message_in.getValue("path");
- mLLCEFLib->setCookie(uri, name, value, domain, path);
+ else if (message_name == "set_cookie")
+ {
+ std::string uri = message_in.getValue("uri");
+ std::string name = message_in.getValue("name");
+ std::string value = message_in.getValue("value");
+ std::string domain = message_in.getValue("domain");
+ std::string path = message_in.getValue("path");
+ mLLCEFLib->setCookie(uri, name, value, domain, path);
}
else if (message_name == "mouse_event")
{
@@ -814,4 +814,3 @@ int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func,
return 0;
}
-
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 1098b2a7e1..49d6c1021e 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -168,7 +168,7 @@ public:
{
LL_ERRS() << "impl already has an outstanding responder" << LL_ENDL;
}
-
+
mMediaImpl->mMimeTypeProbe = this;
}
@@ -190,19 +190,19 @@ private:
std::string mime_type = media_type.substr(0, idx1);
LL_DEBUGS() << "status is " << getStatus() << ", media type \"" << media_type << "\"" << LL_ENDL;
-
+
// 2xx status codes indicate success.
// Most 4xx status codes are successful enough for our purposes.
// 499 is the error code for host not found, timeout, etc.
- // 500 means "Internal Server error" but we decided it's okay to
+ // 500 means "Internal Server error" but we decided it's okay to
// accept this and go past it in the MIME type probe
// 302 means the resource can be found temporarily in a different place - added this for join.secondlife.com
// 499 is a code specifc to join.secondlife.com apparently safe to ignore
// if( ((status >= 200) && (status < 300)) ||
-// ((status >= 400) && (status < 499)) ||
+// ((status >= 400) && (status < 499)) ||
// (status == 500) ||
// (status == 302) ||
-// (status == 499)
+// (status == 499)
// )
// We now no longer check the error code returned from the probe.
// If we have a mime type, use it. If not, default to the web plugin and let it handle error reporting.
@@ -230,7 +230,7 @@ private:
// the call to initializeMedia may disconnect the responder, which will clear mMediaImpl.
// Make a local copy so we can call loadURI() afterwards.
LLViewerMediaImpl *impl = mMediaImpl;
-
+
if(impl && !mInitialized && ! mime_type.empty())
{
if(impl->initializeMedia(mime_type))
@@ -241,13 +241,13 @@ private:
}
}
}
-
+
public:
void cancelRequest()
{
disconnectOwner();
}
-
+
private:
void disconnectOwner()
{
@@ -262,8 +262,8 @@ private:
}
mMediaImpl = NULL;
}
-
-
+
+
public:
LLViewerMediaImpl *mMediaImpl;
bool mInitialized;
@@ -289,10 +289,10 @@ public:
llinfos << "@@@ URL to set cookie on" << url << llendl;
// We don't care about the content of the response, only the Set-Cookie header.
- llinfos << dumpResponse()
+ llinfos << dumpResponse()
<< " [headers:" << getResponseHeaders() << "]" << llendl;
const std::string& cookie = getResponseHeader(HTTP_IN_HEADER_SET_COOKIE);
-
+
// *TODO: What about bad status codes? Does this destroy previous cookies?
LLViewerMedia::openIDCookieResponse(url, cookie);
}
@@ -317,7 +317,7 @@ public:
const LLIOPipe::buffer_ptr_t& buffer)
{
// We don't care about the content of the response, only the set-cookie header.
- LL_WARNS("MediaAuth") << dumpResponse()
+ LL_WARNS("MediaAuth") << dumpResponse()
<< " [headers:" << getResponseHeaders() << "]" << LL_ENDL;
LLSD stripped_content = getResponseHeaders();
@@ -368,7 +368,7 @@ static void remove_media_impl(LLViewerMediaImpl* media)
{
LLViewerMedia::impl_list::iterator iter = sViewerMediaImplList.begin();
LLViewerMedia::impl_list::iterator end = sViewerMediaImplList.end();
-
+
for(; iter != end; iter++)
{
if(media == *iter)
@@ -395,8 +395,8 @@ static bool sViewerMediaMuteListObserverInitialized = false;
// static
viewer_media_t LLViewerMedia::newMediaImpl(
const LLUUID& texture_id,
- S32 media_width,
- S32 media_height,
+ S32 media_width,
+ S32 media_height,
U8 media_auto_scale,
U8 media_loop)
{
@@ -420,24 +420,24 @@ viewer_media_t LLViewerMedia::newMediaImpl(
}
viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const std::string& previous_url, bool update_from_self)
-{
+{
// Try to find media with the same media ID
viewer_media_t media_impl = getMediaImplFromTextureID(media_entry->getMediaID());
-
- LL_DEBUGS() << "called, current URL is \"" << media_entry->getCurrentURL()
- << "\", previous URL is \"" << previous_url
+
+ LL_DEBUGS() << "called, current URL is \"" << media_entry->getCurrentURL()
+ << "\", previous URL is \"" << previous_url
<< "\", update_from_self is " << (update_from_self?"true":"false")
<< LL_ENDL;
-
+
bool was_loaded = false;
bool needs_navigate = false;
-
+
if(media_impl)
- {
+ {
was_loaded = media_impl->hasMedia();
-
+
media_impl->setHomeURL(media_entry->getHomeURL());
-
+
media_impl->mMediaAutoScale = media_entry->getAutoScale();
media_impl->mMediaLoop = media_entry->getAutoLoop();
media_impl->mMediaWidth = media_entry->getWidthPixels();
@@ -450,7 +450,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
media_impl->mMediaSource->setLoop(media_impl->mMediaLoop);
media_impl->mMediaSource->setSize(media_entry->getWidthPixels(), media_entry->getHeightPixels());
}
-
+
bool url_changed = (media_impl->mMediaEntryURL != previous_url);
if(media_impl->mMediaEntryURL.empty())
{
@@ -458,7 +458,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
{
// The current media URL is now empty. Unload the media source.
media_impl->unload();
-
+
LL_DEBUGS() << "Unloading media instance (new current URL is empty)." << LL_ENDL;
}
}
@@ -467,26 +467,26 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
// The current media URL is not empty.
// If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent,
// do a navigate.
- bool auto_play = media_impl->isAutoPlayable();
+ bool auto_play = media_impl->isAutoPlayable();
if((was_loaded || auto_play) && !update_from_self)
{
needs_navigate = url_changed;
}
-
- LL_DEBUGS() << "was_loaded is " << (was_loaded?"true":"false")
- << ", auto_play is " << (auto_play?"true":"false")
+
+ LL_DEBUGS() << "was_loaded is " << (was_loaded?"true":"false")
+ << ", auto_play is " << (auto_play?"true":"false")
<< ", needs_navigate is " << (needs_navigate?"true":"false") << LL_ENDL;
}
}
else
{
media_impl = newMediaImpl(
- media_entry->getMediaID(),
+ media_entry->getMediaID(),
media_entry->getWidthPixels(),
- media_entry->getHeightPixels(),
- media_entry->getAutoScale(),
+ media_entry->getHeightPixels(),
+ media_entry->getAutoScale(),
media_entry->getAutoLoop());
-
+
media_impl->setHomeURL(media_entry->getHomeURL());
media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
media_impl->mMediaEntryURL = media_entry->getCurrentURL();
@@ -495,7 +495,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
needs_navigate = true;
}
}
-
+
if(media_impl)
{
if(needs_navigate)
@@ -514,7 +514,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
LL_DEBUGS() << "updating URL in the media impl to " << media_impl->mMediaEntryURL << LL_ENDL;
}
}
-
+
return media_impl;
}
@@ -523,7 +523,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& texture_id)
{
LLViewerMediaImpl* result = NULL;
-
+
// Look up the texture ID in the texture id->impl map.
impl_id_map::iterator iter = sViewerMediaTextureIDMap.find(texture_id);
if(iter != sViewerMediaTextureIDMap.end())
@@ -538,7 +538,7 @@ LLViewerMediaImpl* LLViewerMedia::getMediaImplFromTextureID(const LLUUID& textur
// static
std::string LLViewerMedia::getCurrentUserAgent()
{
- // Don't use user-visible string to avoid
+ // Don't use user-visible string to avoid
// punctuation and strange characters.
std::string skin_name = gSavedSettings.getString("SkinCurrent");
@@ -557,7 +557,7 @@ std::string LLViewerMedia::getCurrentUserAgent()
codec << LLVersionInfo::getVersion();
codec << " (" << channel << "; " << skin_name << " skin)";
LL_INFOS() << codec.str() << LL_ENDL;
-
+
return codec.str();
}
@@ -566,7 +566,7 @@ std::string LLViewerMedia::getCurrentUserAgent()
void LLViewerMedia::updateBrowserUserAgent()
{
std::string user_agent = getCurrentUserAgent();
-
+
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@@ -655,7 +655,7 @@ void LLViewerMedia::muteListChanged()
bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &object_interest)
{
bool result = false;
-
+
if (NULL == object)
{
result = false;
@@ -671,13 +671,13 @@ bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &obj
{
result = true;
}
- else
+ else
{
LL_DEBUGS() << "object interest = " << object_interest << ", lowest loadable = " << sLowestLoadableImplInterest << LL_ENDL;
if(object_interest >= sLowestLoadableImplInterest)
result = true;
}
-
+
return result;
}
@@ -784,13 +784,13 @@ static LLTrace::BlockTimerStatHandle FTM_MEDIA_MISC("Misc");
void LLViewerMedia::updateMedia(void *dummy_arg)
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE);
-
+
// Enable/disable the plugin read thread
LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread"));
-
+
// HACK: we always try to keep a spare running webkit plugin around to improve launch times.
createSpareBrowserMediaSource();
-
+
sAnyMediaShowing = false;
sUpdatedCookies = getCookieStore()->getChangedCookies();
if(!sUpdatedCookies.empty())
@@ -798,7 +798,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
LL_DEBUGS() << "updated cookies will be sent to all loaded plugins: " << LL_ENDL;
LL_DEBUGS() << sUpdatedCookies << LL_ENDL;
}
-
+
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@@ -811,14 +811,14 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
pimpl->calculateInterest();
}
}
-
+
// Let the spare media source actually launch
if(sSpareBrowserMediaSource)
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_SPARE_IDLE);
sSpareBrowserMediaSource->idle();
}
-
+
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT);
// Sort the static instance list using our interest criteria
@@ -828,14 +828,14 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
// Go through the list again and adjust according to priority.
iter = sViewerMediaImplList.begin();
end = sViewerMediaImplList.end();
-
+
F64 total_cpu = 0.0f;
int impl_count_total = 0;
int impl_count_interest_low = 0;
int impl_count_interest_normal = 0;
-
+
std::vector<LLViewerMediaImpl*> proximity_order;
-
+
bool inworld_media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
bool inworld_audio_enabled = gSavedSettings.getBOOL("AudioStreamingMusic");
U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal");
@@ -844,19 +844,19 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
F32 max_cpu = gSavedSettings.getF32("PluginInstancesCPULimit");
// Setting max_cpu to 0.0 disables CPU usage checking.
bool check_cpu_usage = (max_cpu != 0.0f);
-
+
LLViewerMediaImpl* lowest_interest_loadable = NULL;
-
+
// Notes on tweakable params:
// max_instances must be set high enough to allow the various instances used in the UI (for the help browser, search, etc.) to be loaded.
// If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow.
-
+
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_MISC);
for(; iter != end; iter++)
{
LLViewerMediaImpl* pimpl = *iter;
-
+
LLPluginClassMedia::EPriority new_priority = LLPluginClassMedia::PRIORITY_NORMAL;
if(pimpl->isForcedUnloaded() || (impl_count_total >= (int)max_instances))
@@ -887,7 +887,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
else
{
// Look at interest and CPU usage for instances that aren't in any of the above states.
-
+
// Heuristic -- if the media texture's approximate screen area is less than 1/4 of the native area of the texture,
// turn it down to low instead of normal. This may downsample for plugins that support it.
bool media_is_small = false;
@@ -901,7 +901,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
{
media_is_small = true;
}
-
+
if(pimpl->getInterest() == 0.0f)
{
// This media is completely invisible, due to being outside the view frustrum or out of range.
@@ -923,11 +923,11 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
// The next max_low inworld get turned down
new_priority = LLPluginClassMedia::PRIORITY_LOW;
impl_count_interest_low++;
-
+
// Set the low priority size for downsampling to approximately the size the texture is displayed at.
{
F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest());
-
+
pimpl->setLowPrioritySizeLimit(ll_round(approximate_interest_dimension));
}
}
@@ -937,18 +937,18 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
new_priority = LLPluginClassMedia::PRIORITY_SLIDESHOW;
}
}
-
+
if(!pimpl->getUsedInUI() && (new_priority != LLPluginClassMedia::PRIORITY_UNLOADED))
{
// This is a loadable inworld impl -- the last one in the list in this class defines the lowest loadable interest.
lowest_interest_loadable = pimpl;
-
+
impl_count_total++;
}
// Overrides if the window is minimized or we lost focus (taking care
// not to accidentally "raise" the priority either)
- if (!gViewerWindow->getActive() /* viewer window minimized? */
+ if (!gViewerWindow->getActive() /* viewer window minimized? */
&& new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
{
new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
@@ -958,7 +958,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
{
new_priority = LLPluginClassMedia::PRIORITY_LOW;
}
-
+
if(!inworld_media_enabled)
{
// If inworld media is locked out, force all inworld media to stay unloaded.
@@ -976,7 +976,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
}
pimpl->setPriority(new_priority);
-
+
if(pimpl->getUsedInUI())
{
// Any impls used in the UI should not be in the proximity list.
@@ -988,7 +988,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
total_cpu += pimpl->getCPUUsage();
-
+
if (!pimpl->getUsedInUI() && pimpl->hasMedia())
{
sAnyMediaShowing = true;
@@ -1012,7 +1012,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
sLowestLoadableImplInterest = object->getPixelArea();
}
}
-
+
if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug"))
{
// Give impls the same ordering as the priority list
@@ -1021,7 +1021,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
else
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT2);
- // Use a distance-based sort for proximity values.
+ // Use a distance-based sort for proximity values.
std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor);
}
@@ -1030,7 +1030,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
{
proximity_order[i]->mProximity = i;
}
-
+
LL_DEBUGS("PluginPriority") << "Total reported CPU usage is " << total_cpu << LL_ENDL;
}
@@ -1049,11 +1049,11 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
// Set "tentative" autoplay first. We need to do this here or else
// re-enabling won't start up the media below.
gSavedSettings.setBOOL("MediaTentativeAutoPlay", val);
-
- // Then
+
+ // Then
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
-
+
for(; iter != end; iter++)
{
LLViewerMediaImpl* pimpl = *iter;
@@ -1062,18 +1062,18 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
pimpl->setDisabled(!val);
}
}
-
+
// Also do Parcel Media and Parcel Audio
if (val)
{
if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia())
- {
+ {
LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel());
}
-
+
if (gSavedSettings.getBOOL("AudioStreamingMusic") &&
!LLViewerMedia::isParcelAudioPlaying() &&
- gAudiop &&
+ gAudiop &&
LLViewerMedia::hasParcelAudio())
{
if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying())
@@ -1146,26 +1146,26 @@ void LLViewerMedia::clearAllCookies()
pimpl->mMediaSource->clear_cookies();
}
}
-
+
// Clear all cookies from the cookie store
getCookieStore()->setAllCookies("");
// FIXME: this may not be sufficient, since the on-disk cookie file won't get written until some browser instance exits cleanly.
// It also won't clear cookies for other accounts, or for any account if we're not logged in, and won't do anything at all if there are no webkit plugins loaded.
// Until such time as we can centralize cookie storage, the following hack should cover these cases:
-
+
// HACK: Look for cookie files in all possible places and delete them.
// NOTE: this assumes knowledge of what happens inside the webkit plugin (it's what adds 'browser_profile' to the path and names the cookie file)
-
+
// Places that cookie files can be:
// <getOSUserAppDir>/browser_profile/cookies
// <getOSUserAppDir>/first_last/browser_profile/cookies (note that there may be any number of these!)
// <getOSUserAppDir>/first_last/plugin_cookies.txt (note that there may be any number of these!)
-
+
std::string base_dir = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter();
std::string target;
std::string filename;
-
+
LL_DEBUGS() << "base dir = " << base_dir << LL_ENDL;
// The non-logged-in version is easy
@@ -1178,7 +1178,7 @@ void LLViewerMedia::clearAllCookies()
{
LLFile::remove(target);
}
-
+
// the hard part: iterate over all user directories and delete the cookie file from each one
LLDirIterator dir_iter(base_dir, "*_*");
while (dir_iter.next(filename))
@@ -1188,26 +1188,26 @@ void LLViewerMedia::clearAllCookies()
gDirUtilp->append(target, "cookies");
LL_DEBUGS() << "target = " << target << LL_ENDL;
if(LLFile::isfile(target))
- {
+ {
LLFile::remove(target);
}
-
+
// Other accounts may have new-style cookie files too -- delete them as well
target = gDirUtilp->add(base_dir, filename);
gDirUtilp->append(target, PLUGIN_COOKIE_FILE_NAME);
LL_DEBUGS() << "target = " << target << LL_ENDL;
if(LLFile::isfile(target))
- {
+ {
LLFile::remove(target);
}
}
-
+
// If we have an OpenID cookie, re-add it to the cookie store.
setOpenIDCookie(std::string());
}
-
+
/////////////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLViewerMedia::clearAllCaches()
{
// Clear all plugins' caches
@@ -1219,9 +1219,9 @@ void LLViewerMedia::clearAllCaches()
pimpl->clearCache();
}
}
-
+
/////////////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLViewerMedia::setCookiesEnabled(bool enabled)
{
// Set the "cookies enabled" flag for all loaded plugins
@@ -1236,9 +1236,9 @@ void LLViewerMedia::setCookiesEnabled(bool enabled)
}
}
}
-
+
/////////////////////////////////////////////////////////////////////////////////////////
-// static
+// static
void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int port)
{
// Set the proxy config for all loaded plugins
@@ -1255,7 +1255,7 @@ void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int por
}
/////////////////////////////////////////////////////////////////////////////////////////
-// static
+// static
/////////////////////////////////////////////////////////////////////////////////////////
// static
LLPluginCookieStore *LLViewerMedia::getCookieStore()
@@ -1264,7 +1264,7 @@ LLPluginCookieStore *LLViewerMedia::getCookieStore()
{
sCookieStore = new LLPluginCookieStore;
}
-
+
return sCookieStore;
}
@@ -1280,7 +1280,7 @@ void LLViewerMedia::loadCookieFile()
LL_INFOS() << "can't get path to plugin cookie file - probably not logged in yet." << LL_ENDL;
return;
}
-
+
// open the file for reading
llifstream file(resolved_filename.c_str());
if (!file.is_open())
@@ -1288,11 +1288,11 @@ void LLViewerMedia::loadCookieFile()
LL_WARNS() << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << LL_ENDL;
return;
}
-
+
getCookieStore()->readAllCookies(file, true);
file.close();
-
+
// send the clear_cookies message to all loaded plugins
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@@ -1304,7 +1304,7 @@ void LLViewerMedia::loadCookieFile()
pimpl->mMediaSource->clear_cookies();
}
}
-
+
// If we have an OpenID cookie, re-add it to the cookie store.
setOpenIDCookie(std::string());
}
@@ -1341,23 +1341,23 @@ void LLViewerMedia::saveCookieFile()
void LLViewerMedia::addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path, bool secure)
{
std::stringstream cookie;
-
+
cookie << name << "=" << LLPluginCookieStore::quoteString(value);
-
+
if(expires.notNull())
{
cookie << "; expires=" << expires.asRFC1123();
}
-
+
cookie << "; domain=" << domain;
cookie << "; path=" << path;
-
+
if(secure)
{
cookie << "; secure";
}
-
+
getCookieStore()->setCookies(cookie.str());
}
@@ -1374,7 +1374,7 @@ void LLViewerMedia::addSessionCookie(const std::string &name, const std::string
void LLViewerMedia::removeCookie(const std::string &name, const std::string &domain, const std::string &path )
{
// To remove a cookie, add one with the same name, domain, and path that expires in the past.
-
+
addCookie(name, "", domain, LLDate(LLDate::now().secondsSinceEpoch() - 1.0), path);
}
@@ -1392,26 +1392,26 @@ LLSD LLViewerMedia::getHeaders()
return headers;
}
- /////////////////////////////////////////////////////////////////////////////////////////
- // static
-bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path)
-{
- std::size_t name_pos = raw_cookie.find_first_of("=");
- if (name_pos != std::string::npos)
- {
- name = raw_cookie.substr(0, name_pos);
- std::size_t value_pos = raw_cookie.find_first_of(";", name_pos);
- if (value_pos != std::string::npos)
- {
- value = raw_cookie.substr(name_pos + 1, value_pos - name_pos - 1);
- path = "/"; // assume root path for now
-
- return true;
- }
- }
-
- return false;
-}
+ /////////////////////////////////////////////////////////////////////////////////////////
+ // static
+bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path)
+{
+ std::size_t name_pos = raw_cookie.find_first_of("=");
+ if (name_pos != std::string::npos)
+ {
+ name = raw_cookie.substr(0, name_pos);
+ std::size_t value_pos = raw_cookie.find_first_of(";", name_pos);
+ if (value_pos != std::string::npos)
+ {
+ value = raw_cookie.substr(name_pos + 1, value_pos - name_pos - 1);
+ path = "/"; // assume root path for now
+
+ return true;
+ }
+ }
+
+ return false;
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1424,7 +1424,7 @@ void LLViewerMedia::setOpenIDCookie(const std::string& url)
// We want just the hostname for the cookie code, but LLURL doesn't seem to have a way to extract that.
// We therefore do it here.
std::string authority = sOpenIDURL.mAuthority;
- std::string::size_type host_start = authority.find('@');
+ std::string::size_type host_start = authority.find('@');
if(host_start == std::string::npos)
{
// no username/password
@@ -1432,40 +1432,40 @@ void LLViewerMedia::setOpenIDCookie(const std::string& url)
}
else
{
- // Hostname starts after the @.
+ // Hostname starts after the @.
// (If the hostname part is empty, this may put host_start at the end of the string. In that case, it will end up passing through an empty hostname, which is correct.)
++host_start;
}
- std::string::size_type host_end = authority.rfind(':');
+ std::string::size_type host_end = authority.rfind(':');
if((host_end == std::string::npos) || (host_end < host_start))
{
// no port
host_end = authority.size();
}
-
+
getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(host_start, host_end - host_start));
if (url.length())
{
- LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
- if (media_instance)
- {
- std::string cookie_host = authority.substr(host_start, host_end - host_start);
- std::string cookie_name = "";
- std::string cookie_value = "";
- std::string cookie_path = "";
- if (parseRawCookie(sOpenIDCookie, cookie_name, cookie_value, cookie_path))
- {
- media_instance->getMediaPlugin()->setCookie(url, cookie_name, cookie_value, cookie_host, cookie_path);
- }
- }
- }
-
- // NOTE: this is the original OpenID cookie code, so of which is no longer needed now that we
- // are using CEF - it's very intertwined with other code so, for the moment, I'm going to
- // leave it alone and make a task to come back to it once we're sure the CEF cookie code is robust.
-
- // Do a web profile get so we can store the cookie
+ LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
+ if (media_instance)
+ {
+ std::string cookie_host = authority.substr(host_start, host_end - host_start);
+ std::string cookie_name = "";
+ std::string cookie_value = "";
+ std::string cookie_path = "";
+ if (parseRawCookie(sOpenIDCookie, cookie_name, cookie_value, cookie_path))
+ {
+ media_instance->getMediaPlugin()->setCookie(url, cookie_name, cookie_value, cookie_host, cookie_path);
+ }
+ }
+ }
+
+ // NOTE: this is the original OpenID cookie code, so of which is no longer needed now that we
+ // are using CEF - it's very intertwined with other code so, for the moment, I'm going to
+ // leave it alone and make a task to come back to it once we're sure the CEF cookie code is robust.
+
+ // Do a web profile get so we can store the cookie
LLSD headers = LLSD::emptyMap();
headers[HTTP_OUT_HEADER_ACCEPT] = "*/*";
headers[HTTP_OUT_HEADER_COOKIE] = sOpenIDCookie;
@@ -1476,7 +1476,7 @@ void LLViewerMedia::setOpenIDCookie(const std::string& url)
LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << LL_ENDL;
LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL;
- LLHTTPClient::get(profile_url,
+ LLHTTPClient::get(profile_url,
new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()),
headers);
}
@@ -1488,12 +1488,12 @@ void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string
{
LL_DEBUGS("MediaAuth") << "url = \"" << openid_url << "\", token = \"" << openid_token << "\"" << LL_ENDL;
- // post the token to the url
+ // post the token to the url
// the responder will need to extract the cookie(s).
// Save the OpenID URL for later -- we may need the host when adding the cookie.
sOpenIDURL.init(openid_url.c_str());
-
+
// We shouldn't ever do this twice, but just in case this code gets repurposed later, clear existing cookies.
sOpenIDCookie.clear();
@@ -1508,13 +1508,13 @@ void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string
U8 *data = new U8[size];
memcpy(data, openid_token.data(), size);
- LLHTTPClient::postRaw(
- openid_url,
- data,
- size,
+ LLHTTPClient::postRaw(
+ openid_url,
+ data,
+ size,
new LLViewerMediaOpenIDResponder(),
headers);
-
+
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1522,7 +1522,7 @@ void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string
void LLViewerMedia::openIDCookieResponse(const std::string& url, const std::string &cookie)
{
LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL;
-
+
sOpenIDCookie += cookie;
setOpenIDCookie(url);
@@ -1534,7 +1534,7 @@ void LLViewerMedia::proxyWindowOpened(const std::string &target, const std::stri
{
if(uuid.empty())
return;
-
+
for (impl_list::iterator iter = sViewerMediaImplList.begin(); iter != sViewerMediaImplList.end(); iter++)
{
if((*iter)->mMediaSource && (*iter)->mMediaSource->pluginSupportsMediaBrowser())
@@ -1571,7 +1571,7 @@ void LLViewerMedia::createSpareBrowserMediaSource()
if (!sSpareBrowserMediaSource && !gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))
{
// The null owner will keep the browser plugin from fully initializing
- // (specifically, it keeps LLPluginClassMedia from negotiating a size change,
+ // (specifically, it keeps LLPluginClassMedia from negotiating a size change,
// which keeps MediaPluginWebkit::initBrowserWindow from doing anything until we have some necessary data, like the background color)
sSpareBrowserMediaSource = LLViewerMediaImpl::newSourceFromMediaType(HTTP_CONTENT_TEXT_HTML, NULL, 0, 0);
}
@@ -1583,7 +1583,7 @@ LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource()
{
LLPluginClassMedia* result = sSpareBrowserMediaSource;
sSpareBrowserMediaSource = NULL;
- return result;
+ return result;
};
bool LLViewerMedia::hasInWorldMedia()
@@ -1672,12 +1672,12 @@ void LLViewerMedia::setOnlyAudibleMediaTextureID(const LLUUID& texture_id)
//////////////////////////////////////////////////////////////////////////////////////////
// LLViewerMediaImpl
//////////////////////////////////////////////////////////////////////////////////////////
-LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
- S32 media_width,
- S32 media_height,
- U8 media_auto_scale,
+LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
+ S32 media_width,
+ S32 media_height,
+ U8 media_auto_scale,
U8 media_loop)
-:
+:
mMediaSource( NULL ),
mMovieImageHasMips(false),
mMediaWidth(media_width),
@@ -1718,7 +1718,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
mTrustedBrowser(false),
mZoomFactor(1.0),
mCleanBrowser(false)
-{
+{
// Set up the mute list observer if it hasn't been set up already.
if(!sViewerMediaMuteListObserverInitialized)
@@ -1726,11 +1726,11 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
LLMuteList::getInstance()->addObserver(&sViewerMediaMuteListObserver);
sViewerMediaMuteListObserverInitialized = true;
}
-
+
add_media_impl(this);
setTextureID(texture_id);
-
+
// connect this media_impl to the media texture, creating it if it doesn't exist.0
// This is necessary because we need to be able to use getMaxVirtualSize() even if the media plugin is not loaded.
LLViewerMediaTexture* media_tex = LLViewerTextureManager::getMediaTexture(mTextureId);
@@ -1745,7 +1745,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
LLViewerMediaImpl::~LLViewerMediaImpl()
{
destroyMediaSource();
-
+
LLViewerMediaTexture::removeMediaImplFromTexture(mTextureId) ;
setTextureID();
@@ -1757,7 +1757,7 @@ void LLViewerMediaImpl::emitEvent(LLPluginClassMedia* plugin, LLViewerMediaObser
{
// Broadcast to observers using the superclass version
LLViewerMediaEventEmitter::emitEvent(plugin, event);
-
+
// If this media is on one or more LLVOVolume objects, tell them about the event as well.
std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
while(iter != mObjectList.end())
@@ -1773,7 +1773,7 @@ bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type)
{
bool mimeTypeChanged = (mMimeType != mime_type);
bool pluginChanged = (LLMIMETypes::implType(mCurrentMimeType) != LLMIMETypes::implType(mime_type));
-
+
if(!mMediaSource || pluginChanged)
{
// We don't have a plugin at all, or the new mime type is handled by a different plugin than the old mime type.
@@ -1796,7 +1796,7 @@ void LLViewerMediaImpl::createMediaSource()
// This media shouldn't be created yet.
return;
}
-
+
if(! mMediaURL.empty())
{
navigateInternal();
@@ -1822,15 +1822,15 @@ void LLViewerMediaImpl::destroyMediaSource()
{
oldImage->setPlaying(FALSE) ;
}
-
+
cancelMimeTypeProbe();
-
+
if(mMediaSource)
{
mMediaSource->setDeleteOK(true) ;
delete mMediaSource;
mMediaSource = NULL;
- }
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -1845,7 +1845,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
{
std::string plugin_basename = LLMIMETypes::implType(media_type);
LLPluginClassMedia* media_source = NULL;
-
+
// HACK: we always try to keep a spare running webkit plugin around to improve launch times.
// If a spare was already created before PluginAttachDebuggerToPlugins was set, don't use it.
// Do not use a spare if launching with full viewer control (e.g. Facebook, Twitter and few others)
@@ -1858,7 +1858,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
media_source->setOwner(owner);
media_source->setTarget(target);
media_source->setSize(default_width, default_height);
-
+
return media_source;
}
}
@@ -1914,7 +1914,7 @@ 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 || clean_browser);
-
+
bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || clean_browser);
@@ -1922,7 +1922,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent());
media_source->setTarget(target);
-
+
const std::string plugin_dir = gDirUtilp->getLLPluginDir();
if (media_source->init(launcher_name, plugin_dir, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
{
@@ -1935,14 +1935,14 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
}
}
}
-
+
LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
LLSD args;
args["MIME_TYPE"] = media_type;
LLNotificationsUtil::add("NoPlugin", args);
return NULL;
-}
+}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
@@ -1953,10 +1953,10 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
mMediaWidth = mMediaSource->getSetWidth();
mMediaHeight = mMediaSource->getSetHeight();
}
-
+
// Always delete the old media impl first.
destroyMediaSource();
-
+
// and unconditionally set the mime type
mMimeType = media_type;
@@ -1964,7 +1964,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
{
// This impl should not be loaded at this time.
LL_DEBUGS("PluginPriority") << this << "Not loading (PRIORITY_UNLOADED)" << LL_ENDL;
-
+
return false;
}
@@ -1975,7 +1975,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
mCurrentMimeType = mMimeType;
LLPluginClassMedia* media_source = newSourceFromMediaType(mMimeType, this, mMediaWidth, mMediaHeight, mTarget, mCleanBrowser);
-
+
if (media_source)
{
media_source->setDisableTimeout(gSavedSettings.getBOOL("DebugPluginDisableTimeout"));
@@ -1984,7 +1984,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent());
media_source->focus(mHasFocus);
media_source->setBackgroundColor(mBackgroundColor);
-
+
if(gSavedSettings.getBOOL("BrowserIgnoreSSLCertErrors"))
{
media_source->ignore_ssl_cert_errors(true);
@@ -1992,19 +1992,19 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
// the correct way to deal with certs it to load ours from CA.pem and append them to the ones
// Qt/WebKit loads from your system location.
- // Note: This needs the new CA.pem file with the Equifax Secure Certificate Authority
+ // Note: This needs the new CA.pem file with the Equifax Secure Certificate Authority
// cert at the bottom: (MIIDIDCCAomgAwIBAgIENd70zzANBg)
std::string ca_path = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "CA.pem" );
media_source->addCertificateFilePath( ca_path );
media_source->proxy_setup(gSavedSettings.getBOOL("BrowserProxyEnabled"), gSavedSettings.getString("BrowserProxyAddress"), gSavedSettings.getS32("BrowserProxyPort"));
-
+
if(mClearCache)
{
mClearCache = false;
media_source->clear_cache();
}
-
+
// TODO: Only send cookies to plugins that need them
// Ideally, the plugin should tell us whether it handles cookies or not -- either via the init response or through a separate message.
// Due to the ordering of messages, it's possible we wouldn't get that information back in time to send cookies before sending a navigate message,
@@ -2015,7 +2015,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
{
media_source->set_cookies(all_cookies);
}
-
+
mMediaSource = media_source;
mMediaSource->setDeleteOK(false) ;
updateVolume();
@@ -2058,16 +2058,16 @@ void LLViewerMediaImpl::loadURI()
std::string sanitized_uri = (u.query().empty() ? uri : u.scheme() + "://" + u.authority() + u.path());
LL_INFOS() << "Asking media source to load URI: " << sanitized_uri << LL_ENDL;
}
-
+
mMediaSource->loadURI( uri );
-
- // A non-zero mPreviousMediaTime means that either this media was previously unloaded by the priority code while playing/paused,
+
+ // A non-zero mPreviousMediaTime means that either this media was previously unloaded by the priority code while playing/paused,
// or a seek happened before the media loaded. In either case, seek to the saved time.
if(mPreviousMediaTime != 0.0f)
{
seek(mPreviousMediaTime);
}
-
+
if(mPreviousMediaState == MEDIA_PLAYING)
{
// This media was playing before this instance was unloaded.
@@ -2120,11 +2120,11 @@ void LLViewerMediaImpl::play()
// This may be the case where the plugin's priority is PRIORITY_UNLOADED
return;
}
-
+
// Only do this if the media source was just loaded.
loadURI();
}
-
+
// always start the media
start();
}
@@ -2225,10 +2225,10 @@ void LLViewerMediaImpl::updateVolume()
{
if(mMediaSource)
{
- // always scale the volume by the global media volume
+ // always scale the volume by the global media volume
F32 volume = mRequestedVolume * LLViewerMedia::getVolume();
- if (mProximityCamera > 0)
+ if (mProximityCamera > 0)
{
if (mProximityCamera > gSavedSettings.getF32("MediaRollOffMax"))
{
@@ -2267,7 +2267,7 @@ F32 LLViewerMediaImpl::getVolume()
void LLViewerMediaImpl::focus(bool focus)
{
mHasFocus = focus;
-
+
if (mMediaSource)
{
// call focus just for the hell of it, even though this apopears to be a nop
@@ -2295,7 +2295,7 @@ std::string LLViewerMediaImpl::getCurrentMediaURL()
{
return mCurrentMediaURL;
}
-
+
return mMediaURL;
}
@@ -2363,17 +2363,17 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask)
}
//////////////////////////////////////////////////////////////////////////////////////////
-//static
+//static
void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y)
{
F32 texture_x = texture_coords.mV[VX];
F32 texture_y = texture_coords.mV[VY];
-
+
// Deal with repeating textures by wrapping the coordinates into the range [0, 1.0)
texture_x = fmodf(texture_x, 1.0f);
if(texture_x < 0.0f)
texture_x = 1.0 + texture_x;
-
+
texture_y = fmodf(texture_y, 1.0f);
if(texture_y < 0.0f)
texture_y = 1.0 + texture_y;
@@ -2401,7 +2401,7 @@ void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S3
void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32 button)
{
if(mMediaSource)
- {
+ {
S32 x, y;
scaleTextureCoords(texture_coords, &x, &y);
@@ -2412,7 +2412,7 @@ void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32
void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask)
{
if(mMediaSource)
- {
+ {
S32 x, y;
scaleTextureCoords(texture_coords, &x, &y);
@@ -2454,18 +2454,18 @@ void LLViewerMediaImpl::onMouseCaptureLost()
}
//////////////////////////////////////////////////////////////////////////////////////////
-BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask)
-{
+BOOL LLViewerMediaImpl::handleMouseUp(S32 x, S32 y, MASK mask)
+{
// NOTE: this is called when the mouse is released when we have capture.
// Due to the way mouse coordinates are mapped to the object, we can't use the x and y coordinates that come in with the event.
-
+
if(hasMouseCapture())
{
// Release the mouse -- this will also send a mouseup to the media
gFocusMgr.setMouseCapture( FALSE );
}
- return TRUE;
+ return TRUE;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -2541,14 +2541,14 @@ void LLViewerMediaImpl::updateJavascriptObject()
}
//////////////////////////////////////////////////////////////////////////////////////////
-const std::string& LLViewerMediaImpl::getName() const
-{
+const std::string& LLViewerMediaImpl::getName() const
+{
if (mMediaSource)
{
return mMediaSource->getMediaName();
}
-
- return LLStringUtil::null;
+
+ return LLStringUtil::null;
};
//////////////////////////////////////////////////////////////////////////////////////////
@@ -2604,21 +2604,21 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi
// Don't carry media play state across distinct URLs.
resetPreviousMediaState();
}
-
+
// Always set the current URL and MIME type.
mMediaURL = url;
mMimeType = mime_type;
mCleanBrowser = clean_browser;
-
+
// Clear the current media URL, since it will no longer be correct.
mCurrentMediaURL.clear();
-
+
// if mime type discovery was requested, we'll need to do it when the media loads
mNavigateRediscoverType = rediscover_type;
-
+
// and if this was a server request, the navigate on load will also need to be one.
mNavigateServerRequest = server_request;
-
+
// An explicit navigate resets the "failed" flag.
mMediaSourceFailed = false;
@@ -2634,7 +2634,7 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi
// This impl should not be loaded at this time.
LL_DEBUGS("PluginPriority") << this << "Not loading (PRIORITY_UNLOADED)" << LL_ENDL;
-
+
return;
}
@@ -2658,13 +2658,13 @@ void LLViewerMediaImpl::navigateInternal()
mNavigateSuspendedDeferred = true;
return;
}
-
+
if(mMimeTypeProbe != NULL)
{
LL_WARNS() << "MIME type probe already in progress -- bailing out." << LL_ENDL;
return;
}
-
+
if(mNavigateServerRequest)
{
setNavState(MEDIANAVSTATE_SERVER_SENT);
@@ -2673,12 +2673,12 @@ void LLViewerMediaImpl::navigateInternal()
{
setNavState(MEDIANAVSTATE_NONE);
}
-
+
// If the caller has specified a non-empty MIME type, look that up in our MIME types list.
// If we have a plugin for that MIME type, use that instead of attempting auto-discovery.
// This helps in supporting legacy media content where the server the media resides on returns a bogus MIME type
// but the parcel owner has correctly set the MIME type in the parcel media settings.
-
+
if(!mMimeType.empty() && (mMimeType != LLMIMETypes::getDefaultMimeType()))
{
std::string plugin_basename = LLMIMETypes::implType(mMimeType);
@@ -2796,7 +2796,7 @@ bool LLViewerMediaImpl::handleKeyUpHere(KEY key, MASK mask)
bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char)
{
bool result = false;
-
+
if (mMediaSource)
{
// only accept 'printable' characters, sigh...
@@ -2804,11 +2804,11 @@ bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char)
&& uni_char != 127) // SDL thinks this is 'delete' - yuck.
{
LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
-
+
mMediaSource->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data);
}
}
-
+
return result;
}
@@ -2887,15 +2887,15 @@ void LLViewerMediaImpl::update()
}
}
-
+
if(mMediaSource == NULL)
{
return;
}
-
+
// Make sure a navigate doesn't happen during the idle -- it can cause mMediaSource to get destroyed, which can cause a crash.
setNavigateSuspended(true);
-
+
mMediaSource->idle();
setNavigateSuspended(false);
@@ -2904,7 +2904,7 @@ void LLViewerMediaImpl::update()
{
return;
}
-
+
if(mMediaSource->isPluginExited())
{
resetPreviousMediaState();
@@ -2916,18 +2916,18 @@ void LLViewerMediaImpl::update()
{
return;
}
-
+
if(mSuspendUpdates || !mVisible)
{
return;
}
-
+
LLViewerMediaTexture* placeholder_image = updatePlaceholderImage();
-
+
if(placeholder_image)
{
LLRect dirty_rect;
-
+
// Since we're updating this texture, we know it's playing. Tell the texture to do its replacement magic so it gets rendered.
placeholder_image->setPlaying(TRUE);
@@ -2938,7 +2938,7 @@ void LLViewerMediaImpl::update()
S32 y_pos = llmax(dirty_rect.mBottom, 0);
S32 width = llmin(dirty_rect.mRight, placeholder_image->getWidth()) - x_pos;
S32 height = llmin(dirty_rect.mTop, placeholder_image->getHeight()) - y_pos;
-
+
if(width > 0 && height > 0)
{
@@ -2951,21 +2951,21 @@ void LLViewerMediaImpl::update()
// Offset the pixels pointer to match x_pos and y_pos
data += ( x_pos * mMediaSource->getTextureDepth() * mMediaSource->getBitsWidth() );
data += ( y_pos * mMediaSource->getTextureDepth() );
-
+
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_SET_SUBIMAGE);
placeholder_image->setSubImage(
- data,
- mMediaSource->getBitsWidth(),
+ data,
+ mMediaSource->getBitsWidth(),
mMediaSource->getBitsHeight(),
- x_pos,
- y_pos,
- width,
+ x_pos,
+ y_pos,
+ width,
height);
}
}
-
+
mMediaSource->resetDirty();
}
}
@@ -2986,10 +2986,10 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage()
// The code that created this instance will read from the plugin's bits.
return NULL;
}
-
+
LLViewerMediaTexture* placeholder_image = LLViewerTextureManager::getMediaTexture( mTextureId );
-
- if (mNeedsNewTexture
+
+ if (mNeedsNewTexture
|| placeholder_image->getUseMipMaps()
|| (placeholder_image->getWidth() != mMediaSource->getTextureWidth())
|| (placeholder_image->getHeight() != mMediaSource->getTextureHeight())
@@ -3003,7 +3003,7 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage()
int texture_width = mMediaSource->getTextureWidth();
int texture_height = mMediaSource->getTextureHeight();
int texture_depth = mMediaSource->getTextureDepth();
-
+
// MEDIAOPT: check to see if size actually changed before doing work
placeholder_image->destroyGLTexture();
// MEDIAOPT: apparently just calling setUseMipMaps(FALSE) doesn't work?
@@ -3029,13 +3029,13 @@ LLViewerMediaTexture* LLViewerMediaImpl::updatePlaceholderImage()
// FIXME
// placeholder_image->mIsMediaTexture = true;
mNeedsNewTexture = false;
-
- // If the amount of the texture being drawn by the media goes down in either width or height,
+
+ // If the amount of the texture being drawn by the media goes down in either width or height,
// recreate the texture to avoid leaving parts of the old image behind.
mTextureUsedWidth = mMediaSource->getWidth();
mTextureUsedHeight = mMediaSource->getHeight();
}
-
+
return placeholder_image;
}
@@ -3050,14 +3050,14 @@ LLUUID LLViewerMediaImpl::getMediaTextureID() const
void LLViewerMediaImpl::setVisible(bool visible)
{
mVisible = visible;
-
+
if(mVisible)
{
if(mMediaSource && mMediaSource->isPluginExited())
{
destroyMediaSource();
}
-
+
if(!mMediaSource)
{
createMediaSource();
@@ -3091,12 +3091,12 @@ void LLViewerMediaImpl::scaleMouse(S32 *mouse_x, S32 *mouse_y)
bool LLViewerMediaImpl::isMediaTimeBased()
{
bool result = false;
-
+
if(mMediaSource)
{
result = mMediaSource->pluginSupportsMediaTime();
}
-
+
return result;
}
@@ -3104,14 +3104,14 @@ bool LLViewerMediaImpl::isMediaTimeBased()
bool LLViewerMediaImpl::isMediaPlaying()
{
bool result = false;
-
+
if(mMediaSource)
{
EMediaStatus status = mMediaSource->getStatus();
if(status == MEDIA_PLAYING || status == MEDIA_LOADING)
result = true;
}
-
+
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -3124,7 +3124,7 @@ bool LLViewerMediaImpl::isMediaPaused()
if(mMediaSource->getStatus() == MEDIA_PAUSED)
result = true;
}
-
+
return result;
}
@@ -3152,7 +3152,7 @@ void LLViewerMediaImpl::setDisabled(bool disabled, bool forcePlayOnEnable)
{
// Only do this on actual state transitions.
mIsDisabled = disabled;
-
+
if(mIsDisabled)
{
// We just disabled this media. Clear all state.
@@ -3178,13 +3178,13 @@ bool LLViewerMediaImpl::isForcedUnloaded() const
{
return true;
}
-
+
// If this media's class is not supposed to be shown, unload
if (!shouldShowBasedOnClass())
{
return true;
}
-
+
return false;
}
@@ -3197,19 +3197,19 @@ bool LLViewerMediaImpl::isPlayable() const
// All of the forced-unloaded criteria also imply not playable.
return false;
}
-
+
if(hasMedia())
{
// Anything that's already playing is, by definition, playable.
return true;
}
-
+
if(!mMediaURL.empty())
{
// If something has navigated the instance, it's ready to be played.
return true;
}
-
+
return false;
}
@@ -3221,7 +3221,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
{
case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
{
- LL_DEBUGS("Media") << "MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is: " << plugin->getClickURL() << LL_ENDL;
+ LL_DEBUGS("Media") << "MEDIA_EVENT_CLICK_LINK_NOFOLLOW, uri is: " << plugin->getClickURL() << LL_ENDL;
std::string url = plugin->getClickURL();
std::string nav_type = plugin->getClickNavType();
LLURLDispatcher::dispatch(url, nav_type, NULL, mTrustedBrowser);
@@ -3240,7 +3240,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
// Reset the last known state of the media to defaults.
resetPreviousMediaState();
-
+
// TODO: may want a different message for this case?
LLSD args;
args["PLUGIN"] = LLMIMETypes::implType(mCurrentMimeType);
@@ -3262,13 +3262,13 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
//LLNotificationsUtil::add("MediaPluginFailed", args);
}
break;
-
+
case MEDIA_EVENT_CURSOR_CHANGED:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CURSOR_CHANGED, new cursor is " << plugin->getCursorName() << LL_ENDL;
std::string cursor = plugin->getCursorName();
-
+
if(cursor == "arrow")
mLastSetCursor = UI_CURSOR_ARROW;
else if(cursor == "ibeam")
@@ -3329,7 +3329,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
}
}
break;
-
+
case LLViewerMediaObserver::MEDIA_EVENT_LOCATION_CHANGED:
{
LL_DEBUGS("Media") << "MEDIA_EVENT_LOCATION_CHANGED, uri is: " << plugin->getLocation() << LL_ENDL;
@@ -3366,15 +3366,15 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
{
// 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;
@@ -3530,7 +3530,7 @@ void LLViewerMediaImpl::calculateInterest()
{
LL_RECORD_BLOCK_TIME(FTM_MEDIA_CALCULATE_INTEREST);
LLViewerMediaTexture* texture = LLViewerTextureManager::findMediaTexture( mTextureId );
-
+
if(texture != NULL)
{
mInterest = texture->getMaxVirtualSize();
@@ -3540,7 +3540,7 @@ void LLViewerMediaImpl::calculateInterest()
// This will be a relatively common case now, since it will always be true for unloaded media.
mInterest = 0.0f;
}
-
+
// Calculate distance from the avatar, for use in the proximity calculation.
mProximityDistance = 0.0f;
mProximityCamera = 0.0f;
@@ -3550,7 +3550,7 @@ void LLViewerMediaImpl::calculateInterest()
std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
LLVOVolume* objp = *iter ;
llassert_always(objp != NULL) ;
-
+
// The distance calculation is invalid for HUD attachments -- leave both mProximityDistance and mProximityCamera at 0 for them.
if(!objp->isHUDAttachment())
{
@@ -3563,12 +3563,12 @@ void LLViewerMediaImpl::calculateInterest()
mProximityCamera = camera_delta.magVec();
}
}
-
+
if(mNeedsMuteCheck)
{
// Check all objects this instance is associated with, and those objects' owners, against the mute list
mIsMuted = false;
-
+
std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
for(; iter != mObjectList.end() ; ++iter)
{
@@ -3595,7 +3595,7 @@ void LLViewerMediaImpl::calculateInterest()
}
}
}
-
+
mNeedsMuteCheck = false;
}
}
@@ -3603,7 +3603,7 @@ void LLViewerMediaImpl::calculateInterest()
F64 LLViewerMediaImpl::getApproximateTextureInterest()
{
F64 result = 0.0f;
-
+
if(mMediaSource)
{
result = mMediaSource->getFullWidth();
@@ -3621,8 +3621,8 @@ F64 LLViewerMediaImpl::getApproximateTextureInterest()
void LLViewerMediaImpl::setUsedInUI(bool used_in_ui)
{
- mUsedInUI = used_in_ui;
-
+ mUsedInUI = used_in_ui;
+
// HACK: Force elements used in UI to load right away.
// This fixes some issues where UI code that uses the browser instance doesn't expect it to be unloaded.
if(mUsedInUI && (mPriority == LLPluginClassMedia::PRIORITY_UNLOADED))
@@ -3642,7 +3642,7 @@ void LLViewerMediaImpl::setUsedInUI(bool used_in_ui)
void LLViewerMediaImpl::setBackgroundColor(LLColor4 color)
{
- mBackgroundColor = color;
+ mBackgroundColor = color;
if(mMediaSource)
{
@@ -3653,12 +3653,12 @@ void LLViewerMediaImpl::setBackgroundColor(LLColor4 color)
F64 LLViewerMediaImpl::getCPUUsage() const
{
F64 result = 0.0f;
-
+
if(mMediaSource)
{
result = mMediaSource->getCPUUsage();
}
-
+
return result;
}
@@ -3672,19 +3672,19 @@ void LLViewerMediaImpl::setPriority(LLPluginClassMedia::EPriority priority)
<< " to " << LLPluginClassMedia::priorityToString(priority)
<< LL_ENDL;
}
-
+
mPriority = priority;
-
+
if(priority == LLPluginClassMedia::PRIORITY_UNLOADED)
{
if(mMediaSource)
{
// Need to unload the media source
-
+
// First, save off previous media state
mPreviousMediaState = mMediaSource->getStatus();
mPreviousMediaTime = mMediaSource->getCurrentTime();
-
+
destroyMediaSource();
}
}
@@ -3693,7 +3693,7 @@ void LLViewerMediaImpl::setPriority(LLPluginClassMedia::EPriority priority)
{
mMediaSource->setPriority(mPriority);
}
-
+
// NOTE: loading (or reloading) media sources whose priority has risen above PRIORITY_UNLOADED is done in update().
}
@@ -3708,8 +3708,8 @@ void LLViewerMediaImpl::setLowPrioritySizeLimit(int size)
void LLViewerMediaImpl::setNavState(EMediaNavState state)
{
mMediaNavState = state;
-
- switch (state)
+
+ switch (state)
{
case MEDIANAVSTATE_NONE: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_NONE" << LL_ENDL; break;
case MEDIANAVSTATE_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_BEGUN" << LL_ENDL; break;
@@ -3748,7 +3748,7 @@ void LLViewerMediaImpl::cancelMimeTypeProbe()
// There doesn't seem to be a way to actually cancel an outstanding request.
// Simulate it by telling the LLMimeDiscoveryResponder not to write back any results.
mMimeTypeProbe->cancelRequest();
-
+
// The above should already have set mMimeTypeProbe to NULL.
if(mMimeTypeProbe != NULL)
{
@@ -3757,7 +3757,7 @@ void LLViewerMediaImpl::cancelMimeTypeProbe()
}
}
-void LLViewerMediaImpl::addObject(LLVOVolume* obj)
+void LLViewerMediaImpl::addObject(LLVOVolume* obj)
{
std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
for(; iter != mObjectList.end() ; ++iter)
@@ -3771,14 +3771,14 @@ void LLViewerMediaImpl::addObject(LLVOVolume* obj)
mObjectList.push_back(obj) ;
mNeedsMuteCheck = true;
}
-
-void LLViewerMediaImpl::removeObject(LLVOVolume* obj)
+
+void LLViewerMediaImpl::removeObject(LLVOVolume* obj)
{
- mObjectList.remove(obj) ;
+ mObjectList.remove(obj) ;
mNeedsMuteCheck = true;
}
-
-const std::list< LLVOVolume* >* LLViewerMediaImpl::getObjectList() const
+
+const std::list< LLVOVolume* >* LLViewerMediaImpl::getObjectList() const
{
return &mObjectList ;
}
@@ -3786,13 +3786,13 @@ const std::list< LLVOVolume* >* LLViewerMediaImpl::getObjectList() const
LLVOVolume *LLViewerMediaImpl::getSomeObject()
{
LLVOVolume *result = NULL;
-
+
std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
if(iter != mObjectList.end())
{
result = *iter;
}
-
+
return result;
}
@@ -3805,12 +3805,12 @@ void LLViewerMediaImpl::setTextureID(LLUUID id)
// Remove this item's entry from the map
sViewerMediaTextureIDMap.erase(mTextureId);
}
-
+
if(id.notNull())
{
sViewerMediaTextureIDMap.insert(LLViewerMedia::impl_id_map::value_type(id, this));
}
-
+
mTextureId = id;
}
}
@@ -3819,7 +3819,7 @@ void LLViewerMediaImpl::setTextureID(LLUUID id)
//
bool LLViewerMediaImpl::isAutoPlayable() const
{
- return (mMediaAutoPlay &&
+ return (mMediaAutoPlay &&
gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay"));
}
@@ -3830,20 +3830,20 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const
{
// If this is parcel media or in the UI, return true always
if (getUsedInUI() || isParcelMedia()) return true;
-
+
bool attached_to_another_avatar = isAttachedToAnotherAvatar();
bool inside_parcel = isInAgentParcel();
-
+
// LL_INFOS() << " hasFocus = " << hasFocus() <<
// " others = " << (attached_to_another_avatar && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING)) <<
// " within = " << (inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING)) <<
// " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << LL_ENDL;
-
+
// If it has focus, we should show it
// This is incorrect, and causes EXT-6750 (disabled attachment media still plays)
// if (hasFocus())
// return true;
-
+
// If it is attached to an avatar and the pref is off, we shouldn't show it
if (attached_to_another_avatar)
{
@@ -3856,7 +3856,7 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const
return show_media_within_parcel;
}
- else
+ else
{
static LLCachedControl<bool> show_media_outside_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING, true);
@@ -3869,7 +3869,7 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const
bool LLViewerMediaImpl::isAttachedToAnotherAvatar() const
{
bool result = false;
-
+
std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
for ( ; iter != end; iter++)
@@ -3913,7 +3913,7 @@ bool LLViewerMediaImpl::isObjectAttachedToAnotherAvatar(LLVOVolume *obj)
bool LLViewerMediaImpl::isInAgentParcel() const
{
bool result = false;
-
+
std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
for ( ; iter != end; iter++)