diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llwebbrowserctrl.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llwebbrowserctrl.cpp | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/linden/indra/newview/llwebbrowserctrl.cpp b/linden/indra/newview/llwebbrowserctrl.cpp index a80ce69..89cb62b 100644 --- a/linden/indra/newview/llwebbrowserctrl.cpp +++ b/linden/indra/newview/llwebbrowserctrl.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -43,7 +44,7 @@ | |||
43 | #include "llviewborder.h" | 44 | #include "llviewborder.h" |
44 | #include "llviewercontrol.h" | 45 | #include "llviewercontrol.h" |
45 | #include "llviewerwindow.h" | 46 | #include "llviewerwindow.h" |
46 | #include "llnotify.h" | 47 | #include "llnotifications.h" |
47 | #include "llweb.h" | 48 | #include "llweb.h" |
48 | #include "llrender.h" | 49 | #include "llrender.h" |
49 | 50 | ||
@@ -69,7 +70,7 @@ LLWebBrowserCtrl::LLWebBrowserCtrl( const std::string& name, const LLRect& rect | |||
69 | mForceUpdate( false ), | 70 | mForceUpdate( false ), |
70 | mOpenLinksInExternalBrowser( false ), | 71 | mOpenLinksInExternalBrowser( false ), |
71 | mOpenLinksInInternalBrowser( false ), | 72 | mOpenLinksInInternalBrowser( false ), |
72 | mOpenAppSLURLs( false ), | 73 | mTrusted( false ), |
73 | mHomePageUrl( "" ), | 74 | mHomePageUrl( "" ), |
74 | mIgnoreUIScale( true ), | 75 | mIgnoreUIScale( true ), |
75 | mAlwaysRefresh( false ), | 76 | mAlwaysRefresh( false ), |
@@ -187,10 +188,10 @@ void LLWebBrowserCtrl::setOpenInInternalBrowser( bool valIn ) | |||
187 | }; | 188 | }; |
188 | 189 | ||
189 | //////////////////////////////////////////////////////////////////////////////// | 190 | //////////////////////////////////////////////////////////////////////////////// |
190 | void LLWebBrowserCtrl::setOpenAppSLURLs( bool valIn ) | 191 | void LLWebBrowserCtrl::setTrusted( bool valIn ) |
191 | { | 192 | { |
192 | mOpenAppSLURLs = valIn; | 193 | mTrusted = valIn; |
193 | }; | 194 | } |
194 | 195 | ||
195 | //////////////////////////////////////////////////////////////////////////////// | 196 | //////////////////////////////////////////////////////////////////////////////// |
196 | // | 197 | // |
@@ -670,16 +671,6 @@ void LLWebBrowserCtrl::onStatusTextChange( const EventType& eventIn ) | |||
670 | // virtual | 671 | // virtual |
671 | void LLWebBrowserCtrl::onLocationChange( const EventType& eventIn ) | 672 | void LLWebBrowserCtrl::onLocationChange( const EventType& eventIn ) |
672 | { | 673 | { |
673 | const LLURI url(eventIn.getStringValue()); | ||
674 | LLSD queryMap(url.queryMap()); | ||
675 | std::string redirect_http_hack = queryMap["redirect-http-hack"].asString(); | ||
676 | if (!redirect_http_hack.empty()) | ||
677 | { | ||
678 | const bool from_external_browser = false; | ||
679 | LLURLDispatcher::dispatch(redirect_http_hack, from_external_browser); | ||
680 | return; | ||
681 | } | ||
682 | |||
683 | // chain this event on to observers of an instance of LLWebBrowserCtrl | 674 | // chain this event on to observers of an instance of LLWebBrowserCtrl |
684 | LLWebBrowserCtrlEvent event( eventIn.getStringValue() ); | 675 | LLWebBrowserCtrlEvent event( eventIn.getStringValue() ); |
685 | mEventEmitter.update( &LLWebBrowserCtrlObserver::onLocationChange, event ); | 676 | mEventEmitter.update( &LLWebBrowserCtrlObserver::onLocationChange, event ); |
@@ -698,14 +689,16 @@ void LLWebBrowserCtrl::onMediaContentsChange( const EventType& event_in ) | |||
698 | 689 | ||
699 | //////////////////////////////////////////////////////////////////////////////// | 690 | //////////////////////////////////////////////////////////////////////////////// |
700 | // static | 691 | // static |
701 | void LLWebBrowserCtrl::onClickLinkExternalTarget( S32 option, void* userdata ) | 692 | bool LLWebBrowserCtrl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response ) |
702 | { | 693 | { |
694 | S32 option = LLNotification::getSelectedOption(notification, response); | ||
703 | if ( 0 == option ) | 695 | if ( 0 == option ) |
704 | { | 696 | { |
705 | // open in external browser because we don't support | 697 | // open in external browser because we don't support |
706 | // creation of our own secondary browser windows | 698 | // creation of our own secondary browser windows |
707 | LLWeb::loadURLExternal( ((LLWebBrowserCtrl*)userdata)->mExternalUrl ); | 699 | LLWeb::loadURLExternal( notification["payload"]["external_url"].asString() ); |
708 | }; | 700 | } |
701 | return false; | ||
709 | } | 702 | } |
710 | 703 | ||
711 | //////////////////////////////////////////////////////////////////////////////// | 704 | //////////////////////////////////////////////////////////////////////////////// |
@@ -716,12 +709,15 @@ void LLWebBrowserCtrl::onClickLinkHref( const EventType& eventIn ) | |||
716 | if ( eventIn.getStringValueEx().length() ) | 709 | if ( eventIn.getStringValueEx().length() ) |
717 | { | 710 | { |
718 | // if the target = "_new" | 711 | // if the target = "_new" |
719 | if ( eventIn.getStringValueEx() == "_external" ) { | 712 | if ( eventIn.getStringValueEx() == "_external" ) |
713 | { | ||
720 | mExternalUrl = eventIn.getStringValue(); | 714 | mExternalUrl = eventIn.getStringValue(); |
721 | gViewerWindow->alertXml( "WebLaunchExternalTarget", onClickLinkExternalTarget, (void*)this ); | 715 | LLSD payload; |
716 | payload["external_url"] = mExternalUrl; | ||
717 | LLNotifications::instance().add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget); | ||
722 | return; | 718 | return; |
723 | }; | 719 | } |
724 | }; | 720 | } |
725 | 721 | ||
726 | const std::string protocol1( "http://" ); | 722 | const std::string protocol1( "http://" ); |
727 | const std::string protocol2( "https://" ); | 723 | const std::string protocol2( "https://" ); |
@@ -733,8 +729,8 @@ void LLWebBrowserCtrl::onClickLinkHref( const EventType& eventIn ) | |||
733 | LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ), protocol2 ) == 0 ) | 729 | LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ), protocol2 ) == 0 ) |
734 | { | 730 | { |
735 | LLWeb::loadURLExternal( eventIn.getStringValue() ); | 731 | LLWeb::loadURLExternal( eventIn.getStringValue() ); |
736 | }; | 732 | } |
737 | }; | 733 | } |
738 | } | 734 | } |
739 | else | 735 | else |
740 | if( mOpenLinksInInternalBrowser ) | 736 | if( mOpenLinksInInternalBrowser ) |
@@ -745,17 +741,17 @@ void LLWebBrowserCtrl::onClickLinkHref( const EventType& eventIn ) | |||
745 | LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ), protocol2 ) == 0 ) | 741 | LLStringUtil::compareInsensitive( eventIn.getStringValue().substr( 0, protocol2.length() ), protocol2 ) == 0 ) |
746 | { | 742 | { |
747 | // If we spawn a new LLFloaterHTML, assume we want it to | 743 | // If we spawn a new LLFloaterHTML, assume we want it to |
748 | // follow this LLWebBrowserCtrl's setting for whether or | 744 | // follow this LLWebBrowserCtrl's trust for whether or |
749 | // not to open secondlife:///app/ links. JC. | 745 | // not to open secondlife:///app/ links. JC. |
750 | const bool open_links_externally = false; | 746 | const bool open_links_externally = false; |
751 | LLFloaterHtml::getInstance()->show( | 747 | LLFloaterHtml::getInstance()->show( |
752 | eventIn.getStringValue(), | 748 | eventIn.getStringValue(), |
753 | "Second Life Browser", | 749 | "Second Life Browser", |
754 | open_links_externally, | 750 | open_links_externally, |
755 | mOpenAppSLURLs); | 751 | mTrusted); |
756 | }; | 752 | } |
757 | }; | 753 | } |
758 | }; | 754 | } |
759 | 755 | ||
760 | // chain this event on to observers of an instance of LLWebBrowserCtrl | 756 | // chain this event on to observers of an instance of LLWebBrowserCtrl |
761 | LLWebBrowserCtrlEvent event( eventIn.getStringValue(), eventIn.getStringValueEx() ); | 757 | LLWebBrowserCtrlEvent event( eventIn.getStringValue(), eventIn.getStringValueEx() ); |
@@ -768,16 +764,14 @@ void LLWebBrowserCtrl::onClickLinkNoFollow( const EventType& eventIn ) | |||
768 | { | 764 | { |
769 | std::string url = eventIn.getStringValue(); | 765 | std::string url = eventIn.getStringValue(); |
770 | if (LLURLDispatcher::isSLURLCommand(url) | 766 | if (LLURLDispatcher::isSLURLCommand(url) |
771 | && !mOpenAppSLURLs) | 767 | && !mTrusted) |
772 | { | 768 | { |
773 | // block handling of this secondlife:///app/ URL | 769 | // block handling of this secondlife:///app/ URL |
774 | LLNotifyBox::showXml("UnableToOpenCommandURL"); | 770 | LLNotifications::instance().add("UnableToOpenCommandURL"); |
775 | |||
776 | return; | 771 | return; |
777 | } | 772 | } |
778 | 773 | ||
779 | const bool from_external_browser = false; | 774 | LLURLDispatcher::dispatch(url, this, mTrusted); |
780 | LLURLDispatcher::dispatch(url, from_external_browser); | ||
781 | 775 | ||
782 | // chain this event on to observers of an instance of LLWebBrowserCtrl | 776 | // chain this event on to observers of an instance of LLWebBrowserCtrl |
783 | LLWebBrowserCtrlEvent event( eventIn.getStringValue() ); | 777 | LLWebBrowserCtrlEvent event( eventIn.getStringValue() ); |