1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsDocShellEditorData_h__
7 #define nsDocShellEditorData_h__
13 #ifndef __gen_nsIDocShell_h__
14 #include "nsIDocShell.h"
17 #ifndef __gen_nsIEditingSession_h__
18 #include "nsIEditingSession.h"
22 #include "nsIHTMLDocument.h"
23 #include "nsIEditor.h"
27 class nsDocShellEditorData
31 nsDocShellEditorData(nsIDocShell
* inOwningDocShell
);
32 ~nsDocShellEditorData();
34 nsresult
MakeEditable(bool inWaitForUriLoad
);
36 nsresult
CreateEditor();
37 nsresult
GetEditingSession(nsIEditingSession
**outEditingSession
);
38 nsresult
GetEditor(nsIEditor
**outEditor
);
39 nsresult
SetEditor(nsIEditor
*inEditor
);
40 void TearDownEditor();
41 nsresult
DetachFromWindow();
42 nsresult
ReattachToWindow(nsIDocShell
*aDocShell
);
43 bool WaitingForLoad() const { return mMakeEditable
; }
47 nsresult
EnsureEditingSession();
49 // The doc shell that owns us. Weak ref, since it always outlives us.
50 nsIDocShell
* mDocShell
;
52 // Only present for the content root docShell. Session is owned here.
53 nsCOMPtr
<nsIEditingSession
> mEditingSession
;
55 // Indicates whether to make an editor after a url load.
58 // If this frame is editable, store editor here. Editor is owned here.
59 nsCOMPtr
<nsIEditor
> mEditor
;
61 // Denotes if the editor is detached from its window. The editor is detached
62 // while it's stored in the session history bfcache.
65 // Backup for mMakeEditable while the editor is detached.
66 bool mDetachedMakeEditable
;
68 // Backup for the corresponding nsIHTMLDocument's editing state while
69 // the editor is detached.
70 nsIHTMLDocument::EditingState mDetachedEditingState
;
75 #endif // nsDocShellEditorData_h__