示例#1
0
        private int get_extension_resource(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, cef_string_t *file, cef_get_extension_resource_callback_t *callback)
        {
            CheckSelf(self);

            var m_extension = CefExtension.FromNative(extension);
            var m_browser   = CefBrowser.FromNativeOrNull(browser);
            var m_file      = cef_string_t.ToString(file);
            var m_callback  = CefGetExtensionResourceCallback.FromNativeOrNull(callback);

            var handled = GetExtensionResource(m_extension, m_browser, m_file, m_callback);

            if (!handled)
            {
                m_callback.Dispose();
            }

            return(handled ? 1 : 0);
        }
示例#2
0
 /// <summary>
 /// Called to retrieve an extension resource that would normally be loaded from
 /// disk (e.g. if a file parameter is specified to chrome.tabs.executeScript).
 /// |extension| and |browser| are the source of the resource request. |file| is
 /// the requested relative file path. To handle the resource request return
 /// true and execute |callback| either synchronously or asynchronously. For the
 /// default behavior which reads the resource from the extension directory on
 /// disk return false. Localization substitutions will not be applied to
 /// resources handled via this method.
 /// </summary>
 protected virtual bool GetExtensionResource(CefExtension extension, CefBrowser browser, string file, CefGetExtensionResourceCallback callback)
 {
     return(false);
 }