editor/libeditor/base/nsEditorCommands.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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 #ifndef nsIEditorCommand_h_
michael@0 7 #define nsIEditorCommand_h_
michael@0 8
michael@0 9 #include "nsIControllerCommand.h"
michael@0 10 #include "nsISupportsImpl.h"
michael@0 11 #include "nscore.h"
michael@0 12
michael@0 13 class nsICommandParams;
michael@0 14 class nsISupports;
michael@0 15
michael@0 16 // This is a virtual base class for commands registered with the editor controller.
michael@0 17 // Note that such commands can be shared by more than on editor instance, so
michael@0 18 // MUST be stateless. Any state must be stored via the refCon (an nsIEditor).
michael@0 19 class nsBaseEditorCommand : public nsIControllerCommand
michael@0 20 {
michael@0 21 public:
michael@0 22
michael@0 23 nsBaseEditorCommand();
michael@0 24 virtual ~nsBaseEditorCommand() {}
michael@0 25
michael@0 26 NS_DECL_ISUPPORTS
michael@0 27
michael@0 28 NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0;
michael@0 29 NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) = 0;
michael@0 30
michael@0 31 };
michael@0 32
michael@0 33
michael@0 34 #define NS_DECL_EDITOR_COMMAND(_cmd) \
michael@0 35 class _cmd : public nsBaseEditorCommand \
michael@0 36 { \
michael@0 37 public: \
michael@0 38 NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval); \
michael@0 39 NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon); \
michael@0 40 NS_IMETHOD DoCommandParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
michael@0 41 NS_IMETHOD GetCommandStateParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
michael@0 42 };
michael@0 43
michael@0 44
michael@0 45
michael@0 46 // basic editor commands
michael@0 47 NS_DECL_EDITOR_COMMAND(nsUndoCommand)
michael@0 48 NS_DECL_EDITOR_COMMAND(nsRedoCommand)
michael@0 49 NS_DECL_EDITOR_COMMAND(nsClearUndoCommand)
michael@0 50
michael@0 51 NS_DECL_EDITOR_COMMAND(nsCutCommand)
michael@0 52 NS_DECL_EDITOR_COMMAND(nsCutOrDeleteCommand)
michael@0 53 NS_DECL_EDITOR_COMMAND(nsCopyCommand)
michael@0 54 NS_DECL_EDITOR_COMMAND(nsCopyOrDeleteCommand)
michael@0 55 NS_DECL_EDITOR_COMMAND(nsPasteCommand)
michael@0 56 NS_DECL_EDITOR_COMMAND(nsPasteTransferableCommand)
michael@0 57 NS_DECL_EDITOR_COMMAND(nsSwitchTextDirectionCommand)
michael@0 58 NS_DECL_EDITOR_COMMAND(nsDeleteCommand)
michael@0 59 NS_DECL_EDITOR_COMMAND(nsSelectAllCommand)
michael@0 60
michael@0 61 NS_DECL_EDITOR_COMMAND(nsSelectionMoveCommands)
michael@0 62
michael@0 63 // Insert content commands
michael@0 64 NS_DECL_EDITOR_COMMAND(nsInsertPlaintextCommand)
michael@0 65 NS_DECL_EDITOR_COMMAND(nsPasteQuotationCommand)
michael@0 66
michael@0 67
michael@0 68 #if 0
michael@0 69 // template for new command
michael@0 70 NS_IMETHODIMP
michael@0 71 nsFooCommand::IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval)
michael@0 72 {
michael@0 73 return NS_ERROR_NOT_IMPLEMENTED;
michael@0 74 }
michael@0 75
michael@0 76
michael@0 77 NS_IMETHODIMP
michael@0 78 nsFooCommand::DoCommand(const char *aCommandName, const nsAString & aCommandParams, nsISupports *aCommandRefCon)
michael@0 79 {
michael@0 80 return NS_ERROR_NOT_IMPLEMENTED;
michael@0 81 }
michael@0 82
michael@0 83
michael@0 84 #endif
michael@0 85
michael@0 86 #endif // nsIEditorCommand_h_

mercurial