Back to index

lightning-sunbird  0.9+nobinonly
BrowserImplHistoryLstnr.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   David Epstein <depstein@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifdef _WINDOWS
00040   #include "stdafx.h"
00041 #endif
00042 #include "BrowserImpl.h"
00043 #include "IBrowserFrameGlue.h"
00044 
00045 #include "TestEmbed.h"
00046 #include "BrowserView.h"
00047 #include "BrowserFrm.h"
00048 
00049 #include "QaUtils.h"
00050 
00051 //*****************************************************************************
00052 // CBrowserImpl::nsIHistoryListener Implementation
00053 //*****************************************************************************   
00054 //
00055 // - Implements browser history listener methods. Activated through various events
00056 //      (i.e. forward, back, reload)
00057 //
00058 //     - Calls methods via the IBrowserFrameGlue interace 
00059 //       (available thru' the m_pBrowserFrameGlue member var)
00060 //       to do the actual statusbar/progress bar updates. 
00061 //
00062 
00063 class CBrowserView;
00064 
00065 
00066 //*****************************************************************************
00067 // CBrowserImpl::nsISHistoryListener methods
00068 //*****************************************************************************   
00069 
00070 NS_IMETHODIMP CBrowserImpl::OnHistoryNewEntry(nsIURI *theURI)
00071 {
00072        QAOutput("nsIHistoryListener::OnHistoryNewEntry()", 2);
00073     GetTheURI(theURI, 1);
00074        return NS_OK;
00075 }
00076 
00077 
00078 NS_IMETHODIMP CBrowserImpl::OnHistoryGoBack(nsIURI *theURI, PRBool *notify)
00079 {
00080        QAOutput("nsIHistoryListener::OnHistoryGoBack()", 2);
00081 
00082     GetTheURI(theURI, 1);
00083        *notify = PR_TRUE;
00084        FormatAndPrintOutput("OnHistoryGoBack() notification = ", *notify, 1);
00085 
00086        return NS_OK;
00087 }
00088 
00089 NS_IMETHODIMP CBrowserImpl::OnHistoryGoForward(nsIURI *theURI, PRBool *notify)
00090 {
00091        QAOutput("nsIHistoryListener::OnHistoryGoForward()", 2);
00092 
00093        GetTheURI(theURI, 1);
00094        *notify = PR_TRUE;
00095        FormatAndPrintOutput("OnHistoryGoForward() notification = ", *notify, 1);
00096 
00097        return NS_OK;
00098 }
00099 
00100 NS_IMETHODIMP CBrowserImpl::OnHistoryReload(nsIURI *theURI, PRUint32 reloadFlags, PRBool *notify)
00101 {
00102        char flagString[200];
00103 
00104        QAOutput("nsIHistoryListener::OnHistoryReload()", 2);
00105 
00106        GetTheURI(theURI, 1);
00107        *notify = PR_TRUE;
00108        FormatAndPrintOutput("OnHistoryReload() notification = ", *notify, 1);
00109 
00110        if (reloadFlags == 0x0000)
00111               strcpy(flagString, "LOAD_FLAGS_NONE");
00112        else if (reloadFlags == 0x0010)
00113               strcpy(flagString, "LOAD_FLAGS_IS_REFRESH");
00114        else if (reloadFlags == 0x0020)
00115               strcpy(flagString, "LOAD_FLAGS_IS_LINK");
00116        else if (reloadFlags == 0x0040)
00117               strcpy(flagString, "LOAD_FLAGS_BYPASS_HISTORY");
00118        else if (reloadFlags == 0x0080)
00119               strcpy(flagString, "LOAD_FLAGS_REPLACE_HISTORY");
00120        else if (reloadFlags == 0x0100)
00121               strcpy(flagString, "LOAD_FLAGS_BYPASS_CACHE");
00122        else if (reloadFlags == 0x0200)
00123               strcpy(flagString, "LOAD_FLAGS_BYPASS_PROXY");
00124        else if (reloadFlags == 0x0400)
00125               strcpy(flagString, "LOAD_FLAGS_CHARSET_CHANGE");
00126        else if (reloadFlags == (0x0100 | 0x0200))
00127               strcpy(flagString, "LOAD_FLAGS_BYPASS_CACHE | LOAD_FLAGS_BYPASS_PROXY");
00128 
00129        FormatAndPrintOutput("OnHistoryReload() flag value = ", reloadFlags, 1);
00130        FormatAndPrintOutput("OnHistoryReload() flag string = ", flagString, 2);
00131 
00132        return NS_OK;
00133 }
00134 
00135 NS_IMETHODIMP CBrowserImpl::OnHistoryGotoIndex(PRInt32 theIndex, nsIURI *theURI, PRBool *notify)
00136 {
00137        QAOutput("nsIHistoryListener::OnHistoryGotoIndex()", 2);
00138 
00139     GetTheURI(theURI, 1);
00140        *notify = PR_TRUE;
00141        FormatAndPrintOutput("OnHistoryGotoIndex() notification = ", *notify, 1);
00142 
00143        FormatAndPrintOutput("OnHistoryGotoIndex() index = ", theIndex, 2);
00144 
00145        return NS_OK;
00146 }
00147 
00148 NS_IMETHODIMP CBrowserImpl::OnHistoryPurge(PRInt32 theNumEntries, PRBool *notify)
00149 {
00150        QAOutput("nsIHistoryListener::OnHistoryPurge()", 2);
00151 
00152        *notify = PR_TRUE;
00153        FormatAndPrintOutput("OnHistoryPurge() notification = ", *notify, 1);
00154 
00155        FormatAndPrintOutput("OnHistoryPurge() theNumEntries = ", theNumEntries, 2);
00156 
00157        return NS_OK;
00158 }
00159