Sat, 03 Jan 2015 20:18:00 +0100
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.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsIEditorCommand_h_
7 #define nsIEditorCommand_h_
9 #include "nsIControllerCommand.h"
10 #include "nsISupportsImpl.h"
11 #include "nscore.h"
13 class nsICommandParams;
14 class nsISupports;
16 // This is a virtual base class for commands registered with the editor controller.
17 // Note that such commands can be shared by more than on editor instance, so
18 // MUST be stateless. Any state must be stored via the refCon (an nsIEditor).
19 class nsBaseEditorCommand : public nsIControllerCommand
20 {
21 public:
23 nsBaseEditorCommand();
24 virtual ~nsBaseEditorCommand() {}
26 NS_DECL_ISUPPORTS
28 NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0;
29 NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) = 0;
31 };
34 #define NS_DECL_EDITOR_COMMAND(_cmd) \
35 class _cmd : public nsBaseEditorCommand \
36 { \
37 public: \
38 NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval); \
39 NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon); \
40 NS_IMETHOD DoCommandParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
41 NS_IMETHOD GetCommandStateParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
42 };
46 // basic editor commands
47 NS_DECL_EDITOR_COMMAND(nsUndoCommand)
48 NS_DECL_EDITOR_COMMAND(nsRedoCommand)
49 NS_DECL_EDITOR_COMMAND(nsClearUndoCommand)
51 NS_DECL_EDITOR_COMMAND(nsCutCommand)
52 NS_DECL_EDITOR_COMMAND(nsCutOrDeleteCommand)
53 NS_DECL_EDITOR_COMMAND(nsCopyCommand)
54 NS_DECL_EDITOR_COMMAND(nsCopyOrDeleteCommand)
55 NS_DECL_EDITOR_COMMAND(nsPasteCommand)
56 NS_DECL_EDITOR_COMMAND(nsPasteTransferableCommand)
57 NS_DECL_EDITOR_COMMAND(nsSwitchTextDirectionCommand)
58 NS_DECL_EDITOR_COMMAND(nsDeleteCommand)
59 NS_DECL_EDITOR_COMMAND(nsSelectAllCommand)
61 NS_DECL_EDITOR_COMMAND(nsSelectionMoveCommands)
63 // Insert content commands
64 NS_DECL_EDITOR_COMMAND(nsInsertPlaintextCommand)
65 NS_DECL_EDITOR_COMMAND(nsPasteQuotationCommand)
68 #if 0
69 // template for new command
70 NS_IMETHODIMP
71 nsFooCommand::IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval)
72 {
73 return NS_ERROR_NOT_IMPLEMENTED;
74 }
77 NS_IMETHODIMP
78 nsFooCommand::DoCommand(const char *aCommandName, const nsAString & aCommandParams, nsISupports *aCommandRefCon)
79 {
80 return NS_ERROR_NOT_IMPLEMENTED;
81 }
84 #endif
86 #endif // nsIEditorCommand_h_