aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llwebbrowserctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llwebbrowserctrl.cpp')
-rw-r--r--linden/indra/newview/llwebbrowserctrl.cpp61
1 files changed, 53 insertions, 8 deletions
diff --git a/linden/indra/newview/llwebbrowserctrl.cpp b/linden/indra/newview/llwebbrowserctrl.cpp
index 5de0d43..ca03f48 100644
--- a/linden/indra/newview/llwebbrowserctrl.cpp
+++ b/linden/indra/newview/llwebbrowserctrl.cpp
@@ -34,14 +34,18 @@
34#if LL_LIBXUL_ENABLED 34#if LL_LIBXUL_ENABLED
35 35
36#include "llwebbrowserctrl.h" 36#include "llwebbrowserctrl.h"
37#include "llviewborder.h" 37
38#include "llviewerwindow.h" 38// viewer includes
39#include "llfloaterworldmap.h" 39#include "llfloaterworldmap.h"
40#include "llurldispatcher.h" 40#include "llurldispatcher.h"
41#include "llfocusmgr.h" 41#include "llviewborder.h"
42#include "llviewerwindow.h"
43#include "llfloaterhtml.h"
42#include "llweb.h" 44#include "llweb.h"
43#include "viewer.h" 45#include "viewer.h"
44#include "llpanellogin.h" 46
47// linden library includes
48#include "llfocusmgr.h"
45 49
46// Setting the mozilla buffer width to 2048 exactly doesn't work, since it pads its rowbytes a bit, pushing the texture width over 2048. 50// Setting the mozilla buffer width to 2048 exactly doesn't work, since it pads its rowbytes a bit, pushing the texture width over 2048.
47// 2000 should give enough headroom for any amount of padding it cares to add. 51// 2000 should give enough headroom for any amount of padding it cares to add.
@@ -55,7 +59,9 @@ LLWebBrowserCtrl::LLWebBrowserCtrl( const std::string& name, const LLRect& rect
55 mBorder(NULL), 59 mBorder(NULL),
56 mFrequentUpdates( true ), 60 mFrequentUpdates( true ),
57 mOpenLinksInExternalBrowser( false ), 61 mOpenLinksInExternalBrowser( false ),
58 mOpenSecondLifeLinksInMap( true ), 62 mOpenLinksInInternalBrowser( false ),
63 mOpenSLURLsInMap( true ),
64 mOpenSLURLsViaTeleport( false ),
59 mHomePageUrl( "" ), 65 mHomePageUrl( "" ),
60 mIgnoreUIScale( true ), 66 mIgnoreUIScale( true ),
61 mAlwaysRefresh( false ) 67 mAlwaysRefresh( false )
@@ -132,17 +138,31 @@ void LLWebBrowserCtrl::setBorderVisible( BOOL border_visible )
132}; 138};
133 139
134//////////////////////////////////////////////////////////////////////////////// 140////////////////////////////////////////////////////////////////////////////////
135// allows access to the raw web browser window by consumers of this class 141// set flag that forces the embedded browser to open links in the external system browser
136void LLWebBrowserCtrl::setOpenInExternalBrowser( bool valIn ) 142void LLWebBrowserCtrl::setOpenInExternalBrowser( bool valIn )
137{ 143{
138 mOpenLinksInExternalBrowser = valIn; 144 mOpenLinksInExternalBrowser = valIn;
139}; 145};
140 146
141//////////////////////////////////////////////////////////////////////////////// 147////////////////////////////////////////////////////////////////////////////////
148// set flag that forces the embedded browser to open links in the internal browser floater
149void LLWebBrowserCtrl::setOpenInInternalBrowser( bool valIn )
150{
151 mOpenLinksInInternalBrowser = valIn;
152};
153
154////////////////////////////////////////////////////////////////////////////////
142// open secondlife:// links in map automatically or not 155// open secondlife:// links in map automatically or not
143void LLWebBrowserCtrl::setOpenSecondLifeLinksInMap( bool valIn ) 156void LLWebBrowserCtrl::setOpenSLURLsInMap( bool valIn )
144{ 157{
145 mOpenSecondLifeLinksInMap = valIn; 158 mOpenSLURLsInMap = valIn;
159};
160
161////////////////////////////////////////////////////////////////////////////////
162// teleport directly to secondlife:// links
163void LLWebBrowserCtrl::setOpenSLURLsViaTeleport( bool valIn )
164{
165 mOpenSLURLsViaTeleport = valIn;
146}; 166};
147 167
148//////////////////////////////////////////////////////////////////////////////// 168////////////////////////////////////////////////////////////////////////////////
@@ -345,6 +365,7 @@ bool LLWebBrowserCtrl::canNavigateForward()
345void LLWebBrowserCtrl::navigateTo( std::string urlIn ) 365void LLWebBrowserCtrl::navigateTo( std::string urlIn )
346{ 366{
347 const std::string protocol( "secondlife://" ); 367 const std::string protocol( "secondlife://" );
368 const std::string protocol2( "sl://" );
348 369
349 // don't browse to anything that starts with secondlife:// 370 // don't browse to anything that starts with secondlife://
350 if ( urlIn.length() >= protocol.length() ) 371 if ( urlIn.length() >= protocol.length() )
@@ -354,6 +375,13 @@ void LLWebBrowserCtrl::navigateTo( std::string urlIn )
354 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn ); 375 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn );
355 } 376 }
356 } 377 }
378 else if ( urlIn.length() >= protocol2.length() )
379 {
380 if ( LLString::compareInsensitive( urlIn.substr( 0, protocol2.length() ).c_str(), protocol2.c_str() ) != 0 )
381 {
382 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn );
383 }
384 }
357 else 385 else
358 { 386 {
359 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn ); 387 LLMozLib::getInstance()->navigateTo( mEmbeddedBrowserWindowId, urlIn );
@@ -512,9 +540,26 @@ void LLWebBrowserCtrl::onClickLinkHref( const EventType& eventIn )
512 const std::string protocol( "http://" ); 540 const std::string protocol( "http://" );
513 541
514 if( mOpenLinksInExternalBrowser ) 542 if( mOpenLinksInExternalBrowser )
543 {
515 if ( eventIn.getStringValue().length() ) 544 if ( eventIn.getStringValue().length() )
545 {
516 if ( LLString::compareInsensitive( eventIn.getStringValue().substr( 0, protocol.length() ).c_str(), protocol.c_str() ) == 0 ) 546 if ( LLString::compareInsensitive( eventIn.getStringValue().substr( 0, protocol.length() ).c_str(), protocol.c_str() ) == 0 )
547 {
517 LLWeb::loadURL( eventIn.getStringValue() ); 548 LLWeb::loadURL( eventIn.getStringValue() );
549 };
550 };
551 }
552 else
553 if( mOpenLinksInInternalBrowser )
554 {
555 if ( eventIn.getStringValue().length() )
556 {
557 if ( LLString::compareInsensitive( eventIn.getStringValue().substr( 0, protocol.length() ).c_str(), protocol.c_str() ) == 0 )
558 {
559 LLFloaterHtml::getInstance()->show( eventIn.getStringValue(), "Second Life Browser");
560 };
561 };
562 };
518 563
519 // chain this event on to observers of an instance of LLWebBrowserCtrl 564 // chain this event on to observers of an instance of LLWebBrowserCtrl
520 LLWebBrowserCtrlEvent event( eventIn.getStringValue() ); 565 LLWebBrowserCtrlEvent event( eventIn.getStringValue() );