Ejemplo n.º 1
0
        /// <summary>
        /// Create a new CfxV8Value object of type function. This function should only
        /// be called from within the scope of a CfxRenderProcessHandler,
        /// CfxV8Handler or CfxV8Accessor callback, or in combination with calling
        /// enter() and exit() on a stored CfxV8Context reference.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public static CfxV8Value CreateFunction(string name, CfxV8Handler handler)
        {
            var name_pinned = new PinnedString(name);
            var __retval    = CfxApi.V8Value.cfx_v8value_create_function(name_pinned.Obj.PinnedPtr, name_pinned.Length, CfxV8Handler.Unwrap(handler));

            name_pinned.Obj.Free();
            return(CfxV8Value.Wrap(__retval));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new CfxV8Value object of type string.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public static CfxV8Value CreateString(string value)
        {
            var value_pinned = new PinnedString(value);
            var __retval     = CfxApi.V8Value.cfx_v8value_create_string(value_pinned.Obj.PinnedPtr, value_pinned.Length);

            value_pinned.Obj.Free();
            return(CfxV8Value.Wrap(__retval));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns the value with the specified identifier on success. Returns NULL if
        /// this function is called incorrectly or an exception is thrown.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public CfxV8Value GetValue(string key)
        {
            var key_pinned = new PinnedString(key);
            var __retval   = CfxApi.V8Value.cfx_v8value_get_value_bykey(NativePtr, key_pinned.Obj.PinnedPtr, key_pinned.Length);

            key_pinned.Obj.Free();
            return(CfxV8Value.Wrap(__retval));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Evaluates the specified JavaScript code using this context's global object.
        /// On success |retval| will be set to the return value, if any, and the
        /// function will return true (1). On failure |exception| will be set to the
        /// exception, if any, and the function will return false (0).
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public bool Eval(string code, out CfxV8Value retval, out CfxV8Exception exception)
        {
            var    code_pinned = new PinnedString(code);
            IntPtr retval_ptr;
            IntPtr exception_ptr;
            var    __retval = CfxApi.cfx_v8context_eval(NativePtr, code_pinned.Obj.PinnedPtr, code_pinned.Length, out retval_ptr, out exception_ptr);

            code_pinned.Obj.Free();
            retval    = CfxV8Value.Wrap(retval_ptr);
            exception = CfxV8Exception.Wrap(exception_ptr);
            return(0 != __retval);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Create a new CfxV8Value object of type undefined.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateUndefined()
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_undefined()));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Returns the value with the specified identifier on success. Returns NULL if
 /// this function is called incorrectly or an exception is thrown.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public CfxV8Value GetValue(int index)
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_get_value_byindex(NativePtr, index)));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Create a new CfxV8Value object of type array with the specified |length|.
 /// If |length| is negative the returned array will have length 0. This function
 /// should only be called from within the scope of a
 /// CfxRenderProcessHandler, CfxV8Handler or CfxV8Accessor callback,
 /// or in combination with calling enter() and exit() on a stored CfxV8Context
 /// reference.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateArray(int length)
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_array(length)));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Create a new CfxV8Value object of type object with optional accessor. This
 /// function should only be called from within the scope of a
 /// CfxRenderProcessHandler, CfxV8Handler or CfxV8Accessor callback,
 /// or in combination with calling enter() and exit() on a stored CfxV8Context
 /// reference.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateObject(CfxV8Accessor accessor)
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_object(CfxV8Accessor.Unwrap(accessor))));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Create a new CfxV8Value object of type Date. This function should only be
 /// called from within the scope of a CfxRenderProcessHandler,
 /// CfxV8Handler or CfxV8Accessor callback, or in combination with calling
 /// enter() and exit() on a stored CfxV8Context reference.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateDate(CfxTime date)
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_date(CfxTime.Unwrap(date))));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Create a new CfxV8Value object of type double.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateDouble(double value)
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_double(value)));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Create a new CfxV8Value object of type unsigned int.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateUint(uint value)
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_uint(value)));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Create a new CfxV8Value object of type bool.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateBool(bool value)
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_bool(value ? 1 : 0)));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Create a new CfxV8Value object of type null.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateNull()
 {
     return(CfxV8Value.Wrap(CfxApi.cfx_v8value_create_null()));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Create a new CfxV8Value object of type int.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateInt(int value)
 {
     return(CfxV8Value.Wrap(CfxApi.V8Value.cfx_v8value_create_int(value)));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Create a new CfxV8Value object of type object with optional accessor
 /// and/or interceptor. This function should only be called from within the scope
 /// of a CfxRenderProcessHandler, CfxV8Handler or CfxV8Accessor
 /// callback, or in combination with calling enter() and exit() on a stored
 /// CfxV8Context reference.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateObject(CfxV8Accessor accessor, CfxV8Interceptor interceptor)
 {
     return(CfxV8Value.Wrap(CfxApi.V8Value.cfx_v8value_create_object(CfxV8Accessor.Unwrap(accessor), CfxV8Interceptor.Unwrap(interceptor))));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Create a new CfxV8Value object of type ArrayBuffer which wraps the
 /// provided |buffer| of size |length| bytes. The ArrayBuffer is externalized,
 /// meaning that it does not own |buffer|. The caller is responsible for freeing
 /// |buffer| when requested via a call to CfxV8ArrayBufferReleaseCallback::
 /// ReleaseBuffer. This function should only be called from within the scope of a
 /// CfxRenderProcessHandler, CfxV8Handler or CfxV8Accessor callback,
 /// or in combination with calling enter() and exit() on a stored CfxV8Context
 /// reference.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
 /// </remarks>
 public static CfxV8Value CreateArrayBuffer(IntPtr buffer, ulong length, CfxV8ArrayBufferReleaseCallback releaseCallback)
 {
     return(CfxV8Value.Wrap(CfxApi.V8Value.cfx_v8value_create_array_buffer(buffer, (UIntPtr)length, CfxV8ArrayBufferReleaseCallback.Unwrap(releaseCallback))));
 }