diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/media_plugins/cef/media_plugin_cef.cpp | 143 | ||||
-rwxr-xr-x | indra/newview/llappviewer.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 2 |
3 files changed, 127 insertions, 23 deletions
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index 187c6a241d..3b82071ae8 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -38,8 +38,6 @@ #include "boost/bind.hpp" #include "llCEFLib.h" -#include <time.h> // remove me - //////////////////////////////////////////////////////////////////////////////// // class MediaPluginCEF : @@ -55,19 +53,15 @@ public: private: bool init(); - // TODO FIX ME - void pageChangedCallback(unsigned char* pixels, int width, int height) - { - if (mPixels && pixels) - { - if (mWidth == width && mHeight == height) - { - memcpy(mPixels, pixels, mWidth * mHeight * mDepth); - } - setDirty(0, 0, mWidth, mHeight); - } - } - + void pageChangedCallback(unsigned char* pixels, int width, int height);
+ void onCustomSchemeURLCallback(std::string url);
+ void onConsoleMessageCallback(std::string message, std::string source, int line);
+ void onStatusMessageCallback(std::string value);
+ void onTitleChangeCallback(std::string title);
+ void onLoadStartCallback();
+ void onLoadEndCallback(int httpStatusCode);
+ void onNavigateURLCallback(std::string url);
+
void postDebugMessage(const std::string& msg); bool mEnableMediaPluginDebugging; @@ -99,7 +93,7 @@ MediaPluginCEF::~MediaPluginCEF() // void MediaPluginCEF::postDebugMessage(const std::string& msg) { - //if (mEnableMediaPluginDebugging) + if (mEnableMediaPluginDebugging) { std::stringstream str; str << "@Media Msg> " << msg; @@ -113,6 +107,89 @@ void MediaPluginCEF::postDebugMessage(const std::string& msg) //////////////////////////////////////////////////////////////////////////////// // +void MediaPluginCEF::pageChangedCallback(unsigned char* pixels, int width, int height) +{ + if (mPixels && pixels) + { + if (mWidth == width && mHeight == height) + { + memcpy(mPixels, pixels, mWidth * mHeight * mDepth); + } + setDirty(0, 0, mWidth, mHeight); + } +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginCEF::onCustomSchemeURLCallback(std::string url) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_nofollow");
+ message.setValue("uri", url);
+ message.setValue("nav_type", "clicked"); // TODO: differentiate between click and navigate to
+ sendMessage(message);
+} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginCEF::onConsoleMessageCallback(std::string message, std::string source, int line) +{ + std::stringstream str; + str << "Console message: " << message << " in file(" << source << ") at line " << line; + postDebugMessage(str.str()); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginCEF::onStatusMessageCallback(std::string value) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "status_text");
+ message.setValue("status", value);
+ sendMessage(message); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginCEF::onTitleChangeCallback(std::string title) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text");
+ message.setValue("name", title);
+ sendMessage(message);
+} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginCEF::onLoadStartCallback() +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_begin");
+ //message.setValue("uri", event.getEventUri()); // not easily available here in CEF - needed?
+ message.setValueBoolean("history_back_available", mLLCEFLib->canGoBack());
+ message.setValueBoolean("history_forward_available", mLLCEFLib->canGoForward());
+ sendMessage(message); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginCEF::onLoadEndCallback(int httpStatusCode) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_complete");
+ //message.setValue("uri", event.getEventUri()); // not easily available here in CEF - needed?
+ message.setValueS32("result_code", httpStatusCode);
+ message.setValueBoolean("history_back_available", mLLCEFLib->canGoBack());
+ message.setValueBoolean("history_forward_available", mLLCEFLib->canGoForward());
+ sendMessage(message); +} + +//////////////////////////////////////////////////////////////////////////////// +// +void MediaPluginCEF::onNavigateURLCallback(std::string url) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "location_changed");
+ message.setValue("uri", url);
+ sendMessage(message);
+} + +//////////////////////////////////////////////////////////////////////////////// +// void MediaPluginCEF::receiveMessage(const char* message_string) { // std::cerr << "MediaPluginWebKit::receiveMessage: received message: \"" << message_string << "\"" << std::endl; @@ -133,7 +210,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER] = LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER_VERSION; message.setValueLLSD("versions", versions); - std::string plugin_version = "Example plugin 1.0..0"; + std::string plugin_version = "CEF plugin 1.0.0"; message.setValue("plugin_version", plugin_version); sendMessage(message); } @@ -186,8 +263,15 @@ void MediaPluginCEF::receiveMessage(const char* message_string) { if (message_name == "init") { - + // event callbacks from LLCefLib mLLCEFLib->setPageChangedCallback(boost::bind(&MediaPluginCEF::pageChangedCallback, this, _1, _2, _3)); + mLLCEFLib->setOnCustomSchemeURLCallback(boost::bind(&MediaPluginCEF::onCustomSchemeURLCallback, this, _1)); + mLLCEFLib->setOnConsoleMessageCallback(boost::bind(&MediaPluginCEF::onConsoleMessageCallback, this, _1, _2, _3)); + mLLCEFLib->setOnStatusMessageCallback(boost::bind(&MediaPluginCEF::onStatusMessageCallback, this, _1)); + mLLCEFLib->setOnTitleChangeCallback(boost::bind(&MediaPluginCEF::onTitleChangeCallback, this, _1)); + mLLCEFLib->setOnLoadStartCallback(boost::bind(&MediaPluginCEF::onLoadStartCallback, this)); + mLLCEFLib->setOnLoadEndCallback(boost::bind(&MediaPluginCEF::onLoadEndCallback, this, _1)); + mLLCEFLib->setOnNavigateURLCallback(boost::bind(&MediaPluginCEF::onNavigateURLCallback, this, _1)); LLCEFLibSettings settings; settings.inital_width = 1024; @@ -197,6 +281,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) bool result = mLLCEFLib->init(settings); if (!result) { +// TODO - return something to indicate failure //MessageBoxA(0, "FAIL INIT", 0, 0); } @@ -332,6 +417,26 @@ void MediaPluginCEF::receiveMessage(const char* message_string) mEnableMediaPluginDebugging = message_in.getValueBoolean("enable"); } } + else if (message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER) + { + if (message_name == "browse_stop")
+ {
+ mLLCEFLib->stop();
+ }
+ else if (message_name == "browse_reload")
+ {
+ bool ignore_cache = true;
+ mLLCEFLib->reload(ignore_cache);
+ }
+ else if (message_name == "browse_forward")
+ {
+ mLLCEFLib->goForward();
+ }
+ else if (message_name == "browse_back")
+ {
+ mLLCEFLib->goBack();
+ }
+ } else { //std::cerr << "MediaPluginWebKit::receiveMessage: unknown message class: " << message_class << std::endl; @@ -344,7 +449,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) bool MediaPluginCEF::init() { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text"); - message.setValue("name", "Example Plugin"); + message.setValue("name", "CEF Plugin"); sendMessage(message); return true; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6dc71bc94e..d2b9259ef7 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -123,6 +123,7 @@ #include "llleap.h" #include "stringize.h" #include "llcoros.h" +#include "cef/llceflib.h" // Third party library includes #include <boost/bind.hpp> @@ -130,7 +131,6 @@ #include <boost/algorithm/string.hpp> #include <boost/regex.hpp> - #if LL_WINDOWS # include <share.h> // For _SH_DENYWR in processMarkerFiles #else @@ -3369,8 +3369,7 @@ LLSD LLAppViewer::getViewerInfo() const info["VOICE_VERSION"] = LLTrans::getString("NotConnected"); } - // TODO: Implement media plugin version query - info["QT_WEBKIT_VERSION"] = "4.7.1 (version number hard-coded)"; + info["LLCEFLIB_VERSION"] = LLCEFLIB_VERSION; S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN); if (packets_in > 0) diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index f77678e5f8..d6ac91e45f 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -50,7 +50,7 @@ OpenGL Version: [OPENGL_VERSION] libcurl Version: [LIBCURL_VERSION] J2C Decoder Version: [J2C_VERSION] Audio Driver Version: [AUDIO_DRIVER_VERSION] -Qt Webkit Version: [QT_WEBKIT_VERSION] +LLCEFLib/CEF Version: [LLCEFLIB_VERSION] Voice Server Version: [VOICE_VERSION] </string> <string name="AboutTraffic">Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)</string> |