1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Netscape Public License
6
* Version 1.1 (the "License"); you may not use this file except in
7
* compliance with the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/NPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is mozilla.org code.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 2002
20
* the Initial Developer. All Rights Reserved.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the NPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the NPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
38
#ifndef nsDummyLayoutRequest_h__
39
#define nsDummyLayoutRequest_h__
41
#include "nsIChannel.h"
42
#include "nsILoadGroup.h"
43
#include "nsNetUtil.h"
44
#include "nsWeakPtr.h"
46
//----------------------------------------------------------------------
50
// This is a dummy request implementation that we add to the document's load
51
// group. It ensures that EndDocumentLoad() in the docshell doesn't fire
52
// before we've finished all of layout.
55
class nsDummyLayoutRequest : public nsIChannel
58
nsDummyLayoutRequest(nsIPresShell* aPresShell);
59
virtual ~nsDummyLayoutRequest();
61
static PRInt32 gRefCnt;
64
nsCOMPtr<nsILoadGroup> mLoadGroup;
69
Create(nsIRequest** aResult, nsIPresShell* aPresShell);
74
NS_IMETHOD GetName(nsACString &result) {
75
result = NS_LITERAL_CSTRING("about:layout-dummy-request");
78
NS_IMETHOD IsPending(PRBool *_retval) { *_retval = PR_TRUE; return NS_OK; }
79
NS_IMETHOD GetStatus(nsresult *status) { *status = NS_OK; return NS_OK; }
80
NS_IMETHOD Cancel(nsresult status);
81
NS_IMETHOD Suspend(void) { return NS_OK; }
82
NS_IMETHOD Resume(void) { return NS_OK; }
83
NS_IMETHOD GetLoadGroup(nsILoadGroup * *aLoadGroup) { *aLoadGroup = mLoadGroup; NS_IF_ADDREF(*aLoadGroup); return NS_OK; }
84
NS_IMETHOD SetLoadGroup(nsILoadGroup * aLoadGroup) { mLoadGroup = aLoadGroup; return NS_OK; }
85
NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags) { *aLoadFlags = nsIRequest::LOAD_NORMAL; return NS_OK; }
86
NS_IMETHOD SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; }
89
NS_IMETHOD GetOriginalURI(nsIURI* *aOriginalURI) { *aOriginalURI = gURI; NS_ADDREF(*aOriginalURI); return NS_OK; }
90
NS_IMETHOD SetOriginalURI(nsIURI* aOriginalURI) { gURI = aOriginalURI; NS_ADDREF(gURI); return NS_OK; }
91
NS_IMETHOD GetURI(nsIURI* *aURI) { *aURI = gURI; NS_ADDREF(*aURI); return NS_OK; }
92
NS_IMETHOD SetURI(nsIURI* aURI) { gURI = aURI; NS_ADDREF(gURI); return NS_OK; }
93
NS_IMETHOD Open(nsIInputStream **_retval) { *_retval = nsnull; return NS_OK; }
94
NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) { return NS_OK; }
95
NS_IMETHOD GetOwner(nsISupports * *aOwner) { *aOwner = nsnull; return NS_OK; }
96
NS_IMETHOD SetOwner(nsISupports * aOwner) { return NS_OK; }
97
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) { *aNotificationCallbacks = nsnull; return NS_OK; }
98
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) { return NS_OK; }
99
NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { *aSecurityInfo = nsnull; return NS_OK; }
100
NS_IMETHOD GetContentType(nsACString &aContentType) { aContentType.Truncate(); return NS_OK; }
101
NS_IMETHOD SetContentType(const nsACString &aContentType) { return NS_OK; }
102
NS_IMETHOD GetContentCharset(nsACString &aContentCharset) { aContentCharset.Truncate(); return NS_OK; }
103
NS_IMETHOD SetContentCharset(const nsACString &aContentCharset) { return NS_OK; }
104
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return NS_OK; }
105
NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return NS_OK; }