Inheritance: IDisposable
        protected override bool ProcessRequest(CefRequest request, CefCallback callback)
        {
            var requestNo = Interlocked.Increment(ref _requestNo);
            
            var response = new StringBuilder();

            response.AppendFormat("<pre>\n");
            response.AppendFormat("Requests processed by DemoAppResourceHandler: {0}\n", requestNo);

            response.AppendFormat("Method: {0}\n", request.Method);
            response.AppendFormat("URL: {0}\n", request.Url);

            response.AppendLine();
            response.AppendLine("Headers:");
            var headers = request.GetHeaderMap();
            foreach (string key in headers)
            {
                foreach (var value in headers.GetValues(key))
                {
                    response.AppendFormat("{0}: {1}\n", key, value);
                }
            }
            response.AppendLine();

            response.AppendFormat("</pre>\n");

            responseData = Encoding.UTF8.GetBytes(response.ToString());

            callback.Continue();
            return true;
        }
        private int process_request(cef_resource_handler_t *self, cef_request_t *request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            var result = ProcessRequest(m_request, m_callback);

            return(result ? 1 : 0);
        }
        private int read_response(cef_resource_handler_t *self, void *data_out, int bytes_to_read, int *bytes_read, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_callback = CefCallback.FromNative(callback);

            using (var m_stream = new UnmanagedMemoryStream((byte *)data_out, bytes_to_read, bytes_to_read, FileAccess.Write))
            {
                int m_bytesRead;
                var result     = ReadResponse(m_stream, bytes_to_read, out m_bytesRead, m_callback);
                *   bytes_read = m_bytesRead;
                return(result ? 1 : 0);
            }
        }
 protected override bool ReadResponse(Stream response, int bytesToRead, out int bytesRead, CefCallback callback)
 {
     if (bytesToRead == 0 || pos >= responseData.Length)
     {
         bytesRead = 0;
         return false;
     }
     else
     {
         response.Write(responseData, pos, bytesToRead);
         pos += bytesToRead;
         bytesRead = bytesToRead;
         return true;
     }
 }
 /// <summary>
 /// Read response data. If data is available immediately copy up to
 /// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
 /// bytes copied, and return true. To read the data at a later time set
 /// |bytes_read| to 0, return true and call CefCallback::Continue() when the
 /// data is available. To indicate response completion return false.
 /// </summary>
 protected abstract bool ReadResponse(Stream response, int bytesToRead, out int bytesRead, CefCallback callback);
 /// <summary>
 /// Begin processing the request. To handle the request return true and call
 /// CefCallback::Continue() once the response header information is available
 /// (CefCallback::Continue() can also be called from inside this method if
 /// header information is available immediately). To cancel the request return
 /// false.
 /// </summary>
 protected abstract bool ProcessRequest(CefRequest request, CefCallback callback);
 /// <summary>
 /// Read response data. If data is available immediately copy up to
 /// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
 /// bytes copied, and return true. To read the data at a later time set
 /// |bytes_read| to 0, return true and call CefCallback::Continue() when the
 /// data is available. To indicate response completion return false.
 /// </summary>
 protected abstract bool ReadResponse(Stream response, int bytesToRead, out int bytesRead, CefCallback callback);
 /// <summary>
 /// Begin processing the request. To handle the request return true and call
 /// CefCallback::Continue() once the response header information is available
 /// (CefCallback::Continue() can also be called from inside this method if
 /// header information is available immediately). To cancel the request return
 /// false.
 /// </summary>
 protected abstract bool ProcessRequest(CefRequest request, CefCallback callback);