Esempio n. 1
0
        /// <summary>
        /// Load the contents of |stream| with the optional dummy target |url|.
        /// </summary>
        public void LoadStream(CefStreamReader stream, string url)
        {
            fixed(char *url_str = url)
            {
                var n_url = new cef_string_t(url_str, url != null ? url.Length : 0);

                cef_frame_t.invoke_load_stream(this.ptr, stream.GetNativePointerAndAddRef(), &n_url);
            }
        }
        /// <summary>
        /// Create a new CefStreamReader object from a file.
        /// </summary>
        public static CefStreamReader Create(string fileName)
        {
            fixed(char *fileName_str = fileName)
            {
                var n_fileName = new cef_string_t(fileName_str, fileName != null ? fileName.Length : 0);

                return(CefStreamReader.From(
                           NativeMethods.cef_stream_reader_create_for_file(&n_fileName)
                           ));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Create a new CefXmlReader object.
        /// The returned object's methods can only be called from the thread that created the object.
        /// </summary>
        public static CefXmlReader Create(CefStreamReader stream, CefXmlEncodingType encodingType, string uri)
        {
            fixed(char *uri_str = uri)
            {
                var n_uri = new cef_string_t(uri_str, uri != null ? uri.Length : 0);

                return(CefXmlReader.From(
                           NativeMethods.cef_xml_reader_create(
                               stream.GetNativePointerAndAddRef(),
                               (cef_xml_encoding_type_t)encodingType,
                               &n_uri)
                           ));
            }
        }
 /// <summary>
 /// Create a new CefStreamReader object from a custom handler.
 /// </summary>
 public static CefStreamReader Create(CefReadHandler handler)
 {
     return(CefStreamReader.From(
                NativeMethods.cef_stream_reader_create_for_handler(handler.GetNativePointerAndAddRef())
                ));
 }
 public static unsafe CefStreamReader Create(void *data, int size)
 {
     return(CefStreamReader.From(
                NativeMethods.cef_stream_reader_create_for_data(data, size)
                ));
 }
Esempio n. 6
0
 /// <summary>
 /// Create a new CefXmlReader object.
 /// The returned object's methods can only be called from the thread that created the object.
 /// </summary>
 public static CefXmlReader Create(CefStreamReader stream, CefXmlEncodingType encodingType, Uri uri)
 {
     return(Create(stream, encodingType, uri.ToString()));
 }
 /// <summary>
 /// Called when there is no more data to be processed.
 /// It is expected that whatever data was retained in the last ProcessData() call,
 /// it should be returned now by setting |remainder| if appropriate.
 /// </summary>
 protected virtual void Drain(out CefStreamReader remainder)
 {
     remainder = null;
 }
 /// <summary>
 /// Set |substitute_data| to the replacement for the data in |data| if data should be modified.
 /// </summary>
 protected virtual void ProcessData(Stream data, out CefStreamReader substituteData)
 {
     substituteData = null;
 }
Esempio n. 9
0
 /// <summary>
 /// Called on the IO thread before a resource is loaded.
 /// To allow the resource to load normally return false.
 /// To redirect the resource to a new url populate the |redirectUrl| value and return false.
 /// To specify data for the resource return a CefStream object in |resourceStream|,
 /// use the |response| object to set mime type, HTTP status code and optional header values, and return false.
 /// To cancel loading of the resource return true.
 /// Any modifications to |request| will be observed.
 /// If the URL in |request| is changed and |redirectUrl| is also set, the URL in |request| will be used.
 /// </summary>
 protected virtual bool OnBeforeResourceLoad(CefBrowser browser, CefRequest request, out string redirectUrl, out CefStreamReader resourceStream, CefResponse response, int loadFlags)
 {
     redirectUrl    = null;
     resourceStream = null;
     return(false);
 }
Esempio n. 10
0
 /// <summary>
 /// Create a new CefZipReader object.
 /// The returned object's methods can only be called from the thread that created the object.
 /// </summary>
 public static CefZipReader Create(CefStreamReader stream)
 {
     return(CefZipReader.From(
                NativeMethods.cef_zip_reader_create(stream.GetNativePointerAndAddRef())
                ));
 }