summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-07-21 13:02:55 -0700
committerMerov Linden <merov@lindenlab.com>2013-07-21 13:02:55 -0700
commitf44d24fafba7e8b9e8b5318602088a69d8da741c (patch)
tree22368a5136264ce223f90ab6cdccd906546ccfed /indra
parenteadb42eb9d202c38ca2761be07ee4376863550ce (diff)
ACME-734 : Fix : Factorize and clean up web browsing address, log and history code
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llfloaterwebcontent.cpp36
-rwxr-xr-xindra/newview/llfloaterwebcontent.h4
2 files changed, 18 insertions, 22 deletions
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 5e8bb7ad57..129e1f0e2a 100755
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -68,6 +68,7 @@ LLFloaterWebContent::LLFloaterWebContent( const Params& params )
mUUID(params.id()),
mShowPageTitle(params.show_page_title),
mAllowNavigation(true),
+ mCurrentURL(""),
mDisplayURL("")
{
mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this ));
@@ -356,17 +357,8 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
if (test_prefix == prefix)
{
mSecureLockIcon->setVisible(true);
- if (!mDisplayURL.empty())
- {
- // Clear temporary entry if any
- mAddressCombo->remove( mDisplayURL );
- mDisplayURL = "";
- }
// Hack : we move the text a bit to make space for the lock icon.
- // That entry in the list will be deleted on the next add.
- mDisplayURL = " " + mCurrentURL;
- mAddressCombo->add( mDisplayURL );
- mAddressCombo->selectByValue( mDisplayURL );
+ set_current_url(" " + mCurrentURL);
}
else
{
@@ -414,22 +406,26 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
void LLFloaterWebContent::set_current_url(const std::string& url)
{
+ if (!mCurrentURL.empty())
+ {
+ // Clean up the current browsing list to show true URL
+ mAddressCombo->remove(mDisplayURL);
+ mAddressCombo->add(mCurrentURL);
+ }
+
+ // Update current URLs
+ mDisplayURL = url;
mCurrentURL = url;
LLStringUtil::trim(mCurrentURL);
+ // Serialize url history into the system URL History manager
LLURLHistory::removeURL("browser", mCurrentURL);
- // serialize url history into the system URL History manager
LLURLHistory::addURL("browser", mCurrentURL);
- if (!mDisplayURL.empty())
- {
- // Clear temporary entry if any
- mAddressCombo->remove( mDisplayURL );
- mDisplayURL = "";
- }
- mAddressCombo->remove( mCurrentURL );
- mAddressCombo->add( mCurrentURL );
- mAddressCombo->selectByValue( mCurrentURL );
+ // Clean up browsing list (prevent dupes) and add/select new URL to it
+ mAddressCombo->remove(mCurrentURL);
+ mAddressCombo->add(mDisplayURL);
+ mAddressCombo->selectByValue(mDisplayURL);
}
void LLFloaterWebContent::onClickForward()
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index 9d6d28bce0..5976474e0e 100755
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -106,8 +106,8 @@ protected:
LLView* mBtnReload;
LLView* mBtnStop;
- std::string mCurrentURL;
- std::string mDisplayURL;
+ std::string mCurrentURL; // Current URL
+ std::string mDisplayURL; // URL being displayed in the address bar (can differ by trailing / leading space)
std::string mUUID;
bool mShowPageTitle;
bool mAllowNavigation;