This commit was manufactured by cvs2svn to create branch
'MOZILLA_1_7_BRANCH'. git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_7_BRANCH@161880 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
35
mozilla/content/xbl/builtin/gtk2/Makefile.in
Normal file
35
mozilla/content/xbl/builtin/gtk2/Makefile.in
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs:: $(TARGETS)
|
||||
$(INSTALL) $(srcdir)/platformHTMLBindings.xml $(DIST)/bin/res/builtin
|
||||
|
||||
install:: platformHTMLBindings.xml
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/res/builtin
|
||||
110
mozilla/content/xbl/builtin/gtk2/platformHTMLBindings.xml
Normal file
110
mozilla/content/xbl/builtin/gtk2/platformHTMLBindings.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="htmlBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="inputFields">
|
||||
<handlers>
|
||||
<handler event="keypress" key="a" modifiers="alt"
|
||||
command="cmd_selectAll"/>
|
||||
<handler event="keypress" key="y" modifiers="accel"
|
||||
command="cmd_redo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="textAreas">
|
||||
<handlers>
|
||||
<handler event="keypress" key="a" modifiers="alt"
|
||||
command="cmd_selectAll"/>
|
||||
<handler event="keypress" key="y" modifiers="accel"
|
||||
command="cmd_redo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="browser">
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
|
||||
|
||||
<handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
|
||||
<handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" />
|
||||
<handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" />
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" />
|
||||
<handler event="keypress" keycode="VK_RIGHT" modifiers="control,shift" command="cmd_selectWordNext" />
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectCharPrevious" />
|
||||
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectCharNext" />
|
||||
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
|
||||
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
|
||||
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectLinePrevious" />
|
||||
<handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectLineNext" />
|
||||
<handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="editor">
|
||||
<handlers>
|
||||
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
|
||||
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
|
||||
<handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
|
||||
<handler event="keypress" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
|
||||
<handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
|
||||
<handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
|
||||
<handler event="keypress" key="b" modifiers="control" command="cmd_charPrevious"/>
|
||||
<handler event="keypress" key="f" modifiers="control" command="cmd_charNext"/>
|
||||
<handler event="keypress" key="p" modifiers="control" command="cmd_linePrevious"/>
|
||||
<handler event="keypress" key="n" modifiers="control" command="cmd_lineNext"/>
|
||||
<handler event="keypress" key="x" modifiers="control" command="cmd_cut"/>
|
||||
<handler event="keypress" key="c" modifiers="control" command="cmd_copy"/>
|
||||
<handler event="keypress" key="v" modifiers="control" command="cmd_paste"/>
|
||||
<handler event="keypress" key="z" modifiers="control" command="cmd_undo"/>
|
||||
<handler event="keypress" key="r" modifiers="accel" command="cmd_redo"/>
|
||||
<handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
|
||||
<handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
|
||||
<handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/>
|
||||
<handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_copyOrDelete"/>
|
||||
<handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>
|
||||
<handler event="keypress" keycode="VK_INSERT" modifiers="shift" command="cmd_paste"/>
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/>
|
||||
<handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/>
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/>
|
||||
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/>
|
||||
<handler event="keypress" keycode="VK_BACK" modifiers="control" command="cmd_deleteWordBackward"/>
|
||||
<handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
|
||||
<handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
|
||||
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
|
||||
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
|
||||
<handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop"/>
|
||||
<handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom"/>
|
||||
<handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
|
||||
<handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
84
mozilla/intl/locale/idl/nsICollation.idl
Normal file
84
mozilla/intl/locale/idl/nsICollation.idl
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsILocale.idl"
|
||||
|
||||
interface nsICollation;
|
||||
|
||||
[scriptable, uuid(04971e14-d6b3-4ada-8cbb-c3a13842b349)]
|
||||
interface nsICollationFactory : nsISupports {
|
||||
nsICollation CreateCollation(in nsILocale locale);
|
||||
};
|
||||
|
||||
[scriptable, uuid(b0132cc0-3786-4557-9874-910d7def5f93)]
|
||||
interface nsICollation : nsISupports {
|
||||
|
||||
// use the primary comparison for the given local - no flags
|
||||
const long kCollationStrengthDefault = 0;
|
||||
|
||||
// do not consider case differences when doing the comparison i.e. A=a)
|
||||
const long kCollationCaseInsensitiveAscii = 1;
|
||||
|
||||
// do not consider accent differences when doing the comparison a=á)
|
||||
const long kCollationAccentInsenstive = 2;
|
||||
|
||||
// case sensitive collation (default)
|
||||
const long kCollationCaseSensitive = kCollationStrengthDefault;
|
||||
|
||||
// case insensitive collation
|
||||
const long kCollationCaseInSensitive = (kCollationCaseInsensitiveAscii | kCollationAccentInsenstive);
|
||||
|
||||
// init this interface to a specified locale (should only be called by collation factory)
|
||||
void initialize(in nsILocale locale);
|
||||
|
||||
// compare two strings
|
||||
// result is same as strcmp
|
||||
long compareString(in long strength, in AString string1, in AString string2);
|
||||
|
||||
// allocate sort key from input string
|
||||
// returns newly allocated key, and its band its byte length
|
||||
[noscript] void allocateRawSortKey(in long strength,
|
||||
in AString stringIn,
|
||||
[array,size_is(outLen)] out octet key,
|
||||
out unsigned long outLen);
|
||||
|
||||
// compare two sort keys
|
||||
// length is a byte length, result is same as strcmp
|
||||
[noscript] long compareRawSortKey([const,array,size_is(len1)] in octet key1, in unsigned long len1,
|
||||
[const,array,size_is(len2)] in octet key2, in unsigned long len2);
|
||||
|
||||
};
|
||||
397
mozilla/modules/plugin/base/public/npruntime.h
Normal file
397
mozilla/modules/plugin/base/public/npruntime.h
Normal file
@@ -0,0 +1,397 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* Copyright © 2004, Apple Computer, Inc. and The Mozilla Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
|
||||
* Foundation ("Mozilla") nor the names of their contributors may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
|
||||
* THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Revision 1 (March 4, 2004):
|
||||
* Initial proposal.
|
||||
*
|
||||
* Revision 2 (March 10, 2004):
|
||||
* All calls into script were made asynchronous. Results are
|
||||
* provided via the NPScriptResultFunctionPtr callback.
|
||||
*
|
||||
* Revision 3 (March 10, 2004):
|
||||
* Corrected comments to not refer to class retain/release FunctionPtrs.
|
||||
*
|
||||
* Revision 4 (March 11, 2004):
|
||||
* Added additional convenience NPN_SetExceptionWithUTF8().
|
||||
* Changed NPHasPropertyFunctionPtr and NPHasMethodFunctionPtr to take NPClass
|
||||
* pointers instead of NPObject pointers.
|
||||
* Added NPIsValidIdentifier().
|
||||
*
|
||||
* Revision 5 (March 17, 2004):
|
||||
* Added context parameter to result callbacks from ScriptObject functions.
|
||||
*
|
||||
* Revision 6 (March 29, 2004):
|
||||
* Renamed functions implemented by user agent to NPN_*. Removed _ from
|
||||
* type names.
|
||||
* Renamed "JavaScript" types to "Script".
|
||||
*
|
||||
* Revision 7 (April 21, 2004):
|
||||
* NPIdentifier becomes a void*, was int32_t
|
||||
* Remove NP_IsValidIdentifier, renamed NP_IdentifierFromUTF8 to NP_GetIdentifier
|
||||
* Added NPVariant and modified functions to use this new type.
|
||||
*
|
||||
* Revision 8 (July 9, 2004):
|
||||
* Updated to joint Apple-Mozilla license.
|
||||
*
|
||||
*/
|
||||
#ifndef _NP_RUNTIME_H_
|
||||
#define _NP_RUNTIME_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "nptypes.h"
|
||||
|
||||
/*
|
||||
This API is used to facilitate binding code written in C to script
|
||||
objects. The API in this header does not assume the presence of a
|
||||
user agent. That is, it can be used to bind C code to scripting
|
||||
environments outside of the context of a user agent.
|
||||
|
||||
However, the normal use of the this API is in the context of a
|
||||
scripting environment running in a browser or other user agent.
|
||||
In particular it is used to support the extended Netscape
|
||||
script-ability API for plugins (NP-SAP). NP-SAP is an extension
|
||||
of the Netscape plugin API. As such we have adopted the use of
|
||||
the "NP" prefix for this API.
|
||||
|
||||
The following NP{N|P}Variables were added to the Netscape plugin
|
||||
API (in npapi.h):
|
||||
|
||||
NPNVWindowNPObject
|
||||
NPNVPluginElementNPObject
|
||||
NPPVpluginScriptableNPObject
|
||||
|
||||
These variables are exposed through NPN_GetValue() and
|
||||
NPP_GetValue() (respectively) and are used to establish the
|
||||
initial binding between the user agent and native code. The DOM
|
||||
objects in the user agent can be examined and manipulated using
|
||||
the NPN_ functions that operate on NPObjects described in this
|
||||
header.
|
||||
|
||||
To the extent possible the assumptions about the scripting
|
||||
language used by the scripting environment have been minimized.
|
||||
*/
|
||||
|
||||
#define NP_BEGIN_MACRO do {
|
||||
#define NP_END_MACRO } while (0)
|
||||
|
||||
/*
|
||||
Objects (non-primitive data) passed between 'C' and script is
|
||||
always wrapped in an NPObject. The 'interface' of an NPObject is
|
||||
described by an NPClass.
|
||||
*/
|
||||
typedef struct NPObject NPObject;
|
||||
typedef struct NPClass NPClass;
|
||||
|
||||
typedef char NPUTF8;
|
||||
typedef struct _NPString {
|
||||
const NPUTF8 *utf8characters;
|
||||
uint32_t utf8length;
|
||||
} NPString;
|
||||
|
||||
typedef enum {
|
||||
NPVariantType_Void,
|
||||
NPVariantType_Null,
|
||||
NPVariantType_Bool,
|
||||
NPVariantType_Int32,
|
||||
NPVariantType_Double,
|
||||
NPVariantType_String,
|
||||
NPVariantType_Object
|
||||
} NPVariantType;
|
||||
|
||||
typedef struct _NPVariant {
|
||||
NPVariantType type;
|
||||
union {
|
||||
bool boolValue;
|
||||
uint32_t intValue;
|
||||
double doubleValue;
|
||||
NPString stringValue;
|
||||
NPObject *objectValue;
|
||||
} value;
|
||||
} NPVariant;
|
||||
|
||||
/*
|
||||
NPN_ReleaseVariantValue is called on all 'out' parameters
|
||||
references. Specifically it is to be called on variants that own
|
||||
their value, as is the case with all non-const NPVariant*
|
||||
arguments after a successful call to any methods (except this one)
|
||||
in this API.
|
||||
|
||||
After calling NPN_ReleaseVariantValue, the type of the variant
|
||||
will be NPVariantType_Void.
|
||||
*/
|
||||
void NPN_ReleaseVariantValue(NPVariant *variant);
|
||||
|
||||
#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void)
|
||||
#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null)
|
||||
#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
|
||||
#define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32)
|
||||
#define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double)
|
||||
#define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String)
|
||||
#define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object)
|
||||
|
||||
#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
|
||||
#define NPVARIANT_TO_INT32(_v) ((_v).value.intValue)
|
||||
#define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue)
|
||||
#define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue)
|
||||
#define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue)
|
||||
|
||||
#define VOID_TO_NPVARIANT(_v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_Void; \
|
||||
(_v).value.objectValue = NULL; \
|
||||
NP_END_MACRO
|
||||
|
||||
#define NULL_TO_NPVARIANT(_v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_Null; \
|
||||
(_v).value.objectValue = NULL; \
|
||||
NP_END_MACRO
|
||||
|
||||
#define BOOLEAN_TO_NPVARIANT(_val, _v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_Bool; \
|
||||
(_v).value.boolValue = !!(_val); \
|
||||
NP_END_MACRO
|
||||
|
||||
#define INT32_TO_NPVARIANT(_val, _v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_Int32; \
|
||||
(_v).value.intValue = _val; \
|
||||
NP_END_MACRO
|
||||
|
||||
#define DOUBLE_TO_NPVARIANT(_val, _v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_Double; \
|
||||
(_v).value.doubleValue = _val; \
|
||||
NP_END_MACRO
|
||||
|
||||
#define STRINGZ_TO_NPVARIANT(_val, _v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_String; \
|
||||
NPString str = { _val, strlen(_val) }; \
|
||||
(_v).value.stringValue = str; \
|
||||
NP_END_MACRO
|
||||
|
||||
#define STRINGN_TO_NPVARIANT(_val, _len, _v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_String; \
|
||||
NPString str = { _val, _len }; \
|
||||
(_v).value.stringValue = str; \
|
||||
NP_END_MACRO
|
||||
|
||||
#define OBJECT_TO_NPVARIANT(_val, _v) \
|
||||
NP_BEGIN_MACRO \
|
||||
(_v).type = NPVariantType_Object; \
|
||||
(_v).value.objectValue = _val; \
|
||||
NP_END_MACRO
|
||||
|
||||
|
||||
/*
|
||||
Type mappings (JavaScript types have been used for illustration
|
||||
purposes):
|
||||
|
||||
JavaScript to C (NPVariant with type:)
|
||||
undefined NPVariantType_Void
|
||||
null NPVariantType_Null
|
||||
Boolean NPVariantType_Bool
|
||||
Number NPVariantType_Double or NPVariantType_Int32
|
||||
String NPVariantType_String
|
||||
Object NPVariantType_Object
|
||||
|
||||
C (NPVariant with type:) to JavaScript
|
||||
NPVariantType_Void undefined
|
||||
NPVariantType_Null null
|
||||
NPVariantType_Bool Boolean
|
||||
NPVariantType_Int32 Number
|
||||
NPVariantType_Double Number
|
||||
NPVariantType_String String
|
||||
NPVariantType_Object Object
|
||||
*/
|
||||
|
||||
typedef void *NPIdentifier;
|
||||
|
||||
/*
|
||||
NPObjects have methods and properties. Methods and properties are
|
||||
identified with NPIdentifiers. These identifiers may be reflected
|
||||
in script. NPIdentifiers can be either strings or integers, IOW,
|
||||
methods and properties can be identified by either strings or
|
||||
integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
|
||||
compared using ==. In case of any errors, the requested
|
||||
NPIdentifier(s) will be NULL.
|
||||
*/
|
||||
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
|
||||
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
|
||||
NPIdentifier *identifiers);
|
||||
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
|
||||
bool NPN_IdentifierIsString(NPIdentifier identifier);
|
||||
|
||||
/*
|
||||
The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
|
||||
*/
|
||||
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
|
||||
|
||||
/*
|
||||
Get the integer represented by identifier. If identifier is not an
|
||||
integer identifier, the behaviour is undefined.
|
||||
*/
|
||||
int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
|
||||
|
||||
/*
|
||||
NPObject behavior is implemented using the following set of
|
||||
callback functions.
|
||||
|
||||
The NPVariant *result argument of these functions (where
|
||||
applicable) should be released using NPN_ReleaseVariantValue().
|
||||
*/
|
||||
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
|
||||
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
|
||||
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
|
||||
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
|
||||
typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
|
||||
const NPVariant *args, uint32_t argCount,
|
||||
NPVariant *result);
|
||||
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
|
||||
const NPVariant *args,
|
||||
uint32_t argCount,
|
||||
NPVariant *result);
|
||||
typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
|
||||
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
|
||||
NPVariant *result);
|
||||
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
|
||||
const NPVariant *value);
|
||||
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj,
|
||||
NPIdentifier name);
|
||||
|
||||
/*
|
||||
NPObjects returned by create, retain, invoke, and getProperty pass
|
||||
a reference count to the caller. That is, the callee adds a
|
||||
reference count which passes to the caller. It is the caller's
|
||||
responsibility to release the returned object.
|
||||
|
||||
NPInvokeFunctionPtr function may return 0 to indicate a void
|
||||
result.
|
||||
|
||||
NPInvalidateFunctionPtr is called by the scripting environment
|
||||
when the native code is shutdown. Any attempt to message a
|
||||
NPObject instance after the invalidate callback has been
|
||||
called will result in undefined behavior, even if the native code
|
||||
is still retaining those NPObject instances. (The runtime
|
||||
will typically return immediately, with 0 or NULL, from an attempt
|
||||
to dispatch to a NPObject, but this behavior should not be
|
||||
depended upon.)
|
||||
*/
|
||||
struct NPClass
|
||||
{
|
||||
uint32_t structVersion;
|
||||
NPAllocateFunctionPtr allocate;
|
||||
NPDeallocateFunctionPtr deallocate;
|
||||
NPInvalidateFunctionPtr invalidate;
|
||||
NPHasMethodFunctionPtr hasMethod;
|
||||
NPInvokeFunctionPtr invoke;
|
||||
NPInvokeDefaultFunctionPtr invokeDefault;
|
||||
NPHasPropertyFunctionPtr hasProperty;
|
||||
NPGetPropertyFunctionPtr getProperty;
|
||||
NPSetPropertyFunctionPtr setProperty;
|
||||
NPRemovePropertyFunctionPtr removeProperty;
|
||||
};
|
||||
|
||||
#define NP_CLASS_STRUCT_VERSION 1
|
||||
|
||||
struct NPObject {
|
||||
NPClass *_class;
|
||||
uint32_t referenceCount;
|
||||
/*
|
||||
* Additional space may be allocated here by types of NPObjects
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
If the class has an allocate function, NPN_CreateObject invokes
|
||||
that function, otherwise a NPObject is allocated and
|
||||
returned. This method will initialize the referenceCount member of
|
||||
the NPObject to 1.
|
||||
*/
|
||||
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
|
||||
|
||||
/*
|
||||
Increment the NPObject's reference count.
|
||||
*/
|
||||
NPObject *NPN_RetainObject(NPObject *npobj);
|
||||
|
||||
/*
|
||||
Decremented the NPObject's reference count. If the reference
|
||||
count goes to zero, the class's destroy function is invoke if
|
||||
specified, otherwise the object is freed directly.
|
||||
*/
|
||||
void NPN_ReleaseObject(NPObject *npobj);
|
||||
|
||||
/*
|
||||
Functions to access script objects represented by NPObject.
|
||||
|
||||
Calls to script objects are synchronous. If a function returns a
|
||||
value, it will be supplied via the result NPVariant
|
||||
argument. Successful calls will return true, false will be
|
||||
returned in case of an error.
|
||||
|
||||
Calls made from plugin code to script must be made from the thread
|
||||
on which the plugin was initialized.
|
||||
*/
|
||||
|
||||
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
|
||||
const NPVariant *args, uint32_t argCount, NPVariant *result);
|
||||
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
|
||||
NPVariant *result);
|
||||
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
|
||||
NPVariant *result);
|
||||
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
|
||||
const NPVariant *value);
|
||||
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
|
||||
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
|
||||
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
|
||||
|
||||
/*
|
||||
NPN_SetException may be called to trigger a script exception upon
|
||||
return from entry points into NPObjects. Typical usage:
|
||||
|
||||
NPN_SetException (npobj, message);
|
||||
*/
|
||||
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
109
mozilla/modules/plugin/base/public/nptypes.h
Normal file
109
mozilla/modules/plugin/base/public/nptypes.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* mozilla.org.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Johnny Stenback <jst@mozilla.org> (Original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Header file for ensuring that C99 types ([u]int32_t and bool) are
|
||||
* available.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) || defined(OS2)
|
||||
/*
|
||||
* Win32 and OS/2 don't know C99, so define [u]int_32 here. The bool
|
||||
* is predefined tho, both in C and C++.
|
||||
*/
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX)
|
||||
/*
|
||||
* AIX and SunOS ship a inttypes.h header that defines [u]int32_t,
|
||||
* but not bool for C.
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef int bool;
|
||||
#endif
|
||||
#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD)
|
||||
/*
|
||||
* BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and
|
||||
* u_int32_t.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* BSD/OS ships no header that defines uint32_t, nor bool (for C)
|
||||
* OpenBSD ships no header that defines uint32_t, but provides bool as a
|
||||
* macro.
|
||||
*/
|
||||
#if defined(bsdi) || defined(OPENBSD)
|
||||
typedef u_int32_t uint32_t;
|
||||
|
||||
#if defined(bsdi)
|
||||
#if !defined(__cplusplus)
|
||||
typedef int bool;
|
||||
#endif
|
||||
#else /* OPENBSD is defined, so use its bool */
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
#else
|
||||
/*
|
||||
* FreeBSD defines uint32_t and bool.
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
#elif defined(BEOS)
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
/*
|
||||
* For those that ship a standard C99 stdint.h header file, include
|
||||
* it. Can't do the same for stdbool.h tho, since some systems ship
|
||||
* with a stdbool.h file that doesn't compile!
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
|
||||
#include <stdbool.h>
|
||||
#else
|
||||
/*
|
||||
* GCC 2.91 can't deal with a typedef for bool, but a #define
|
||||
* works.
|
||||
*/
|
||||
#define bool int
|
||||
#endif
|
||||
#endif
|
||||
1360
mozilla/modules/plugin/base/src/nsJSNPRuntime.cpp
Normal file
1360
mozilla/modules/plugin/base/src/nsJSNPRuntime.cpp
Normal file
File diff suppressed because it is too large
Load Diff
105
mozilla/modules/plugin/base/src/nsJSNPRuntime.h
Normal file
105
mozilla/modules/plugin/base/src/nsJSNPRuntime.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsJSNPRuntime_h__
|
||||
#define nsJSNPRuntime_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "jsapi.h"
|
||||
#include "npapi.h"
|
||||
#include "npruntime.h"
|
||||
#include "pldhash.h"
|
||||
|
||||
class nsJSNPRuntime
|
||||
{
|
||||
public:
|
||||
static void OnPluginDestroy(NPP npp);
|
||||
};
|
||||
|
||||
class nsJSObjWrapperKey
|
||||
{
|
||||
public:
|
||||
nsJSObjWrapperKey(JSObject *obj, NPP npp)
|
||||
: mJSObj(obj), mNpp(npp)
|
||||
{
|
||||
}
|
||||
|
||||
JSObject *mJSObj;
|
||||
|
||||
const NPP mNpp;
|
||||
};
|
||||
|
||||
class nsJSObjWrapper : public NPObject,
|
||||
public nsJSObjWrapperKey
|
||||
{
|
||||
public:
|
||||
static NPObject *GetNewOrUsed(NPP npp, JSContext *cx, JSObject *obj);
|
||||
|
||||
protected:
|
||||
nsJSObjWrapper(NPP npp);
|
||||
~nsJSObjWrapper();
|
||||
|
||||
static NPObject * NP_Allocate(NPP npp, NPClass *aClass);
|
||||
static void NP_Deallocate(NPObject *obj);
|
||||
static void NP_Invalidate(NPObject *obj);
|
||||
static bool NP_HasMethod(NPObject *, NPIdentifier identifier);
|
||||
static bool NP_Invoke(NPObject *obj, NPIdentifier method,
|
||||
const NPVariant *args, uint32_t argCount,
|
||||
NPVariant *result);
|
||||
static bool NP_InvokeDefault(NPObject *obj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
static bool NP_HasProperty(NPObject * obj, NPIdentifier property);
|
||||
static bool NP_GetProperty(NPObject *obj, NPIdentifier property,
|
||||
NPVariant *result);
|
||||
static bool NP_SetProperty(NPObject *obj, NPIdentifier property,
|
||||
const NPVariant *value);
|
||||
static bool NP_RemoveProperty(NPObject *obj, NPIdentifier property);
|
||||
|
||||
public:
|
||||
static NPClass sJSObjWrapperNPClass;
|
||||
};
|
||||
|
||||
class nsNPObjWrapper
|
||||
{
|
||||
public:
|
||||
static JSObject *GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj);
|
||||
};
|
||||
|
||||
bool
|
||||
JSValToNPVariant(NPP npp, JSContext *cx, jsval val, NPVariant *variant);
|
||||
|
||||
#endif // nsJSNPRuntime_h__
|
||||
65
mozilla/netwerk/base/public/nsIAuthPromptProvider.idl
Normal file
65
mozilla/netwerk/base/public/nsIAuthPromptProvider.idl
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode: idl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Vladimir Vukicevic <vladimir@pobox.com>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIAuthPrompt;
|
||||
|
||||
[scriptable, uuid(129d3bd5-8a26-4b0b-b8a0-19fdea029196)]
|
||||
interface nsIAuthPromptProvider : nsISupports
|
||||
{
|
||||
/**
|
||||
* Normal (non-proxy) prompt request.
|
||||
*/
|
||||
const PRUint32 PROMPT_NORMAL = 0;
|
||||
|
||||
/**
|
||||
* Proxy auth request.
|
||||
*/
|
||||
const PRUint32 PROMPT_PROXY = 1;
|
||||
|
||||
/**
|
||||
* Request a nsIAuthPrompt interface for the given prompt reason;
|
||||
* @throws NS_ERROR_NOT_AVAILABLE if no prompt is allowed or
|
||||
* available for the given reason.
|
||||
*
|
||||
* @param aPromptReason The reason for the auth prompt;
|
||||
* one of @PROMPT_NORMAL or @PROMPT_PROXY
|
||||
* @returns a nsIAuthPrompt interface, or throws NS_ERROR_NOT_AVAILABLE
|
||||
*/
|
||||
nsIAuthPrompt getAuthPrompt(in PRUint32 aPromptReason);
|
||||
};
|
||||
58
mozilla/security/nss/lib/ckfw/builtins/ckbiver.c
Normal file
58
mozilla/security/nss/lib/ckfw/builtins/ckbiver.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape security libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* Library identity and versioning */
|
||||
|
||||
#include "nssckbi.h"
|
||||
|
||||
#if defined(DEBUG)
|
||||
#define _DEBUG_STRING " (debug)"
|
||||
#else
|
||||
#define _DEBUG_STRING ""
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Version information for the 'ident' and 'what commands
|
||||
*
|
||||
* NOTE: the first component of the concatenated rcsid string
|
||||
* must not end in a '$' to prevent rcs keyword substitution.
|
||||
*/
|
||||
const char __nss_builtins_rcsid[] = "$Header: NSS Builtin Trusted Root CAs "
|
||||
NSS_BUILTINS_LIBRARY_VERSION _DEBUG_STRING
|
||||
" " __DATE__ " " __TIME__ " $";
|
||||
const char __nss_builtins_sccsid[] = "@(#)NSS Builtin Trusted Root CAs "
|
||||
NSS_BUILTINS_LIBRARY_VERSION _DEBUG_STRING
|
||||
" " __DATE__ " " __TIME__;
|
||||
97
mozilla/security/nss/lib/ckfw/builtins/nssckbi.rc
Normal file
97
mozilla/security/nss/lib/ckfw/builtins/nssckbi.rc
Normal file
@@ -0,0 +1,97 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape security libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nssckbi.h"
|
||||
#include <winver.h>
|
||||
|
||||
#define MY_LIBNAME "nssckbi"
|
||||
#define MY_FILEDESCRIPTION "NSS Builtin Trusted Root CAs"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define MY_DEBUG_STR " (debug)"
|
||||
#define MY_FILEFLAGS_1 VS_FF_DEBUG
|
||||
#else
|
||||
#define MY_DEBUG_STR ""
|
||||
#define MY_FILEFLAGS_1 0x0L
|
||||
#endif
|
||||
#if NSS_BETA
|
||||
#define MY_FILEFLAGS_2 MY_FILEFLAGS_1|VS_FF_PRERELEASE
|
||||
#else
|
||||
#define MY_FILEFLAGS_2 MY_FILEFLAGS_1
|
||||
#endif
|
||||
|
||||
#ifdef WINNT
|
||||
#define MY_FILEOS VOS_NT_WINDOWS32
|
||||
#else
|
||||
#define MY_FILEOS VOS__WINDOWS32
|
||||
#endif
|
||||
|
||||
#define MY_INTERNAL_NAME MY_LIBNAME
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version-information resource
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION NSS_BUILTINS_LIBRARY_VERSION_MAJOR,NSS_BUILTINS_LIBRARY_VERSION_MINOR,0,0
|
||||
PRODUCTVERSION NSS_BUILTINS_LIBRARY_VERSION_MAJOR,NSS_BUILTINS_LIBRARY_VERSION_MINOR,0,0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS MY_FILEFLAGS_2
|
||||
FILEOS MY_FILEOS
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L // not used
|
||||
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0" // Lang=US English, CharSet=Unicode
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Netscape Communications Corporation\0"
|
||||
VALUE "FileDescription", MY_FILEDESCRIPTION MY_DEBUG_STR "\0"
|
||||
VALUE "FileVersion", NSS_BUILTINS_LIBRARY_VERSION "\0"
|
||||
VALUE "InternalName", MY_INTERNAL_NAME "\0"
|
||||
VALUE "LegalCopyright", "Copyright \251 1994-2001 Netscape Communications Corporation\0"
|
||||
VALUE "OriginalFilename", MY_INTERNAL_NAME ".dll\0"
|
||||
VALUE "ProductName", "Network Security Services\0"
|
||||
VALUE "ProductVersion", NSS_BUILTINS_LIBRARY_VERSION "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
80
mozilla/widget/public/nsINativeKeyBindings.h
Normal file
80
mozilla/widget/public/nsINativeKeyBindings.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsINativeKeyBindings_h_
|
||||
#define nsINativeKeyBindings_h_
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_INATIVEKEYBINDINGS_IID \
|
||||
{0x606c54e7, 0x0593, 0x4750, {0x99, 0xd9, 0x4e, 0x1b, 0xcc, 0xec, 0x98, 0xd9}}
|
||||
|
||||
#define NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX \
|
||||
"@mozilla.org/widget/native-key-bindings;1?type="
|
||||
|
||||
struct nsNativeKeyEvent
|
||||
{
|
||||
PRUint32 keyCode;
|
||||
PRUint32 charCode;
|
||||
PRBool altKey;
|
||||
PRBool ctrlKey;
|
||||
PRBool shiftKey;
|
||||
PRBool metaKey;
|
||||
};
|
||||
|
||||
class nsINativeKeyBindings : public nsISupports
|
||||
{
|
||||
public:
|
||||
typedef void (*DoCommandCallback)(const char *, void*);
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_INATIVEKEYBINDINGS_IID)
|
||||
|
||||
virtual NS_HIDDEN_(PRBool) KeyDown(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback,
|
||||
void *aCallbackData) = 0;
|
||||
|
||||
virtual NS_HIDDEN_(PRBool) KeyPress(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback,
|
||||
void *aCallbackData) = 0;
|
||||
|
||||
virtual NS_HIDDEN_(PRBool) KeyUp(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback,
|
||||
void *aCallbackData) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
296
mozilla/widget/src/gtk2/nsNativeKeyBindings.cpp
Normal file
296
mozilla/widget/src/gtk2/nsNativeKeyBindings.cpp
Normal file
@@ -0,0 +1,296 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsNativeKeyBindings.h"
|
||||
#include "nsString.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsGtkKeyUtils.h"
|
||||
|
||||
#include <gtk/gtkentry.h>
|
||||
#include <gtk/gtktextview.h>
|
||||
#include <gtk/gtkbindings.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
static nsINativeKeyBindings::DoCommandCallback gCurrentCallback;
|
||||
static void *gCurrentCallbackData;
|
||||
|
||||
// Common GtkEntry and GtkTextView signals
|
||||
static void
|
||||
copy_clipboard_cb(GtkWidget *w, gpointer user_data)
|
||||
{
|
||||
gCurrentCallback("cmd_copy", gCurrentCallbackData);
|
||||
g_signal_stop_emission_by_name(w, "copy_clipboard");
|
||||
}
|
||||
|
||||
static void
|
||||
cut_clipboard_cb(GtkWidget *w, gpointer user_data)
|
||||
{
|
||||
gCurrentCallback("cmd_cut", gCurrentCallbackData);
|
||||
g_signal_stop_emission_by_name(w, "cut_clipboard");
|
||||
}
|
||||
|
||||
// GTK distinguishes between display lines (wrapped, as they appear on the
|
||||
// screen) and paragraphs, which are runs of text terminated by a newline.
|
||||
// We don't have this distinction, so we always use editor's notion of
|
||||
// lines, which are newline-terminated.
|
||||
|
||||
static const char *const sDeleteCommands[][2] = {
|
||||
// backward, forward
|
||||
{ "cmd_deleteCharBackward", "cmd_deleteCharForward" }, // CHARS
|
||||
{ "cmd_deleteWordBackward", "cmd_deleteWordForward" }, // WORD_ENDS
|
||||
{ "cmd_deleteWordBackward", "cmd_deleteWordForward" }, // WORDS
|
||||
{ "cmd_deleteToBeginningOfLine", "cmd_deleteToEndOfLine" }, // LINES
|
||||
{ "cmd_deleteToBeginningOfLine", "cmd_deleteToEndOfLine" }, // LINE_ENDS
|
||||
{ "cmd_deleteToBeginningOfLine", "cmd_deleteToEndOfLine" }, // PARAGRAPH_ENDS
|
||||
{ "cmd_deleteToBeginningOfLine", "cmd_deleteToEndOfLine" }, // PARAGRAPHS
|
||||
// This deletes from the end of the previous word to the beginning of the
|
||||
// next word, but only if the caret is not in a word.
|
||||
// XXX need to implement in editor
|
||||
{ nsnull, nsnull } // WHITESPACE
|
||||
};
|
||||
|
||||
static void
|
||||
delete_from_cursor_cb(GtkWidget *w, GtkDeleteType del_type,
|
||||
gint count, gpointer user_data)
|
||||
{
|
||||
g_signal_stop_emission_by_name(w, "delete_from_cursor");
|
||||
|
||||
PRBool forward = count > 0;
|
||||
if (PRUint32(del_type) >= NS_ARRAY_LENGTH(sDeleteCommands)) {
|
||||
// unsupported deletion type
|
||||
return;
|
||||
}
|
||||
|
||||
if (del_type == GTK_DELETE_WORDS) {
|
||||
// This works like word_ends, except we first move the caret to the
|
||||
// beginning/end of the current word.
|
||||
if (forward) {
|
||||
gCurrentCallback("cmd_wordNext", gCurrentCallbackData);
|
||||
gCurrentCallback("cmd_wordPrevious", gCurrentCallbackData);
|
||||
} else {
|
||||
gCurrentCallback("cmd_wordPrevious", gCurrentCallbackData);
|
||||
gCurrentCallback("cmd_wordNext", gCurrentCallbackData);
|
||||
}
|
||||
} else if (del_type == GTK_DELETE_DISPLAY_LINES ||
|
||||
del_type == GTK_DELETE_PARAGRAPHS) {
|
||||
|
||||
// This works like display_line_ends, except we first move the caret to the
|
||||
// beginning/end of the current line.
|
||||
if (forward) {
|
||||
gCurrentCallback("cmd_beginLine", gCurrentCallbackData);
|
||||
} else {
|
||||
gCurrentCallback("cmd_endLine", gCurrentCallbackData);
|
||||
}
|
||||
}
|
||||
|
||||
const char *cmd = sDeleteCommands[del_type][forward];
|
||||
if (!cmd)
|
||||
return; // unsupported command
|
||||
|
||||
count = PR_ABS(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
gCurrentCallback(cmd, gCurrentCallbackData);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *const sMoveCommands[][2][2] = {
|
||||
// non-extend { backward, forward }, extend { backward, forward }
|
||||
// GTK differentiates between logical position, which is prev/next,
|
||||
// and visual position, which is always left/right.
|
||||
// We should fix this to work the same way for RTL text input.
|
||||
{ // LOGICAL_POSITIONS
|
||||
{ "cmd_charPrevious", "cmd_charNext" },
|
||||
{ "cmd_selectCharPrevious", "cmd_selectCharNext" }
|
||||
},
|
||||
{ // VISUAL_POSITIONS
|
||||
{ "cmd_charPrevious", "cmd_charNext" },
|
||||
{ "cmd_selectCharPrevious", "cmd_selectCharNext" }
|
||||
},
|
||||
{ // WORDS
|
||||
{ "cmd_wordPrevious", "cmd_wordNext" },
|
||||
{ "cmd_selectWordPrevious", "cmd_selectWordNext" }
|
||||
},
|
||||
{ // DISPLAY_LINES
|
||||
{ "cmd_linePrevious", "cmd_lineNext" },
|
||||
{ "cmd_selectLinePrevious", "cmd_selectLineNext" }
|
||||
},
|
||||
{ // DISPLAY_LINE_ENDS
|
||||
{ "cmd_beginLine", "cmd_endLine" },
|
||||
{ "cmd_selectBeginLine", "cmd_selectEndLine" }
|
||||
},
|
||||
{ // PARAGRAPHS
|
||||
{ "cmd_linePrevious", "cmd_lineNext" },
|
||||
{ "cmd_selectLinePrevious", "cmd_selectLineNext" }
|
||||
},
|
||||
{ // PARAGRAPH_ENDS
|
||||
{ "cmd_beginLine", "cmd_endLine" },
|
||||
{ "cmd_selectBeginLine", "cmd_selectEndLine" }
|
||||
},
|
||||
{ // PAGES
|
||||
{ "cmd_movePageUp", "cmd_movePageDown" },
|
||||
{ "cmd_selectPageUp", "cmd_selectPageDown" }
|
||||
},
|
||||
{ // BUFFER_ENDS
|
||||
{ "cmd_moveTop", "cmd_moveBottom" },
|
||||
{ "cmd_selectTop", "cmd_selectBottom" }
|
||||
},
|
||||
{ // HORIZONTAL_PAGES (unsupported)
|
||||
{ nsnull, nsnull },
|
||||
{ nsnull, nsnull }
|
||||
}
|
||||
};
|
||||
|
||||
static void
|
||||
move_cursor_cb(GtkWidget *w, GtkMovementStep step, gint count,
|
||||
gboolean extend_selection, gpointer user_data)
|
||||
{
|
||||
g_signal_stop_emission_by_name(w, "move_cursor");
|
||||
PRBool forward = count > 0;
|
||||
if (PRUint32(step) >= NS_ARRAY_LENGTH(sMoveCommands)) {
|
||||
// unsupported movement type
|
||||
return;
|
||||
}
|
||||
|
||||
const char *cmd = sMoveCommands[step][extend_selection][forward];
|
||||
if (!cmd)
|
||||
return; // unsupported command
|
||||
|
||||
|
||||
count = PR_ABS(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
gCurrentCallback(cmd, gCurrentCallbackData);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paste_clipboard_cb(GtkWidget *w, gpointer user_data)
|
||||
{
|
||||
gCurrentCallback("cmd_paste", gCurrentCallbackData);
|
||||
g_signal_stop_emission_by_name(w, "paste_clipboard");
|
||||
}
|
||||
|
||||
// GtkTextView-only signals
|
||||
static void
|
||||
select_all_cb(GtkWidget *w, gboolean select, gpointer user_data)
|
||||
{
|
||||
gCurrentCallback("cmd_selectAll", gCurrentCallbackData);
|
||||
g_signal_stop_emission_by_name(w, "select_all");
|
||||
}
|
||||
|
||||
void
|
||||
nsNativeKeyBindings::Init(NativeKeyBindingsType aType)
|
||||
{
|
||||
switch (aType) {
|
||||
case eKeyBindings_Input:
|
||||
mNativeTarget = gtk_entry_new();
|
||||
break;
|
||||
case eKeyBindings_TextArea:
|
||||
mNativeTarget = gtk_text_view_new();
|
||||
g_signal_connect(G_OBJECT(mNativeTarget), "select_all",
|
||||
G_CALLBACK(select_all_cb), this);
|
||||
break;
|
||||
}
|
||||
|
||||
g_signal_connect(G_OBJECT(mNativeTarget), "copy_clipboard",
|
||||
G_CALLBACK(copy_clipboard_cb), this);
|
||||
g_signal_connect(G_OBJECT(mNativeTarget), "cut_clipboard",
|
||||
G_CALLBACK(cut_clipboard_cb), this);
|
||||
g_signal_connect(G_OBJECT(mNativeTarget), "delete_from_cursor",
|
||||
G_CALLBACK(delete_from_cursor_cb), this);
|
||||
g_signal_connect(G_OBJECT(mNativeTarget), "move_cursor",
|
||||
G_CALLBACK(move_cursor_cb), this);
|
||||
g_signal_connect(G_OBJECT(mNativeTarget), "paste_clipboard",
|
||||
G_CALLBACK(paste_clipboard_cb), this);
|
||||
}
|
||||
|
||||
nsNativeKeyBindings::~nsNativeKeyBindings()
|
||||
{
|
||||
gtk_widget_destroy(mNativeTarget);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsNativeKeyBindings, nsINativeKeyBindings)
|
||||
|
||||
PRBool
|
||||
nsNativeKeyBindings::KeyDown(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback, void *aCallbackData)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback, void *aCallbackData)
|
||||
{
|
||||
PRUint32 keyCode;
|
||||
|
||||
if (aEvent.charCode != 0)
|
||||
keyCode = gdk_unicode_to_keyval(aEvent.charCode);
|
||||
else
|
||||
keyCode = DOMKeyCodeToGdkKeyCode(aEvent.keyCode);
|
||||
|
||||
int modifiers = 0;
|
||||
if (aEvent.altKey)
|
||||
modifiers |= GDK_MOD1_MASK;
|
||||
if (aEvent.ctrlKey)
|
||||
modifiers |= GDK_CONTROL_MASK;
|
||||
if (aEvent.shiftKey)
|
||||
modifiers |= GDK_SHIFT_MASK;
|
||||
// we don't support meta
|
||||
|
||||
gCurrentCallback = aCallback;
|
||||
gCurrentCallbackData = aCallbackData;
|
||||
|
||||
PRBool handled = PR_FALSE;
|
||||
|
||||
if (gtk_bindings_activate(GTK_OBJECT(mNativeTarget),
|
||||
keyCode, GdkModifierType(modifiers))) {
|
||||
handled = PR_TRUE;
|
||||
}
|
||||
|
||||
gCurrentCallback = nsnull;
|
||||
gCurrentCallbackData = nsnull;
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsNativeKeyBindings::KeyUp(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback, void *aCallbackData)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
93
mozilla/widget/src/gtk2/nsNativeKeyBindings.h
Normal file
93
mozilla/widget/src/gtk2/nsNativeKeyBindings.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Brian Ryner <bryner@brianryner.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsNativeKeyBindings_h_
|
||||
#define nsNativeKeyBindings_h_
|
||||
|
||||
// X.h defines KeyPress
|
||||
#ifdef KeyPress
|
||||
#undef KeyPress
|
||||
#endif
|
||||
|
||||
#include "nsINativeKeyBindings.h"
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
enum NativeKeyBindingsType {
|
||||
eKeyBindings_Input,
|
||||
eKeyBindings_TextArea
|
||||
};
|
||||
|
||||
#define NS_NATIVEKEYBINDINGSINPUT_CID \
|
||||
{0x5c337258, 0xa580, 0x472e, {0x86, 0x15, 0xf2, 0x77, 0xdd, 0xc5, 0xbb, 0x06}}
|
||||
|
||||
#define NS_NATIVEKEYBINDINGSINPUT_CONTRACTID \
|
||||
NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "input"
|
||||
|
||||
#define NS_NATIVEKEYBINDINGSTEXTAREA_CID \
|
||||
{0x2a898043, 0x180f, 0x4c8b, {0x8e, 0x54, 0x41, 0x0c, 0x7a, 0x54, 0x0f, 0x27}}
|
||||
|
||||
#define NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID \
|
||||
NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "textarea"
|
||||
|
||||
class nsNativeKeyBindings : public nsINativeKeyBindings
|
||||
{
|
||||
public:
|
||||
NS_HIDDEN_(void) Init(NativeKeyBindingsType aType);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsINativeKeyBindings
|
||||
virtual NS_HIDDEN_(PRBool) KeyDown(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback,
|
||||
void *aCallbackData);
|
||||
|
||||
virtual NS_HIDDEN_(PRBool) KeyPress(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback,
|
||||
void *aCallbackData);
|
||||
|
||||
virtual NS_HIDDEN_(PRBool) KeyUp(const nsNativeKeyEvent& aEvent,
|
||||
DoCommandCallback aCallback,
|
||||
void *aCallbackData);
|
||||
|
||||
private:
|
||||
~nsNativeKeyBindings() NS_HIDDEN;
|
||||
|
||||
GtkWidget *mNativeTarget;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user