diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/llplugin/llpluginclassmedia.cpp | 13 | ||||
-rwxr-xr-x | indra/llplugin/llpluginclassmedia.h | 2 | ||||
-rw-r--r-- | indra/media_plugins/cef/media_plugin_cef.cpp | 9 | ||||
-rwxr-xr-x | indra/newview/llviewermedia.cpp | 41 | ||||
-rwxr-xr-x | indra/newview/llviewermedia.h | 1 |
5 files changed, 66 insertions, 0 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index c1464db834..b48f664a2a 100755 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -670,6 +670,19 @@ bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD 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::loadURI(const std::string &uri) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "load_uri"); diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 5fe8254331..3f53551b90 100755 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -133,6 +133,8 @@ public: // Text may be unicode (utf8 encoded) bool textInput(const std::string &text, MASK modifiers, LLSD native_key_data); + void setCookie(std::string uri, std::string name, std::string value, std::string domain, std::string path); + void loadURI(const std::string &uri); // "Loading" means uninitialized or any state prior to fully running (processing commands) diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index 3f3d9dc657..7f538e16d8 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -479,6 +479,15 @@ 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 == "mouse_event") { std::string event = message_in.getValue("event"); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 5eab0a15ab..3342fddade 100755 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -66,6 +66,7 @@ #include "llvoavatar.h" #include "llvoavatarself.h" #include "llvovolume.h" +#include "llfloaterreg.h" #include "llwebprofile.h" #include "llwindow.h" #include "llvieweraudio.h" @@ -1388,6 +1389,28 @@ 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 void LLViewerMedia::setOpenIDCookie() @@ -1419,6 +1442,24 @@ void LLViewerMedia::setOpenIDCookie() getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(host_start, host_end - host_start)); + 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))
+ {
+ std::string url = "http://id.secondlife.com/openid/webkit";
+ 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] = "*/*"; diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index f2da30e10b..0101c85e79 100755 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -163,6 +163,7 @@ public: static LLSD getHeaders(); private: + static bool parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path); static void setOpenIDCookie(); static void onTeleportFinished(); |