Back to index

lightning-sunbird  0.9+nobinonly
nsDocShellLoadTypes.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  * vim: set ts=4 sw=4 et tw=80:
00003  *
00004  * ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is the Mozilla browser.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications, Inc.
00021  * Portions created by the Initial Developer are Copyright (C) 1999
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *   Travis Bogard <travis@netscape.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef nsDocShellLoadTypes_h_
00042 #define nsDocShellLoadTypes_h_
00043 
00044 #ifdef MOZILLA_INTERNAL_API
00045 
00046 #include "nsIDocShell.h"
00047 #include "nsIWebNavigation.h"
00048 
00053 #define LOAD_FLAGS_ERROR_PAGE 0x8000U
00054 
00055 #define MAKE_LOAD_TYPE(type, flags) ((type) | ((flags) << 16))
00056 #define LOAD_TYPE_HAS_FLAGS(type, flags) ((type) & ((flags) << 16))
00057 
00058 /* load types are legal combinations of load commands and flags 
00059  *  
00060  * NOTE:
00061  *  Remember to update the IsValidLoadType function below if you change this
00062  *  enum to ensure bad flag combinations will be rejected.
00063  */
00064 enum LoadType {
00065     LOAD_NORMAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_NONE),
00066     LOAD_NORMAL_REPLACE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY),
00067     LOAD_NORMAL_EXTERNAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_FROM_EXTERNAL),
00068     LOAD_HISTORY = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_HISTORY, nsIWebNavigation::LOAD_FLAGS_NONE),
00069     LOAD_RELOAD_NORMAL = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_NONE),
00070     LOAD_RELOAD_BYPASS_CACHE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE),
00071     LOAD_RELOAD_BYPASS_PROXY = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY),
00072     LOAD_RELOAD_BYPASS_PROXY_AND_CACHE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY),
00073     LOAD_LINK = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_IS_LINK),
00074     LOAD_REFRESH = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_IS_REFRESH),
00075     LOAD_RELOAD_CHARSET_CHANGE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_RELOAD, nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE),
00076     LOAD_BYPASS_HISTORY = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_BYPASS_HISTORY),
00077     LOAD_STOP_CONTENT = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_STOP_CONTENT),
00078     LOAD_STOP_CONTENT_AND_REPLACE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, nsIWebNavigation::LOAD_FLAGS_STOP_CONTENT | nsIWebNavigation::LOAD_FLAGS_REPLACE_HISTORY),
00084     LOAD_ERROR_PAGE = MAKE_LOAD_TYPE(nsIDocShell::LOAD_CMD_NORMAL, LOAD_FLAGS_ERROR_PAGE)
00085 
00086     // NOTE: Adding a new value? Remember to update IsValidLoadType!
00087 };
00088 static inline PRBool IsValidLoadType(PRUint32 aLoadType)
00089 {
00090     switch (aLoadType)
00091     {
00092     case LOAD_NORMAL:
00093     case LOAD_NORMAL_REPLACE:
00094     case LOAD_NORMAL_EXTERNAL:
00095     case LOAD_HISTORY:
00096     case LOAD_RELOAD_NORMAL:
00097     case LOAD_RELOAD_BYPASS_CACHE:
00098     case LOAD_RELOAD_BYPASS_PROXY:
00099     case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
00100     case LOAD_LINK:
00101     case LOAD_REFRESH:
00102     case LOAD_RELOAD_CHARSET_CHANGE:
00103     case LOAD_BYPASS_HISTORY:
00104     case LOAD_STOP_CONTENT:
00105     case LOAD_STOP_CONTENT_AND_REPLACE:
00106     case LOAD_ERROR_PAGE:
00107         return PR_TRUE;
00108     }
00109     return PR_FALSE;
00110 }
00111 
00112 #endif // MOZILLA_INTERNAL_API
00113 #endif