Beispiel #1
0
        private int execute(cef_v8handler_t *self, cef_string_t *name, cef_v8value_t * @object, UIntPtr argumentsCount, cef_v8value_t **arguments, cef_v8value_t **retval, cef_string_t *exception)
        {
            CheckSelf(self);

            var m_name = cef_string_t.ToString(name);
            var m_obj  = CefV8Value.FromNative(@object);
            var argc   = (int)argumentsCount;

            CefV8Value[] m_arguments;
            if (argc == 0)
            {
                m_arguments = emtpyArgs;
            }
            else
            {
                m_arguments = new CefV8Value[argc];
                for (var i = 0; i < argc; i++)
                {
                    m_arguments[i] = CefV8Value.FromNative(arguments[i]);
                }
            }

            CefV8Value m_returnValue;
            string     m_exception;

            var handled = Execute(m_name, m_obj, m_arguments, out m_returnValue, out m_exception);

            if (handled)
            {
                if (m_exception != null)
                {
                    cef_string_t.Copy(m_exception, exception);
                }
                else if (m_returnValue != null)
                {
                    *retval = m_returnValue.ToNative();
                }
            }

            return(handled ? 1 : 0);
        }
Beispiel #2
0
        private int set(cef_v8accessor_t *self, cef_string_t *name, cef_v8value_t * @object, cef_v8value_t *value, cef_string_t *exception)
        {
            CheckSelf(self);

            var    m_name  = cef_string_t.ToString(name);
            var    m_obj   = CefV8Value.FromNative(@object);
            var    m_value = CefV8Value.FromNative(value);
            string mException;

            var handled = this.Set(m_name, m_obj, m_value, out mException);

            if (handled)
            {
                if (mException != null)
                {
                    cef_string_t.Copy(mException, exception);
                }
            }

            return(handled ? 1 : 0);
        }
 /// <summary>
 /// Returns the global object for this context. The context must be entered
 /// before calling this method.
 /// </summary>
 public CefV8Value GetGlobal()
 {
     return(CefV8Value.FromNative(
                cef_v8context_t.get_global(_self)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type unsigned int.
 /// </summary>
 public static CefV8Value CreateUInt(uint value)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_uint(value)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type double.
 /// </summary>
 public static CefV8Value CreateDouble(double value)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_double(value)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type bool.
 /// </summary>
 public static CefV8Value CreateBool(bool value)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_bool(value ? 1 : 0)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type null.
 /// </summary>
 public static CefV8Value CreateNull()
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_null()
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type undefined.
 /// </summary>
 public static CefV8Value CreateUndefined()
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_undefined()
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type array with the specified |length|.
 /// If |length| is negative the returned array will have length 0. This method
 /// should only be called from within the scope of a CefRenderProcessHandler,
 /// CefV8Handler or CefV8Accessor callback, or in combination with calling
 /// Enter() and Exit() on a stored CefV8Context reference.
 /// </summary>
 public static CefV8Value CreateArray(int length)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_array(length)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type object with optional accessor. This
 /// method should only be called from within the scope of a
 /// CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in
 /// combination with calling Enter() and Exit() on a stored CefV8Context
 /// reference.
 /// </summary>
 public static CefV8Value CreateObject(CefV8Accessor accessor)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_object(accessor != null ? accessor.ToNative() : null)
                ));
 }