Beispiel #1
0
        // TODO: functions from cef_trace_event.h (not generated automatically)

        #endregion

        #region cef_parser

        // Methods from cef_parser.h.

        /// <summary>
        /// Parse the specified |url| into its component parts.
        /// Returns false if the URL is empty or invalid.
        /// </summary>
        public static bool ParseUrl(string url, out CefUrlParts parts)
        {
            fixed(char *url_str = url)
            {
                var n_url   = new cef_string_t(url_str, url != null ? url.Length : 0);
                var n_parts = new cef_urlparts_t();

                var result = libcef.parse_url(&n_url, &n_parts) != 0;

                parts = result ? CefUrlParts.FromNative(&n_parts) : null;
                cef_urlparts_t.Clear(&n_parts);
                return(result);
            }
        }
Beispiel #2
0
        internal static unsafe CefUrlParts FromNative(cef_urlparts_t *n_parts)
        {
            var result = new CefUrlParts();

            result.Spec     = cef_string_t.ToString(&n_parts->spec);
            result.Scheme   = cef_string_t.ToString(&n_parts->scheme);
            result.UserName = cef_string_t.ToString(&n_parts->username);
            result.Password = cef_string_t.ToString(&n_parts->password);
            result.Host     = cef_string_t.ToString(&n_parts->host);
            result.Port     = cef_string_t.ToString(&n_parts->port);
            result.Origin   = cef_string_t.ToString(&n_parts->origin);
            result.Path     = cef_string_t.ToString(&n_parts->path);
            result.Query    = cef_string_t.ToString(&n_parts->query);
            return(result);
        }
Beispiel #3
0
        public static bool CreateUrl(CefUrlParts parts, out string url)
        {
            if (parts == null)
            {
                throw new ArgumentNullException("parts");
            }

            var n_parts = parts.ToNative();
            var n_url   = new cef_string_t();

            var result = libcef.create_url(&n_parts, &n_url) != 0;

            url = result ? cef_string_t.ToString(&n_url) : null;

            cef_urlparts_t.Clear(&n_parts);
            libcef.string_clear(&n_url);

            return(result);
        }