From 27cd3784b870deec313678d28de65bb8d7fe4626 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Sun, 31 Oct 2010 15:47:04 +0100 Subject: Fix llqtwebkit version incompatibility. This patch has the minimum changes needed to be compatible with LLQTWEBKIT_API_VERSION 2. From llqtwebkit.h: Version 2: indra/media_plugins/webkit/media_plugin_webkit.cpp: * Changed the usage of the event parameters in onClickLinkHref and onClickLinkNoFollow events slightly. The clicked URI for both should now be retrieved with getEventUri() instead of getStringValue(). The "target" string in onClickLinkHref is now retrieved with getStringValue() instead of getStringValue2(). * The contents of getStringValue2() in the onClickLinkHref event is now a unique ID for the window proxy the click targets. all changed files: * Removed the "link target type" concept, since it doesn't really belong here. Note that not all changes have been taken into account, since we need a LOT of code changes for MoaP before that gets relevant; most notably: "target" and "uuid" aren't used anywhere. The new LLEmbeddedBrowserWindowObserver::onWindowGeometryChangeRequested and LLEmbeddedBrowserWindowObserver::onRequestFilePicker are still not implemented. Version 1 introduced LLEmbeddedBrowserWindowObserver::onWindowCloseRequested which is also still not implemented. --- linden/indra/llplugin/llpluginclassmedia.cpp | 28 ---------------------- linden/indra/llplugin/llpluginclassmedia.h | 11 --------- .../media_plugins/webkit/media_plugin_webkit.cpp | 17 ++++++++++--- 3 files changed, 14 insertions(+), 42 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/llplugin/llpluginclassmedia.cpp b/linden/indra/llplugin/llpluginclassmedia.cpp index 5dc0c47..85241be 100755 --- a/linden/indra/llplugin/llpluginclassmedia.cpp +++ b/linden/indra/llplugin/llpluginclassmedia.cpp @@ -150,7 +150,6 @@ void LLPluginClassMedia::reset() mProgressPercent = 0; mClickURL.clear(); mClickTarget.clear(); - mClickTargetType = TARGET_NONE; // media_time class mCurrentTime = 0.0f; @@ -722,30 +721,6 @@ void LLPluginClassMedia::setJavascriptEnabled(const bool enabled) sendMessage(message); } -LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) -{ - llassert(false); - return LLPluginClassMedia::TARGET_OTHER; -#if 0 - // convert a LinkTargetType value from llqtwebkit to an ETargetType - // so that we don't expose the llqtwebkit header in viewer code - switch (target_type) - { - case LLQtWebKit::LTT_TARGET_NONE: - return LLPluginClassMedia::TARGET_NONE; - - case LLQtWebKit::LTT_TARGET_BLANK: - return LLPluginClassMedia::TARGET_BLANK; - - case LLQtWebKit::LTT_TARGET_EXTERNAL: - return LLPluginClassMedia::TARGET_EXTERNAL; - - default: - return LLPluginClassMedia::TARGET_OTHER; - } -#endif -} - /* virtual */ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) { @@ -998,15 +973,12 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message) { mClickURL = message.getValue("uri"); mClickTarget = message.getValue("target"); - U32 target_type = message.getValueU32("target_type"); - mClickTargetType = ::getTargetTypeFromLLQtWebkit(target_type); mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_HREF); } else if(message_name == "click_nofollow") { mClickURL = message.getValue("uri"); mClickTarget.clear(); - mClickTargetType = TARGET_NONE; mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW); } else if(message_name == "cookie_set") diff --git a/linden/indra/llplugin/llpluginclassmedia.h b/linden/indra/llplugin/llpluginclassmedia.h index abb7926..0004971 100755 --- a/linden/indra/llplugin/llpluginclassmedia.h +++ b/linden/indra/llplugin/llpluginclassmedia.h @@ -225,16 +225,6 @@ public: // This is valid after MEDIA_EVENT_CLICK_LINK_HREF std::string getClickTarget() const { return mClickTarget; }; - typedef enum - { - TARGET_NONE, // empty href target string - TARGET_BLANK, // target to open link in user's preferred browser - TARGET_EXTERNAL, // target to open link in external browser - TARGET_OTHER // nonempty and unsupported target type - }ETargetType; - - // This is valid after MEDIA_EVENT_CLICK_LINK_HREF - ETargetType getClickTargetType() const { return mClickTargetType; }; std::string getMediaName() const { return mMediaName; }; std::string getMediaDescription() const { return mMediaDescription; }; @@ -366,7 +356,6 @@ protected: std::string mLocation; std::string mClickURL; std::string mClickTarget; - ETargetType mClickTargetType; ///////////////////////////////////////// // media_time class diff --git a/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp b/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp index 767090c..eed59a2 100755 --- a/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/linden/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -326,7 +326,11 @@ private: LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); // create single browser window +#if LLQTWEBKIT_API_VERSION >= 2 + mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow(mWidth, mHeight /*, mTarget*/ ); // We don't have mTarget yet. +#else mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight ); +#endif // tell LLQtWebKit about the size of the browser window LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight ); @@ -527,10 +531,14 @@ private: void onClickLinkHref(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href"); +#if LLQTWEBKIT_API_VERSION >= 2 + message.setValue("uri", event.getEventUri()); + message.setValue("target", event.getStringValue()); + message.setValue("uuid", event.getStringValue2()); +#else + // This will work as long as we don't need "uuid", which will be needed for MoaP. message.setValue("uri", event.getStringValue()); message.setValue("target", event.getStringValue2()); -#if 0 // FIXME (webkit_plugins): error: ‘const class LLEmbeddedBrowserWindowEvent’ has no member named ‘getLinkType’ - message.setValueU32("target_type", event.getLinkType()); #endif sendMessage(message); } @@ -540,10 +548,13 @@ private: void onClickLinkNoFollow(const EventType& event) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_nofollow"); +#if LLQTWEBKIT_API_VERSION >= 2 + message.setValue("uri", event.getEventUri()); +#else message.setValue("uri", event.getStringValue()); +#endif sendMessage(message); } - //////////////////////////////////////////////////////////////////////////////// // virtual -- cgit v1.1