Show
Ignore:
Timestamp:
02/29/08 19:32:35 (2 years ago)
Author:
rob.linden
Message:

Latest internal snapshot
Last Changed Rev: 80909
Last Changed Date: 2008-02-27 15:08:55 -0800 (Wed, 27 Feb 2008)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/llmozlib2/llembeddedbrowserwindow.h

    r3 r8  
    1 /** 
    2  * @file llembeddedbrowserwindow.h 
    3  * @brief LLEmbeddedBrowserWindow and associated helpers declaration. 
    4  * 
    5  * $LicenseInfo:firstyear=2006&license=viewergpl$ 
    6  * 
    7  * Copyright (c) 2006-2007, Linden Research, Inc. 
    8  * 
    9  * Second Life Viewer Source Code 
    10  * The source code in this file ("Source Code") is provided by Linden Lab 
    11  * to you under the terms of the GNU General Public License, version 2.0 
    12  * ("GPL"), unless you have obtained a separate licensing agreement 
    13  * ("Other License"), formally executed by you and Linden Lab.  Terms of 
    14  * the GPL can be found in doc/GPL-license.txt in this distribution, or 
    15  * online at http://secondlife.com/developers/opensource/gplv2 
    16  * 
    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 
    19  * in the file doc/FLOSS-exception.txt in this software distribution, or 
    20  * online at http://secondlife.com/developers/opensource/flossexception 
    21  * 
    22  * By copying, modifying or distributing this software, you acknowledge 
    23  * that you have read and understood your obligations described above, 
    24  * and agree to abide by those obligations. 
    25  * 
    26  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 
    27  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 
    28  * COMPLETENESS OR PERFORMANCE. 
    29  * $/LicenseInfo$ 
    30  */ 
     1/* ***** BEGIN LICENSE BLOCK ***** 
     2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 
     3 * 
     4 * The contents of this file are subject to the Mozilla Public License Version 
     5 * 1.1 (the "License"); you may not use this file except in compliance with 
     6 * the License. You may obtain a copy of the License at 
     7 * http://www.mozilla.org/MPL/ 
     8 * 
     9 * Software distributed under the License is distributed on an "AS IS" basis, 
     10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
     11 * for the specific language governing rights and limitations under the 
     12 * License. 
     13 * 
     14 * The Original Code is Linden Lab Inc. (http://lindenlab.com) code. 
     15 * 
     16 * The Initial Developer of the Original Code is: 
     17 *   Callum Prentice (callum@ubrowser.com) 
     18 * 
     19 * Portions created by the Initial Developer are Copyright (C) 2006 
     20 * the Initial Developer. All Rights Reserved. 
     21 * 
     22 * Contributor(s): 
     23 *  Callum Prentice (callum@ubrowser.com) 
     24 * 
     25 * Alternatively, the contents of this file may be used under the terms of 
     26 * either the GNU General Public License Version 2 or later (the "GPL"), or 
     27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 
     28 * in which case the provisions of the GPL or the LGPL are applicable instead 
     29 * of those above. If you wish to allow use of your version of this file only 
     30 * under the terms of either the GPL or the LGPL, and not to allow others to 
     31 * use your version of this file under the terms of the MPL, indicate your 
     32 * decision by deleting the provisions above and replace them with the notice 
     33 * and other provisions required by the GPL or the LGPL. If you do not delete 
     34 * the provisions above, a recipient may use your version of this file under 
     35 * the terms of any one of the MPL, the GPL or the LGPL. 
     36 * 
     37 * ***** END LICENSE BLOCK ***** */ 
    3138 
    3239#ifndef LLEMBEDDEDBROWSERWINDOW_H 
     
    4855#include "nsWeakReference.h" 
    4956#include "nsIWebBrowser.h" 
     57#include "nsIToolkit.h" 
     58#include "nsIScriptGlobalObject.h" 
     59#include "nsIScriptGlobalObjectOwner.h" 
     60#include "nsIScriptContext.h" 
     61 
     62#ifdef WIN32 
     63#pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" 
     64#endif 
    5065 
    5166#include <string> 
     
    5368#include <algorithm> 
    5469 
    55 #include "llmozlib.h" 
     70#include "llmozlib2.h" 
    5671 
    5772/////////////////////////////////////////////////////////////////////////////// 
    58 // manages the process of sotring and emitting events that the consumer 
     73// manages the process of storing and emitting events that the consumer 
    5974// of the embedding class can observe 
    6075template< class T > 
     
    124139        public nsIURIContentListener, 
    125140        public nsSupportsWeakReference, 
    126         public nsIDOMEventListener 
     141        public nsIDOMEventListener, 
     142        public nsIToolkitObserver 
    127143{ 
    128144        public: 
     
    136152                NS_DECL_NSIURICONTENTLISTENER 
    137153                NS_DECL_NSIDOMEVENTLISTENER 
    138  
     154                NS_DECL_NSITOOLKITOBSERVER 
     155 
     156                // housekeeping 
    139157                nsresult createBrowser( void* nativeWindowHandleIn, PRInt32 widthIn, PRInt32 heightIn, nsIWebBrowser** aBrowser ); 
     158                void setParent( LLEmbeddedBrowser* parentIn ) { mParent = parentIn; }; 
    140159                PRBool setSize( PRInt16 widthIn, PRInt16 heightIn ); 
    141160                void focusBrowser( PRBool focusBrowserIn ); 
     
    144163                int getWindowId(); 
    145164 
     165                // random accessors 
    146166                const PRInt16 getPercentComplete(); 
    147167                const std::string& getStatusMsg(); 
    148168                const std::string& getCurrentUri(); 
    149169                const std::string& getClickLinkHref(); 
    150  
    151                 unsigned char* grabWindow(); 
     170                const std::string& getClickLinkTarget(); 
     171 
     172                // memory buffer management 
     173                unsigned char* grabWindow( int xIn, int yIn, int widthIn, int heightIn ); 
     174                PRBool flipWindow( PRBool flip ); 
    152175                unsigned char* getPageBuffer(); 
    153176                PRInt16 getBrowserWidth(); 
     
    156179                PRInt32 getBrowserRowSpan(); 
    157180 
    158                 void setBackgroundColor( PRUint8 redIn, PRUint8 greenIn, PRUint8 blueIn ); 
     181                // set background color that you see in between pages - default is white but sometimes useful to change 
     182                void setBackgroundColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ); 
     183 
     184                // change the caret color (we have different backgrounds to edit fields - black caret on black background == bad) 
    159185                void setCaretColor( const PRUint8 redIn, const PRUint8 greenIn, const PRUint8 blueIn ); 
    160186 
     187                // can turn off updates to a page - e.g. when it's hidden by your windowing system 
     188                void setEnabled( PRBool enabledIn ); 
     189 
     190                // navigation 
    161191                void navigateStop(); 
    162192                PRBool navigateTo( const std::string uriIn ); 
     
    166196                void navigateForward(); 
    167197 
     198                // javascript access/control 
     199                std::string evaluateJavascript( std::string scriptIn ); 
     200 
     201                // redirection when you hit a missing page 
    168202                bool set404RedirectUrl( std::string redirect_url ); 
    169203                bool clr404RedirectUrl(); 
    170204 
     205                // mouse & keyboard events 
    171206                void mouseDown( PRInt16 xPosIn, PRInt16 yPosIn ); 
    172207                void mouseUp( PRInt16 xPosIn, PRInt16 yPosIn ); 
     
    176211                void unicodeInput( PRUint32 uni_char ); 
    177212 
     213                // allow consumers of this class and to observe browser events 
    178214                bool addObserver( LLEmbeddedBrowserWindowObserver* observerIn ); 
    179215                bool remObserver( LLEmbeddedBrowserWindowObserver* observerIn ); 
     216 
     217                // accessor/mutator for scheme that browser doesn't follow - e.g. secondlife.com:// 
     218                void setNoFollowScheme( std::string schemeIn ); 
     219                std::string getNoFollowScheme(); 
    180220 
    181221        private: 
     
    183223                PRBool sendMozillaKeyboardEvent( PRUint32 keyIn, PRUint32 ns_vk_code ); 
    184224                PRBool renderCaret(); 
     225                PRBool enableToolkitObserver( PRBool enableIn ); 
     226 
    185227                LLEmbeddedBrowserWindowEmitter< LLEmbeddedBrowserWindowObserver > mEventEmitter; 
     228 
     229                LLEmbeddedBrowser* mParent; 
    186230                PRInt16 mPercentComplete; 
    187231                std::string mStatusText; 
    188232                std::string mCurrentUri; 
    189233                std::string mClickHref; 
    190                 std::string m404RedirectUrl
    191  
     234                std::string mClickTarget
     235                std::string mNoFollowScheme; 
    192236                nsCOMPtr< nsIWebBrowser > mWebBrowser; 
    193237                nsCOMPtr< nsIBaseWindow > mBaseWindow; 
    194238                nsCOMPtr< nsIWebNavigation > mWebNav; 
    195  
    196239                int mWindowId; 
    197  
    198                 PRUint8 mBackgroundRed; 
    199                 PRUint8 mBackgroundGreen; 
    200                 PRUint8 mBackgroundBlue; 
    201                 PRUint8 mCaretRed; 
    202                 PRUint8 mCaretGreen; 
    203                 PRUint8 mCaretBlue; 
    204  
    205240                unsigned char* mPageBuffer; 
    206                 size_t mPageBufferSize; 
     241                std::string m404RedirectUrl; 
     242                PRBool mEnabled; 
     243                PRBool mFlipBitmap; 
    207244                PRInt32 mBrowserRowSpan; 
    208245                PRInt16 mBrowserWidth; 
    209246                PRInt16 mBrowserHeight; 
    210247                PRInt16 mBrowserDepth; 
     248                PRUint8 mBkgRed; 
     249                PRUint8 mBkgGreen; 
     250                PRUint8 mBkgBlue; 
     251                PRUint8 mCaretRed; 
     252                PRUint8 mCaretGreen; 
     253                PRUint8 mCaretBlue; 
    211254}; 
    212255 
    213 #ifdef WIN32 
    214 #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" 
    215 #endif 
    216  
    217256#endif // LLEMBEDEDDBROWSERWINDOW_H