Skip to content
Snippets Groups Projects
Commit 4a2a9ba8 authored by callum's avatar callum
Browse files

SOCIAL-392 FIX Web Content Panel does not save location history between sessions

parent 179b434d
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "llpluginclassmedia.h" #include "llpluginclassmedia.h"
#include "llprogressbar.h" #include "llprogressbar.h"
#include "lltextbox.h" #include "lltextbox.h"
#include "llurlhistory.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llweb.h" #include "llweb.h"
#include "llwindow.h" #include "llwindow.h"
...@@ -68,9 +69,35 @@ BOOL LLFloaterWebContent::postBuild() ...@@ -68,9 +69,35 @@ BOOL LLFloaterWebContent::postBuild()
// cache image for secure browsing // cache image for secure browsing
mSecureLockIcon = getChild< LLIconCtrl >("media_secure_lock_flag"); mSecureLockIcon = getChild< LLIconCtrl >("media_secure_lock_flag");
// initialize the URL history using the system URL History manager
initializeURLHistory();
return TRUE; return TRUE;
} }
void LLFloaterWebContent::initializeURLHistory()
{
// start with an empty list
LLCtrlListInterface* url_list = childGetListInterface("address");
if (url_list)
{
url_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
}
// Get all of the entries in the "browser" collection
LLSD browser_history = LLURLHistory::getURLHistory("browser");
LLSD::array_iterator iter_history =
browser_history.beginArray();
LLSD::array_iterator end_history =
browser_history.endArray();
for(; iter_history != end_history; ++iter_history)
{
std::string url = (*iter_history).asString();
if(! url.empty())
url_list->addSimpleElement(url);
}
}
//static //static
void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid ) void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid )
{ {
...@@ -255,17 +282,17 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent ...@@ -255,17 +282,17 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
mStatusBarText->setText( end_str ); mStatusBarText->setText( end_str );
// decide if secure browsing icon should be displayed // decide if secure browsing icon should be displayed
std::string prefix = std::string("https://"); std::string prefix = std::string("https://");
std::string test_prefix = mCurrentURL.substr(0, prefix.length()); std::string test_prefix = mCurrentURL.substr(0, prefix.length());
LLStringUtil::toLower(test_prefix); LLStringUtil::toLower(test_prefix);
if(test_prefix == prefix) if(test_prefix == prefix)
{ {
mSecureLockIcon->setVisible(true); mSecureLockIcon->setVisible(true);
} }
else else
{ {
mSecureLockIcon->setVisible(false); mSecureLockIcon->setVisible(false);
} }
} }
else if(event == MEDIA_EVENT_CLOSE_REQUEST) else if(event == MEDIA_EVENT_CLOSE_REQUEST)
{ {
...@@ -307,6 +334,10 @@ void LLFloaterWebContent::set_current_url(const std::string& url) ...@@ -307,6 +334,10 @@ void LLFloaterWebContent::set_current_url(const std::string& url)
{ {
mCurrentURL = url; mCurrentURL = url;
// serialize url history into the system URL History manager
LLURLHistory::removeURL("browser", mCurrentURL);
LLURLHistory::addURL("browser", mCurrentURL);
mAddressCombo->remove( mCurrentURL ); mAddressCombo->remove( mCurrentURL );
mAddressCombo->add( mCurrentURL ); mAddressCombo->add( mCurrentURL );
mAddressCombo->selectByValue( mCurrentURL ); mAddressCombo->selectByValue( mCurrentURL );
......
...@@ -44,6 +44,8 @@ class LLFloaterWebContent : ...@@ -44,6 +44,8 @@ class LLFloaterWebContent :
LOG_CLASS(LLFloaterWebContent); LOG_CLASS(LLFloaterWebContent);
LLFloaterWebContent(const LLSD& key); LLFloaterWebContent(const LLSD& key);
void initializeURLHistory();
static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null); static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null);
static void closeRequest(const std::string &uuid); static void closeRequest(const std::string &uuid);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment