docshell/base/nsDocShellEditorData.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/base/nsDocShellEditorData.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +#ifndef nsDocShellEditorData_h__
    1.10 +#define nsDocShellEditorData_h__
    1.11 +
    1.12 +#ifndef nsCOMPtr_h___
    1.13 +#include "nsCOMPtr.h"
    1.14 +#endif
    1.15 +
    1.16 +#include "nsIHTMLDocument.h"
    1.17 +
    1.18 +class nsIDocShell;
    1.19 +class nsIEditingSession;
    1.20 +class nsIEditor;
    1.21 +
    1.22 +class nsDocShellEditorData
    1.23 +{
    1.24 +public:
    1.25 +
    1.26 +  nsDocShellEditorData(nsIDocShell* inOwningDocShell);
    1.27 +  ~nsDocShellEditorData();
    1.28 +
    1.29 +  nsresult MakeEditable(bool inWaitForUriLoad);
    1.30 +  bool GetEditable();
    1.31 +  nsresult CreateEditor();
    1.32 +  nsresult GetEditingSession(nsIEditingSession **outEditingSession);
    1.33 +  nsresult GetEditor(nsIEditor **outEditor);
    1.34 +  nsresult SetEditor(nsIEditor *inEditor);
    1.35 +  void TearDownEditor();
    1.36 +  nsresult DetachFromWindow();
    1.37 +  nsresult ReattachToWindow(nsIDocShell *aDocShell);
    1.38 +  bool WaitingForLoad() const { return mMakeEditable; }
    1.39 +
    1.40 +protected:
    1.41 +
    1.42 +  nsresult EnsureEditingSession();
    1.43 +
    1.44 +  // The doc shell that owns us. Weak ref, since it always outlives us.  
    1.45 +  nsIDocShell* mDocShell;
    1.46 +
    1.47 +  // Only present for the content root docShell. Session is owned here.
    1.48 +  nsCOMPtr<nsIEditingSession> mEditingSession;
    1.49 +
    1.50 +  // Indicates whether to make an editor after a url load.
    1.51 +  bool mMakeEditable;
    1.52 +  
    1.53 +  // If this frame is editable, store editor here. Editor is owned here.
    1.54 +  nsCOMPtr<nsIEditor> mEditor;
    1.55 +
    1.56 +  // Denotes if the editor is detached from its window. The editor is detached
    1.57 +  // while it's stored in the session history bfcache.
    1.58 +  bool mIsDetached;
    1.59 +
    1.60 +  // Backup for mMakeEditable while the editor is detached.
    1.61 +  bool mDetachedMakeEditable;
    1.62 +
    1.63 +  // Backup for the corresponding nsIHTMLDocument's  editing state while
    1.64 +  // the editor is detached.
    1.65 +  nsIHTMLDocument::EditingState mDetachedEditingState;
    1.66 +
    1.67 +};
    1.68 +
    1.69 +
    1.70 +#endif // nsDocShellEditorData_h__

mercurial