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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | #ifndef nsDocShellEditorData_h__ |
michael@0 | 7 | #define nsDocShellEditorData_h__ |
michael@0 | 8 | |
michael@0 | 9 | #ifndef nsCOMPtr_h___ |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | #endif |
michael@0 | 12 | |
michael@0 | 13 | #include "nsIHTMLDocument.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsIDocShell; |
michael@0 | 16 | class nsIEditingSession; |
michael@0 | 17 | class nsIEditor; |
michael@0 | 18 | |
michael@0 | 19 | class nsDocShellEditorData |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | |
michael@0 | 23 | nsDocShellEditorData(nsIDocShell* inOwningDocShell); |
michael@0 | 24 | ~nsDocShellEditorData(); |
michael@0 | 25 | |
michael@0 | 26 | nsresult MakeEditable(bool inWaitForUriLoad); |
michael@0 | 27 | bool GetEditable(); |
michael@0 | 28 | nsresult CreateEditor(); |
michael@0 | 29 | nsresult GetEditingSession(nsIEditingSession **outEditingSession); |
michael@0 | 30 | nsresult GetEditor(nsIEditor **outEditor); |
michael@0 | 31 | nsresult SetEditor(nsIEditor *inEditor); |
michael@0 | 32 | void TearDownEditor(); |
michael@0 | 33 | nsresult DetachFromWindow(); |
michael@0 | 34 | nsresult ReattachToWindow(nsIDocShell *aDocShell); |
michael@0 | 35 | bool WaitingForLoad() const { return mMakeEditable; } |
michael@0 | 36 | |
michael@0 | 37 | protected: |
michael@0 | 38 | |
michael@0 | 39 | nsresult EnsureEditingSession(); |
michael@0 | 40 | |
michael@0 | 41 | // The doc shell that owns us. Weak ref, since it always outlives us. |
michael@0 | 42 | nsIDocShell* mDocShell; |
michael@0 | 43 | |
michael@0 | 44 | // Only present for the content root docShell. Session is owned here. |
michael@0 | 45 | nsCOMPtr<nsIEditingSession> mEditingSession; |
michael@0 | 46 | |
michael@0 | 47 | // Indicates whether to make an editor after a url load. |
michael@0 | 48 | bool mMakeEditable; |
michael@0 | 49 | |
michael@0 | 50 | // If this frame is editable, store editor here. Editor is owned here. |
michael@0 | 51 | nsCOMPtr<nsIEditor> mEditor; |
michael@0 | 52 | |
michael@0 | 53 | // Denotes if the editor is detached from its window. The editor is detached |
michael@0 | 54 | // while it's stored in the session history bfcache. |
michael@0 | 55 | bool mIsDetached; |
michael@0 | 56 | |
michael@0 | 57 | // Backup for mMakeEditable while the editor is detached. |
michael@0 | 58 | bool mDetachedMakeEditable; |
michael@0 | 59 | |
michael@0 | 60 | // Backup for the corresponding nsIHTMLDocument's editing state while |
michael@0 | 61 | // the editor is detached. |
michael@0 | 62 | nsIHTMLDocument::EditingState mDetachedEditingState; |
michael@0 | 63 | |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | |
michael@0 | 67 | #endif // nsDocShellEditorData_h__ |