diff options
author | Kent Quirk <q@lindenlab.com> | 2010-04-02 23:47:19 -0400 |
---|---|---|
committer | Kent Quirk <q@lindenlab.com> | 2010-04-02 23:47:19 -0400 |
commit | 99a24d7fb8c6632c1aa78c82748737bb3a1348b3 (patch) | |
tree | 87cc059591a0d1112e318ab80472768fb4c081f6 /indra/newview/llfloatertos.cpp | |
parent | 8adb47c784c47695b55f24e1172e79a687d05007 (diff) | |
parent | da6bba2ed343e208b3d39f0ef326b78bcfd06581 (diff) |
merge hotfix changes to release
Diffstat (limited to 'indra/newview/llfloatertos.cpp')
-rw-r--r-- | indra/newview/llfloatertos.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 69ee8cd547..3db9587797 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -57,7 +57,9 @@ LLFloaterTOS::LLFloaterTOS(const LLSD& data) : LLModalDialog( data["message"].asString() ), mMessage(data["message"].asString()), mWebBrowserWindowId( 0 ), - mLoadCompleteCount( 0 ), + mLoadingScreenLoaded(false), + mSiteAlive(false), + mRealNavigateBegun(false), mReplyPumpName(data["reply_pump"].asString()) { } @@ -138,6 +140,11 @@ BOOL LLFloaterTOS::postBuild() if ( web_browser ) { web_browser->addObserver(this); + + // Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer. + // Store the URL separately and navigate here instead. + web_browser->navigateTo( getString( "loading_url" ) ); + gResponsePtr = LLIamHere::build( this ); LLHTTPClient::get( getString( "real_url" ), gResponsePtr ); } @@ -147,15 +154,16 @@ BOOL LLFloaterTOS::postBuild() void LLFloaterTOS::setSiteIsAlive( bool alive ) { + mSiteAlive = alive; + // only do this for TOS pages if (hasChild("tos_html")) { - LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html"); // if the contents of the site was retrieved if ( alive ) { // navigate to the "real" page - web_browser->navigateTo( getString( "real_url" ) ); + loadIfNeeded(); } else { @@ -167,6 +175,19 @@ void LLFloaterTOS::setSiteIsAlive( bool alive ) } } +void LLFloaterTOS::loadIfNeeded() +{ + if(!mRealNavigateBegun && mSiteAlive) + { + LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html"); + if(web_browser) + { + mRealNavigateBegun = true; + web_browser->navigateTo( getString( "real_url" ) ); + } + } +} + LLFloaterTOS::~LLFloaterTOS() { @@ -216,8 +237,13 @@ void LLFloaterTOS::onCancel( void* userdata ) LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(false)); } - self->mLoadCompleteCount = 0; // reset counter for next time we come to TOS - self->closeFloater(); // destroys this object + // reset state for next time we come to TOS + self->mLoadingScreenLoaded = false; + self->mSiteAlive = false; + self->mRealNavigateBegun = false; + + // destroys this object + self->closeFloater(); } //virtual @@ -225,8 +251,12 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev { if(event == MEDIA_EVENT_NAVIGATE_COMPLETE) { - // skip past the loading screen navigate complete - if ( ++mLoadCompleteCount == 2 ) + if(!mLoadingScreenLoaded) + { + mLoadingScreenLoaded = true; + loadIfNeeded(); + } + else if(mRealNavigateBegun) { llinfos << "NAVIGATE COMPLETE" << llendl; // enable Agree to TOS radio button now that page has loaded |