Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
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__
9 #ifndef nsCOMPtr_h___
10 #include "nsCOMPtr.h"
11 #endif
13 #include "nsIHTMLDocument.h"
15 class nsIDocShell;
16 class nsIEditingSession;
17 class nsIEditor;
19 class nsDocShellEditorData
20 {
21 public:
23 nsDocShellEditorData(nsIDocShell* inOwningDocShell);
24 ~nsDocShellEditorData();
26 nsresult MakeEditable(bool inWaitForUriLoad);
27 bool GetEditable();
28 nsresult CreateEditor();
29 nsresult GetEditingSession(nsIEditingSession **outEditingSession);
30 nsresult GetEditor(nsIEditor **outEditor);
31 nsresult SetEditor(nsIEditor *inEditor);
32 void TearDownEditor();
33 nsresult DetachFromWindow();
34 nsresult ReattachToWindow(nsIDocShell *aDocShell);
35 bool WaitingForLoad() const { return mMakeEditable; }
37 protected:
39 nsresult EnsureEditingSession();
41 // The doc shell that owns us. Weak ref, since it always outlives us.
42 nsIDocShell* mDocShell;
44 // Only present for the content root docShell. Session is owned here.
45 nsCOMPtr<nsIEditingSession> mEditingSession;
47 // Indicates whether to make an editor after a url load.
48 bool mMakeEditable;
50 // If this frame is editable, store editor here. Editor is owned here.
51 nsCOMPtr<nsIEditor> mEditor;
53 // Denotes if the editor is detached from its window. The editor is detached
54 // while it's stored in the session history bfcache.
55 bool mIsDetached;
57 // Backup for mMakeEditable while the editor is detached.
58 bool mDetachedMakeEditable;
60 // Backup for the corresponding nsIHTMLDocument's editing state while
61 // the editor is detached.
62 nsIHTMLDocument::EditingState mDetachedEditingState;
64 };
67 #endif // nsDocShellEditorData_h__