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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | #include "domstubs.idl" |
michael@0 | 8 | |
michael@0 | 9 | interface nsIEditor; |
michael@0 | 10 | |
michael@0 | 11 | [scriptable, uuid(24f3f4da-18a4-448d-876d-7360fefac029)] |
michael@0 | 12 | |
michael@0 | 13 | interface nsIEditingSession : nsISupports |
michael@0 | 14 | { |
michael@0 | 15 | /** |
michael@0 | 16 | * Error codes when we fail to create an editor |
michael@0 | 17 | * is placed in attribute editorStatus |
michael@0 | 18 | */ |
michael@0 | 19 | const long eEditorOK = 0; |
michael@0 | 20 | const long eEditorCreationInProgress = 1; |
michael@0 | 21 | const long eEditorErrorCantEditMimeType = 2; |
michael@0 | 22 | const long eEditorErrorFileNotFound = 3; |
michael@0 | 23 | const long eEditorErrorCantEditFramesets = 8; |
michael@0 | 24 | const long eEditorErrorUnknown = 9; |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * Status after editor creation and document loading |
michael@0 | 28 | * Value is one of the above error codes |
michael@0 | 29 | */ |
michael@0 | 30 | readonly attribute unsigned long editorStatus; |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * Make this window editable |
michael@0 | 34 | * @param aWindow nsIDOMWindow, the window the embedder needs to make editable |
michael@0 | 35 | * @param aEditorType string, "html" "htmlsimple" "text" "textsimple" |
michael@0 | 36 | * @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in |
michael@0 | 37 | * aWindow editable, otherwise it's the |
michael@0 | 38 | * embedder who should make the document |
michael@0 | 39 | * (or part of it) editable. |
michael@0 | 40 | * @param aInteractive if PR_FALSE turn off scripting and plugins |
michael@0 | 41 | */ |
michael@0 | 42 | void makeWindowEditable(in nsIDOMWindow window, in string aEditorType, |
michael@0 | 43 | in boolean doAfterUriLoad, |
michael@0 | 44 | in boolean aMakeWholeDocumentEditable, |
michael@0 | 45 | in boolean aInteractive); |
michael@0 | 46 | |
michael@0 | 47 | /** |
michael@0 | 48 | * Test whether a specific window has had its editable flag set; it may have an editor |
michael@0 | 49 | * now, or will get one after the uri load. |
michael@0 | 50 | * |
michael@0 | 51 | * Use this, passing the content root window, to test if we've set up editing |
michael@0 | 52 | * for this content. |
michael@0 | 53 | */ |
michael@0 | 54 | boolean windowIsEditable(in nsIDOMWindow window); |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Get the editor for this window. May return null |
michael@0 | 58 | */ |
michael@0 | 59 | nsIEditor getEditorForWindow(in nsIDOMWindow window); |
michael@0 | 60 | |
michael@0 | 61 | /** |
michael@0 | 62 | * Setup editor and related support objects |
michael@0 | 63 | */ |
michael@0 | 64 | void setupEditorOnWindow(in nsIDOMWindow window); |
michael@0 | 65 | |
michael@0 | 66 | /** |
michael@0 | 67 | * Destroy editor and related support objects |
michael@0 | 68 | */ |
michael@0 | 69 | void tearDownEditorOnWindow(in nsIDOMWindow window); |
michael@0 | 70 | |
michael@0 | 71 | void setEditorOnControllers(in nsIDOMWindow aWindow, |
michael@0 | 72 | in nsIEditor aEditor); |
michael@0 | 73 | |
michael@0 | 74 | /** |
michael@0 | 75 | * Disable scripts and plugins in aWindow. |
michael@0 | 76 | */ |
michael@0 | 77 | void disableJSAndPlugins(in nsIDOMWindow aWindow); |
michael@0 | 78 | |
michael@0 | 79 | /** |
michael@0 | 80 | * Restore JS and plugins (enable/disable them) according to the state they |
michael@0 | 81 | * were before the last call to disableJSAndPlugins. |
michael@0 | 82 | */ |
michael@0 | 83 | void restoreJSAndPlugins(in nsIDOMWindow aWindow); |
michael@0 | 84 | |
michael@0 | 85 | /** |
michael@0 | 86 | * Removes all the editor's controllers/listeners etc and makes the window |
michael@0 | 87 | * uneditable. |
michael@0 | 88 | */ |
michael@0 | 89 | void detachFromWindow(in nsIDOMWindow aWindow); |
michael@0 | 90 | |
michael@0 | 91 | /** |
michael@0 | 92 | * Undos detachFromWindow(), reattaches this editing session/editor |
michael@0 | 93 | * to the window. |
michael@0 | 94 | */ |
michael@0 | 95 | void reattachToWindow(in nsIDOMWindow aWindow); |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * Whether this session has disabled JS and plugins. |
michael@0 | 99 | */ |
michael@0 | 100 | readonly attribute boolean jsAndPluginsDisabled; |
michael@0 | 101 | }; |
michael@0 | 102 |