diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterwebcontent.cpp | 42 | ||||
-rwxr-xr-x | indra/newview/llfloaterwebcontent.h | 1 | ||||
-rwxr-xr-x | indra/newview/llpanelprimmediacontrols.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llpanelprimmediacontrols.h | 1 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/panel_prim_media_controls.xml | 26 |
5 files changed, 43 insertions, 45 deletions
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 62eb9dba8e..e81055f7b1 100755 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -69,7 +69,8 @@ LLFloaterWebContent::LLFloaterWebContent( const Params& params ) mShowPageTitle(params.show_page_title), mAllowNavigation(true), mCurrentURL(""), - mDisplayURL("") + mDisplayURL(""), + mSecureURL(false) { mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this )); mCommitCallbackRegistrar.add( "WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this )); @@ -242,7 +243,6 @@ void LLFloaterWebContent::open_media(const Params& p) mWebBrowser->setTarget(p.target); mWebBrowser->navigateTo(p.url, "text/html"); - mSecureLockIcon->setVisible(false); set_current_url(p.url); getChild<LLLayoutPanel>("status_bar")->setVisible(p.show_chrome); @@ -304,6 +304,9 @@ void LLFloaterWebContent::draw() mBtnBack->setEnabled( mWebBrowser->canNavigateBack() && mAllowNavigation); mBtnForward->setEnabled( mWebBrowser->canNavigateForward() && mAllowNavigation); + // Show/hide the lock icon + mSecureLockIcon->setVisible(mSecureURL && !mAddressCombo->hasFocus()); + LLFloater::draw(); } @@ -317,7 +320,6 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent if ( url.length() ) mStatusBarText->setText( url ); - mSecureLockIcon->setVisible(false); set_current_url( url ); } else if(event == MEDIA_EVENT_NAVIGATE_BEGIN) @@ -349,23 +351,6 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent // we populate the status bar with URLs as they change so clear it now we're done const std::string end_str = ""; mStatusBarText->setText( end_str ); - - // decide if secure browsing icon should be displayed - std::string prefix = std::string("https://"); - std::string test_prefix = mCurrentURL.substr(0, prefix.length()); - LLStringUtil::toLower(test_prefix); - if (test_prefix == prefix) - { - mSecureLockIcon->setVisible(true); - // Hack : we move the text a bit to make space for the lock icon. - BOOL browser_has_focus = mWebBrowser->hasFocus(); - set_current_url(" " + mCurrentURL); - mWebBrowser->setFocus(browser_has_focus); - } - else - { - mSecureLockIcon->setVisible(false); - } } else if(event == MEDIA_EVENT_CLOSE_REQUEST) { @@ -417,8 +402,7 @@ void LLFloaterWebContent::set_current_url(const std::string& url) mAddressCombo->add(mCurrentURL); } - // Update current URLs - mDisplayURL = url; + // Update current URL mCurrentURL = url; LLStringUtil::trim(mCurrentURL); @@ -426,10 +410,22 @@ void LLFloaterWebContent::set_current_url(const std::string& url) LLURLHistory::removeURL("browser", mCurrentURL); LLURLHistory::addURL("browser", mCurrentURL); - // Clean up browsing list (prevent dupes) and add/select new URL to it + // Check if this is a secure URL + static const std::string secure_prefix = std::string("https://"); + std::string prefix = mCurrentURL.substr(0, secure_prefix.length()); + LLStringUtil::toLower(prefix); + mSecureURL = (prefix == secure_prefix); + + // Hack : we move the text a bit to make space for the lock icon in the secure URL case + mDisplayURL = (mSecureURL ? " " + mCurrentURL : mCurrentURL); + + // Clean up browsing list (prevent dupes) and add/select the new URL to it mAddressCombo->remove(mCurrentURL); mAddressCombo->add(mDisplayURL); mAddressCombo->selectByValue(mDisplayURL); + + // Set the focus back to the web page. When setting the url, there's no point to leave the focus anywhere else. + mWebBrowser->setFocus(TRUE); } } diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 5976474e0e..f7e0db8d9e 100755 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -111,6 +111,7 @@ protected: std::string mUUID; bool mShowPageTitle; bool mAllowNavigation; + bool mSecureURL; // true when the current url is prefixed "https://" }; #endif // LL_LLFLOATERWEBCONTENT_H diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 76d38f067d..9504f22a1d 100755 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -94,7 +94,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mZoomObjectFace(0), mVolumeSliderVisible(0), mWindowShade(NULL), - mHideImmediately(false) + mHideImmediately(false), + mSecureURL(false) { mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this)); mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this)); @@ -345,7 +346,7 @@ void LLPanelPrimMediaControls::updateShape() // Disable zoom if HUD mZoomCtrl->setEnabled(!is_hud); mUnzoomCtrl->setEnabled(!is_hud); - mSecureLockIcon->setVisible(false); + mSecureURL = false; mCurrentURL = media_impl->getCurrentMediaURL(); mBackCtrl->setEnabled((media_impl != NULL) && media_impl->canNavigateBack() && can_navigate); @@ -382,7 +383,7 @@ void LLPanelPrimMediaControls::updateShape() mVolumeSliderCtrl->setVisible(has_focus && shouldVolumeSliderBeVisible()); mWhitelistIcon->setVisible(false); - mSecureLockIcon->setVisible(false); + mSecureURL = false; if (mMediaPanelScroll) { mMediaPanelScroll->setVisible(false); @@ -416,7 +417,7 @@ void LLPanelPrimMediaControls::updateShape() mMediaPlaySliderCtrl->setEnabled(true); } - // video vloume + // video volume if(volume <= 0.0) { mMuteBtn->setToggleState(true); @@ -492,10 +493,8 @@ void LLPanelPrimMediaControls::updateShape() std::string prefix = std::string("https://"); std::string test_prefix = mCurrentURL.substr(0, prefix.length()); LLStringUtil::toLower(test_prefix); - if(test_prefix == prefix) - { - mSecureLockIcon->setVisible(has_focus); - } + mSecureURL = has_focus && (test_prefix == prefix); + mCurrentURL = (mSecureURL ? " " + mCurrentURL : mCurrentURL); if(mCurrentURL!=mPreviousURL) { @@ -746,6 +745,9 @@ void LLPanelPrimMediaControls::draw() clearFaceOnFade(); } } + + // Show/hide the lock icon for secure browsing + mSecureLockIcon->setVisible(mSecureURL && !mMediaAddress->hasFocus()); // Build rect for icon area in coord system of this panel // Assumes layout_stack is a direct child of this panel diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index eeb433e306..6d2eb3430e 100755 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -191,6 +191,7 @@ private: bool mUpdateSlider; bool mClearFaceOnFade; bool mHideImmediately; + bool mSecureURL; LLMatrix4 mLastCameraMat; EZoomLevel mCurrentZoom; diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index 198ccd6e2f..8f90521bb2 100755 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -315,7 +315,18 @@ <line_editor.commit_callback function="MediaCtrl.CommitURL"/> </line_editor> - <layout_stack + <icon + name="media_secure_lock_flag" + height="16" + follows="top|left" + image_name="Lock2" + layout="topleft" + left_delta="2" + top_delta="2" + visible="false" + tool_tip="Secured Browsing" + width="16" /> + <layout_stack name="media_address_url_icons" animate="false" follows="top|right" @@ -340,19 +351,6 @@ tool_tip="White List enabled" width="16" /> </layout_panel> - <layout_panel - layout="topleft" - width="16" - mouse_opaque="false" - auto_resize="false"> - <icon - name="media_secure_lock_flag" - height="16" - image_name="Lock2" - layout="topleft" - tool_tip="Secured Browsing" - width="16" /> - </layout_panel> </layout_stack> </layout_panel> <layout_panel |