重构QCefView库升级到134
This commit is contained in:
parent
aa5b8d3b9e
commit
cc049d9924
.gitignore
3rdparty/QCefView/include
QCefCore
CefVersion.hCefViewBrowserApp.hCefViewBrowserAppDelegate.hCefViewBrowserClient.hCefViewBrowserClientDelegate.hCefViewCoreGlobal.hCefViewCoreProtocol.h
QCefView
CefVersion.hQCefConfig.hQCefContext.hQCefDownloadItem.hQCefEvent.hQCefQuery.hQCefSetting.hQCefView.hQCefView_global.h
libcef_dll_wrapper
base
cef_atomic_flag.hcef_atomic_ref_count.hcef_auto_reset.hcef_bind.hcef_build.hcef_callback.hcef_callback_forward.hcef_callback_helpers.hcef_callback_list.hcef_cancelable_callback.hcef_compiler_specific.hcef_dump_without_crashing.hcef_lock.hcef_logging.hcef_macros.hcef_platform_thread.hcef_ref_counted.hcef_scoped_refptr.hcef_thread_checker.hcef_trace_event.hcef_tuple.hcef_weak_ptr.h
internal
capi
cef_accessibility_handler_capi.hcef_app_capi.hcef_audio_handler_capi.hcef_auth_callback_capi.hcef_base_capi.hcef_browser_capi.hcef_browser_process_handler_capi.hcef_callback_capi.hcef_client_capi.hcef_command_handler_capi.hcef_command_line_capi.hcef_context_menu_handler_capi.hcef_cookie_capi.hcef_crash_util_capi.hcef_devtools_message_observer_capi.hcef_dialog_handler_capi.hcef_display_handler_capi.hcef_dom_capi.hcef_download_handler_capi.hcef_download_item_capi.hcef_drag_data_capi.hcef_drag_handler_capi.hcef_file_util_capi.hcef_find_handler_capi.hcef_focus_handler_capi.hcef_frame_capi.hcef_frame_handler_capi.hcef_i18n_util_capi.hcef_image_capi.hcef_jsdialog_handler_capi.hcef_keyboard_handler_capi.hcef_life_span_handler_capi.hcef_load_handler_capi.hcef_media_router_capi.hcef_menu_model_capi.hcef_menu_model_delegate_capi.hcef_navigation_entry_capi.hcef_origin_whitelist_capi.hcef_parser_capi.hcef_path_util_capi.hcef_permission_handler_capi.hcef_preference_capi.hcef_print_handler_capi.hcef_print_settings_capi.hcef_process_message_capi.hcef_process_util_capi.hcef_registration_capi.hcef_render_handler_capi.hcef_render_process_handler_capi.hcef_request_capi.hcef_request_context_capi.hcef_request_context_handler_capi.h
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,19 +6,16 @@
|
||||
# Node artifact files
|
||||
node_modules/
|
||||
dist/
|
||||
<<<<<<< HEAD
|
||||
build/*
|
||||
release/*
|
||||
save/*
|
||||
.cache/*
|
||||
.vscode/*
|
||||
=======
|
||||
/build
|
||||
build/
|
||||
release/
|
||||
/release
|
||||
|
||||
>>>>>>> ff2cd37 (增加屏蔽文件)
|
||||
# Compiled Java class files
|
||||
*.class
|
||||
|
||||
|
24
3rdparty/QCefView/include/QCefCore/CefVersion.h
vendored
Normal file
24
3rdparty/QCefView/include/QCefCore/CefVersion.h
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// CefVersion.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2025/1/19.
|
||||
// This file was generated during CMake configuring.
|
||||
// Do not edit this file directly by manual.
|
||||
// Edit the CefVersion.h.in and then re-config project with CMake.
|
||||
//
|
||||
|
||||
#ifndef CefVersion_h
|
||||
#define CefVersion_h
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#define CEF_VERSION "134.3.6+g96006d1+chromium-134.0.6998.118"
|
||||
#define CEF_VERSION_MAJOR 134
|
||||
#define CEF_VERSION_MINOR 3
|
||||
#define CEF_VERSION_PATCH 6
|
||||
#define CEF_COMMIT_NUMBER 3155
|
||||
#define CEF_COMMIT_HASH "96006d11935cd82a004d992db6e7124825352e19"
|
||||
// clang-format on
|
||||
|
||||
#endif // CefVersion
|
129
3rdparty/QCefView/include/QCefCore/CefViewBrowserApp.h
vendored
Normal file
129
3rdparty/QCefView/include/QCefCore/CefViewBrowserApp.h
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
//
|
||||
// CefViewBrowserApp.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2020/6/11.
|
||||
//
|
||||
|
||||
#ifndef CefViewBrowserApp_h
|
||||
#define CefViewBrowserApp_h
|
||||
#pragma once
|
||||
|
||||
#pragma region stl_headers
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#pragma endregion
|
||||
|
||||
#include <CefViewCoreGlobal.h>
|
||||
#include <CefViewBrowserAppDelegate.h>
|
||||
#include <CefViewBrowserClientDelegate.h>
|
||||
|
||||
struct FolderResourceMapping
|
||||
{
|
||||
CefString path;
|
||||
CefString url;
|
||||
int priority;
|
||||
};
|
||||
|
||||
struct ArchiveResourceMapping
|
||||
{
|
||||
CefString path;
|
||||
CefString url;
|
||||
CefString password;
|
||||
int priority;
|
||||
};
|
||||
|
||||
class CefViewBrowserApp
|
||||
: public CefApp
|
||||
, public CefBrowserProcessHandler
|
||||
{
|
||||
IMPLEMENT_REFCOUNTING(CefViewBrowserApp);
|
||||
|
||||
private:
|
||||
// The name of the bridge object
|
||||
CefString builtin_scheme_name_;
|
||||
CefString bridge_object_name_;
|
||||
std::unordered_map<void*, CefViewBrowserClientDelegateInterface::WeakPtr> client_handler_map_;
|
||||
|
||||
// The app delegate
|
||||
CefViewBrowserAppDelegateInterface::WeakPtr app_delegate_;
|
||||
|
||||
std::list<FolderResourceMapping> folderResourceMappingList_;
|
||||
|
||||
std::list<ArchiveResourceMapping> archiveResourceMappingList_;
|
||||
|
||||
public:
|
||||
CefViewBrowserApp(const CefString& scheme_name,
|
||||
const CefString& bridge_name,
|
||||
CefViewBrowserAppDelegateInterface::RefPtr delegate);
|
||||
|
||||
~CefViewBrowserApp();
|
||||
|
||||
void CheckInClient(void* ctx, const CefViewBrowserClientDelegateInterface::RefPtr& handler);
|
||||
|
||||
void CheckOutClient(void* ctx);
|
||||
|
||||
CefViewBrowserClientDelegateInterface::RefPtr GetClientHandler(void* ctx);
|
||||
|
||||
void AddLocalFolderResource(const CefString& path, const CefString& url, int priority = 0);
|
||||
const std::list<FolderResourceMapping>& FolderResourceMappingList();
|
||||
|
||||
void AddArchiveResource(const CefString& path,
|
||||
const CefString& url,
|
||||
const CefString& password = "",
|
||||
int priority = 0);
|
||||
const std::list<ArchiveResourceMapping>& ArchiveResourceMappingList();
|
||||
|
||||
bool AddGlobalCookie(const CefString& name,
|
||||
const CefString& value,
|
||||
const CefString& domain,
|
||||
const CefString& url);
|
||||
|
||||
bool DeleteAllCookies();
|
||||
|
||||
bool AddCrossOriginWhitelistEntry(const CefString& sourceOrigin,
|
||||
const CefString& targetSchema,
|
||||
const CefString& targetDomain,
|
||||
bool allowTargetSubdomains);
|
||||
|
||||
bool RemoveCrossOriginWhitelistEntry(const CefString& sourceOrigin,
|
||||
const CefString& targetSchema,
|
||||
const CefString& targetDomain,
|
||||
bool allowTargetSubdomains);
|
||||
|
||||
bool ClearCrossOriginWhitelistEntry();
|
||||
|
||||
bool IsSafeToExit();
|
||||
|
||||
private:
|
||||
#pragma region CefApp
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CefApp methods:
|
||||
virtual void OnBeforeCommandLineProcessing(const CefString& process_type,
|
||||
CefRefPtr<CefCommandLine> command_line) override;
|
||||
|
||||
virtual void OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) override;
|
||||
|
||||
virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler() override;
|
||||
|
||||
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override;
|
||||
|
||||
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CefBrowserProcessHandler
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CefBrowserProcessHandler methods:
|
||||
virtual void OnContextInitialized() override;
|
||||
|
||||
virtual void OnBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> command_line) override;
|
||||
|
||||
virtual void OnScheduleMessagePumpWork(int64_t delay_ms) override;
|
||||
|
||||
CefRefPtr<CefClient> GetDefaultClient() override;
|
||||
|
||||
#pragma endregion
|
||||
};
|
||||
|
||||
#endif
|
59
3rdparty/QCefView/include/QCefCore/CefViewBrowserAppDelegate.h
vendored
Normal file
59
3rdparty/QCefView/include/QCefCore/CefViewBrowserAppDelegate.h
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// CefViewBrowserAppDelegate.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2020/6/11.
|
||||
//
|
||||
|
||||
#ifndef CefViewBrowserAppDelegate_h
|
||||
#define CefViewBrowserAppDelegate_h
|
||||
#pragma once
|
||||
|
||||
#pragma region stl_headers
|
||||
#include <memory>
|
||||
#pragma endregion
|
||||
|
||||
#include <CefViewCoreGlobal.h>
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class CefViewBrowserAppDelegateInterface
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
typedef std::shared_ptr<CefViewBrowserAppDelegateInterface> RefPtr;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
typedef std::weak_ptr<CefViewBrowserAppDelegateInterface> WeakPtr;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~CefViewBrowserAppDelegateInterface(){};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="process_type"></param>
|
||||
/// <param name="command_line"></param>
|
||||
virtual void onBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line) = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="command_line"></param>
|
||||
virtual void onBeforeChildProcessLaunch(CefRefPtr<CefCommandLine> command_line) = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="delay_ms"></param>
|
||||
virtual void onScheduleMessageLoopWork(int64_t delay_ms) = 0;
|
||||
};
|
||||
|
||||
#endif
|
477
3rdparty/QCefView/include/QCefCore/CefViewBrowserClient.h
vendored
Normal file
477
3rdparty/QCefView/include/QCefCore/CefViewBrowserClient.h
vendored
Normal file
@ -0,0 +1,477 @@
|
||||
//
|
||||
// CefViewBrowserClient.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2020/6/11.
|
||||
//
|
||||
|
||||
#ifndef CefViewBrowserHandler_h
|
||||
#define CefViewBrowserHandler_h
|
||||
#pragma once
|
||||
|
||||
#pragma region stl_headers
|
||||
#include <unordered_map>
|
||||
#pragma endregion
|
||||
|
||||
#include <CefViewCoreGlobal.h>
|
||||
#include <CefViewBrowserApp.h>
|
||||
#include <CefViewBrowserClientDelegate.h>
|
||||
|
||||
#if CEF_VERSION_MAJOR < 122
|
||||
#define CEFVIEW_MAIN_FRAME (0)
|
||||
#define CEFVIEW_ALL_FRAMES (-1)
|
||||
#else
|
||||
#define CEFVIEW_MAIN_FRAME ("0")
|
||||
#define CEFVIEW_ALL_FRAMES ("-1")
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Forward declaration
|
||||
/// </summary>
|
||||
class CefViewQueryHandler;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class CefViewBrowserClient
|
||||
: public CefClient
|
||||
, public CefContextMenuHandler
|
||||
, public CefDialogHandler
|
||||
, public CefDisplayHandler
|
||||
, public CefDownloadHandler
|
||||
, public CefDragHandler
|
||||
, public CefFindHandler
|
||||
, public CefFocusHandler
|
||||
, public CefJSDialogHandler
|
||||
, public CefKeyboardHandler
|
||||
, public CefLifeSpanHandler
|
||||
, public CefLoadHandler
|
||||
, public CefRequestHandler
|
||||
, public CefResourceRequestHandler
|
||||
, public CefRenderHandler
|
||||
{
|
||||
IMPLEMENT_REFCOUNTING(CefViewBrowserClient);
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
CefRefPtr<CefViewBrowserApp> app_;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
CefViewBrowserClientDelegateInterface::WeakPtr client_delegate_;
|
||||
|
||||
// flags
|
||||
bool is_closing_;
|
||||
bool close_by_native_;
|
||||
bool initial_navigation_;
|
||||
|
||||
// message router
|
||||
CefMessageRouterConfig message_router_config_;
|
||||
CefRefPtr<CefMessageRouterBrowserSide> message_router_;
|
||||
CefRefPtr<CefViewQueryHandler> message_router_handler_;
|
||||
|
||||
// resource manager
|
||||
CefRefPtr<CefResourceManager> resource_manager_;
|
||||
|
||||
// browser map
|
||||
std::unordered_map<int, CefRefPtr<CefBrowser>> browser_map_;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="app_"></param>
|
||||
/// <param name="delegate"></param>
|
||||
CefViewBrowserClient(CefRefPtr<CefViewBrowserApp> app, CefViewBrowserClientDelegateInterface::RefPtr delegate);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
~CefViewBrowserClient();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
int GetBrowserCount() { return static_cast<int>(browser_map_.size()); }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void CloseAllBrowsers();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dir_path"></param>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="priority"></param>
|
||||
void AddLocalDirectoryResourceProvider(const CefString& dir_path, const CefString& url, int priority = 0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="archive_path"></param>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="priority"></param>
|
||||
void AddArchiveResourceProvider(const CefString& archive_path,
|
||||
const CefString& url,
|
||||
const CefString& password,
|
||||
int priority = 0);
|
||||
|
||||
bool TriggerEvent(CefRefPtr<CefBrowser> browser, const CefFrameId& frame_id, const CefRefPtr<CefProcessMessage> msg);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="success"></param>
|
||||
/// <param name="response"></param>
|
||||
/// <param name="error"></param>
|
||||
/// <returns></returns>
|
||||
bool ResponseQuery(const int64_t query, bool success, const CefString& response, int error);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="browser"></param>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
bool AsyncExecuteJSCode(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& code,
|
||||
const CefString& url,
|
||||
const CefString& context);
|
||||
|
||||
protected:
|
||||
bool DispatchRenderMessage(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefProcessMessage> message);
|
||||
|
||||
bool OnRenderFocusedNodeChangedMessage(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefProcessMessage> message);
|
||||
|
||||
bool OnRenderInvokeMethodMessage(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefProcessMessage> message);
|
||||
|
||||
bool OnRenderReportJSResultMessage(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefProcessMessage> message);
|
||||
|
||||
// CefClient methods:
|
||||
#pragma region CefContextMenuHandler
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefContextMenuHandler methods
|
||||
#pragma region CefContextMenuHandler
|
||||
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() override;
|
||||
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model) override;
|
||||
virtual bool RunContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model,
|
||||
CefRefPtr<CefRunContextMenuCallback> callback) override;
|
||||
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
EventFlags event_flags) override;
|
||||
virtual void OnContextMenuDismissed(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefDialogHandler
|
||||
#pragma region CefDialogHandler
|
||||
virtual CefRefPtr<CefDialogHandler> GetDialogHandler() override;
|
||||
|
||||
#if CEF_VERSION_MAJOR < 102
|
||||
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
|
||||
FileDialogMode mode,
|
||||
const CefString& title,
|
||||
const CefString& default_file_path,
|
||||
const std::vector<CefString>& accept_filters,
|
||||
int selected_accept_filter,
|
||||
CefRefPtr<CefFileDialogCallback> callback) override;
|
||||
#elif CEF_VERSION_MAJOR < 126
|
||||
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
|
||||
FileDialogMode mode,
|
||||
const CefString& title,
|
||||
const CefString& default_file_path,
|
||||
const std::vector<CefString>& accept_filters,
|
||||
CefRefPtr<CefFileDialogCallback> callback) override;
|
||||
#else
|
||||
virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
|
||||
FileDialogMode mode,
|
||||
const CefString& title,
|
||||
const CefString& default_file_path,
|
||||
const std::vector<CefString>& accept_filters,
|
||||
const std::vector<CefString>& accept_extensions,
|
||||
const std::vector<CefString>& accept_descriptions,
|
||||
CefRefPtr<CefFileDialogCallback> callback) override;
|
||||
#endif
|
||||
|
||||
#pragma endregion
|
||||
|
||||
// CefDisplayHandler methods
|
||||
#pragma region CefDisplayHandler
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() override;
|
||||
virtual void OnAddressChange(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& url) override;
|
||||
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title) override;
|
||||
virtual void OnFaviconURLChange(CefRefPtr<CefBrowser> browser, const std::vector<CefString>& icon_urls) override;
|
||||
virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser, bool fullscreen) override;
|
||||
virtual bool OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text) override;
|
||||
virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser, const CefString& value) override;
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
cef_log_severity_t level,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) override;
|
||||
virtual bool OnAutoResize(CefRefPtr<CefBrowser> browser, const CefSize& new_size) override;
|
||||
virtual void OnLoadingProgressChange(CefRefPtr<CefBrowser> browser, double progress) override;
|
||||
virtual bool OnCursorChange(CefRefPtr<CefBrowser> browser,
|
||||
CefCursorHandle cursor,
|
||||
cef_cursor_type_t type,
|
||||
const CefCursorInfo& custom_cursor_info) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefDownloadHandler
|
||||
#pragma region CefDownloadHandler
|
||||
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() override;
|
||||
#if CEF_VERSION_MAJOR < 125
|
||||
virtual void OnBeforeDownload(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) override;
|
||||
#else
|
||||
virtual bool OnBeforeDownload(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) override;
|
||||
#endif
|
||||
|
||||
void OnDownloadUpdated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
CefRefPtr<CefDownloadItemCallback> callback) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefDragHandler methods
|
||||
#pragma region CefDragHandler
|
||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() override;
|
||||
virtual bool OnDragEnter(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> dragData,
|
||||
CefDragHandler::DragOperationsMask mask) override;
|
||||
|
||||
virtual void OnDraggableRegionsChanged(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const std::vector<CefDraggableRegion>& regions) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefFindHandler methods
|
||||
#pragma region CefFindHandler
|
||||
virtual CefRefPtr<CefFindHandler> GetFindHandler() override;
|
||||
virtual void OnFindResult(CefRefPtr<CefBrowser> browser,
|
||||
int identifier,
|
||||
int count,
|
||||
const CefRect& selectionRect,
|
||||
int activeMatchOrdinal,
|
||||
bool finalUpdate) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefFocusHandler methods
|
||||
#pragma region CefFocusHandler
|
||||
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() override;
|
||||
void OnTakeFocus(CefRefPtr<CefBrowser> browser, bool next) override;
|
||||
bool OnSetFocus(CefRefPtr<CefBrowser> browser, FocusSource source) override;
|
||||
void OnGotFocus(CefRefPtr<CefBrowser> browser) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefJSDialogHandler methods
|
||||
#pragma region CefJSDialogHandler
|
||||
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() override;
|
||||
virtual bool OnJSDialog(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& origin_url,
|
||||
JSDialogType dialog_type,
|
||||
const CefString& message_text,
|
||||
const CefString& default_prompt_text,
|
||||
CefRefPtr<CefJSDialogCallback> callback,
|
||||
bool& suppress_message) override;
|
||||
virtual bool OnBeforeUnloadDialog(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message_text,
|
||||
bool is_reload,
|
||||
CefRefPtr<CefJSDialogCallback> callback) override;
|
||||
virtual void OnResetDialogState(CefRefPtr<CefBrowser> browser) override;
|
||||
virtual void OnDialogClosed(CefRefPtr<CefBrowser> browser) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefKeyboardHandler methods
|
||||
#pragma region CefKeyboardHandler
|
||||
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() override;
|
||||
virtual bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event,
|
||||
bool* is_keyboard_shortcut) override;
|
||||
virtual bool OnKeyEvent(CefRefPtr<CefBrowser> browser, const CefKeyEvent& event, CefEventHandle os_event) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefLifeSpanHandler methods:
|
||||
#pragma region CefLifeSpanHandler
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override;
|
||||
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
#if CEF_VERSION_MAJOR > 131
|
||||
int popup_id,
|
||||
#endif
|
||||
const CefString& target_url,
|
||||
const CefString& target_frame_name,
|
||||
CefLifeSpanHandler::WindowOpenDisposition target_disposition,
|
||||
bool user_gesture,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient>& client,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
bool* no_javascript_access) override;
|
||||
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
|
||||
virtual bool DoClose(CefRefPtr<CefBrowser> browser) override;
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefLoadHandler methods
|
||||
#pragma region CefLoadHandler
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() override;
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) override;
|
||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
TransitionType transition_type) override;
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int httpStatusCode) override;
|
||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefRenderHandler
|
||||
#pragma region CefRenderHandler
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() override;
|
||||
virtual CefRefPtr<CefAccessibilityHandler> GetAccessibilityHandler() override;
|
||||
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
|
||||
virtual void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) override;
|
||||
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser, int viewX, int viewY, int& screenX, int& screenY) override;
|
||||
virtual bool GetScreenInfo(CefRefPtr<CefBrowser> browser, CefScreenInfo& screen_info) override;
|
||||
virtual void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) override;
|
||||
virtual void OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect) override;
|
||||
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
const void* buffer,
|
||||
int width,
|
||||
int height) override;
|
||||
#if CEF_VERSION_MAJOR < 124
|
||||
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
void* shared_handle) override;
|
||||
#else
|
||||
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
const CefAcceleratedPaintInfo& info) override;
|
||||
#endif
|
||||
virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDragData> drag_data,
|
||||
CefRenderHandler::DragOperationsMask allowed_ops,
|
||||
int x,
|
||||
int y) override;
|
||||
virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser, DragOperation operation) override;
|
||||
virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser, double x, double y) override;
|
||||
virtual void OnImeCompositionRangeChanged(CefRefPtr<CefBrowser> browser,
|
||||
const CefRange& selected_range,
|
||||
const RectList& character_bounds) override;
|
||||
virtual void OnTextSelectionChanged(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& selected_text,
|
||||
const CefRange& selected_range) override;
|
||||
virtual void OnVirtualKeyboardRequested(CefRefPtr<CefBrowser> browser, TextInputMode input_mode) override;
|
||||
#pragma endregion
|
||||
|
||||
// CefRequestHandler methods
|
||||
#pragma region CefRequestHandler
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() override;
|
||||
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
bool user_gesture,
|
||||
bool is_redirect) override;
|
||||
|
||||
virtual bool OnOpenURLFromTab(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& target_url,
|
||||
CefRequestHandler::WindowOpenDisposition target_disposition,
|
||||
bool user_gesture) override;
|
||||
#if CEF_VERSION_MAJOR > 91 && CEF_VERSION_MAJOR < 109
|
||||
virtual bool OnQuotaRequest(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& origin_url,
|
||||
int64 new_size,
|
||||
CefRefPtr<CefCallback> callback) override;
|
||||
#endif
|
||||
|
||||
#if CEF_VERSION_MAJOR < 124
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser, TerminationStatus status) override;
|
||||
#else
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status,
|
||||
int error_code,
|
||||
const CefString& error_string) override;
|
||||
#endif
|
||||
|
||||
#pragma endregion
|
||||
|
||||
// CefResourceRequestHandler
|
||||
#pragma region CefResourceRequestHandler
|
||||
virtual CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
const CefString& request_initiator,
|
||||
bool& disable_default_handling) override;
|
||||
|
||||
virtual ReturnValue OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
#if CEF_VERSION_MAJOR > 91
|
||||
CefRefPtr<CefCallback> callback
|
||||
#else
|
||||
CefRefPtr<CefRequestCallback> callback
|
||||
#endif
|
||||
) override;
|
||||
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) override;
|
||||
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
bool& allow_os_execution) override;
|
||||
#pragma endregion
|
||||
};
|
||||
#endif
|
311
3rdparty/QCefView/include/QCefCore/CefViewBrowserClientDelegate.h
vendored
Normal file
311
3rdparty/QCefView/include/QCefCore/CefViewBrowserClientDelegate.h
vendored
Normal file
@ -0,0 +1,311 @@
|
||||
//
|
||||
// CefViewBrowserHandlerDelegate.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2020/6/11.
|
||||
//
|
||||
|
||||
#ifndef CefViewBrowserHandlerDelegate_h
|
||||
#define CefViewBrowserHandlerDelegate_h
|
||||
#pragma once
|
||||
|
||||
#pragma region stl_headers
|
||||
#include <memory>
|
||||
#pragma endregion
|
||||
|
||||
#include <CefViewCoreGlobal.h>
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
class CefViewBrowserClientDelegateInterface
|
||||
{
|
||||
public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
typedef std::shared_ptr<CefViewBrowserClientDelegateInterface> RefPtr;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
typedef std::weak_ptr<CefViewBrowserClientDelegateInterface> WeakPtr;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
virtual ~CefViewBrowserClientDelegateInterface() {}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="browser"></param>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="url"></param>
|
||||
virtual void processUrlRequest(CefRefPtr<CefBrowser>& browser, CefRefPtr<CefFrame>& frame, const CefString& url) = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="browser"></param>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="query_id"></param>
|
||||
virtual void processQueryRequest(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
const CefString& query,
|
||||
const int64_t query_id) = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="browser"></param>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="focusOnEditableNode"></param>
|
||||
virtual void focusedEditableNodeChanged(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
bool focusOnEditableNode) = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="browser"></param>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="method"></param>
|
||||
/// <param name="arguments"></param>
|
||||
virtual void invokeMethodNotify(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
const CefString& method,
|
||||
const CefRefPtr<CefListValue>& arguments) = 0;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="browser"></param>
|
||||
/// <param name="frame"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="result"></param>
|
||||
virtual void reportJSResult(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
const CefString& context,
|
||||
const CefRefPtr<CefValue>& result) = 0;
|
||||
|
||||
// context menu handler
|
||||
#pragma region ContextMenuHandler
|
||||
virtual void onBeforeContextMenu(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
CefRefPtr<CefContextMenuParams>& params,
|
||||
CefRefPtr<CefMenuModel>& model) = 0;
|
||||
virtual bool onRunContextMenu(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
CefRefPtr<CefContextMenuParams>& params,
|
||||
CefRefPtr<CefMenuModel>& model,
|
||||
CefRefPtr<CefRunContextMenuCallback>& callback) = 0;
|
||||
virtual bool onContextMenuCommand(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
CefRefPtr<CefContextMenuParams>& params,
|
||||
int command_id,
|
||||
CefContextMenuHandler::EventFlags event_flags) = 0;
|
||||
virtual void onContextMenuDismissed(CefRefPtr<CefBrowser>& browser, CefRefPtr<CefFrame>& frame) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// dialog handler
|
||||
#pragma region DialogHandler
|
||||
virtual bool onFileDialog(CefRefPtr<CefBrowser>& browser,
|
||||
CefBrowserHost::FileDialogMode mode,
|
||||
const CefString& title,
|
||||
const CefString& default_file_path,
|
||||
const std::vector<CefString>& accept_filters,
|
||||
#if CEF_VERSION_MAJOR < 102
|
||||
int selected_accept_filter,
|
||||
#endif
|
||||
CefRefPtr<CefFileDialogCallback>& callback)
|
||||
{
|
||||
return false;
|
||||
};
|
||||
#pragma endregion
|
||||
|
||||
// display handler
|
||||
#pragma region DisplayHandler
|
||||
virtual void addressChanged(CefRefPtr<CefBrowser>& browser, CefRefPtr<CefFrame>& frame, const CefString& url) = 0;
|
||||
|
||||
virtual void titleChanged(CefRefPtr<CefBrowser>& browser, const CefString& title) = 0;
|
||||
|
||||
virtual void faviconURLChanged(CefRefPtr<CefBrowser>& browser, const std::vector<CefString>& icon_urls) = 0;
|
||||
|
||||
virtual bool tooltipMessage(CefRefPtr<CefBrowser>& browser, const CefString& text) = 0;
|
||||
|
||||
virtual void fullscreenModeChanged(CefRefPtr<CefBrowser>& browser, bool fullscreen) = 0;
|
||||
|
||||
virtual void statusMessage(CefRefPtr<CefBrowser>& browser, const CefString& value) = 0;
|
||||
|
||||
virtual void loadingProgressChanged(CefRefPtr<CefBrowser>& browser, double progress) = 0;
|
||||
|
||||
virtual void consoleMessage(CefRefPtr<CefBrowser>& browser, const CefString& message, int level) = 0;
|
||||
|
||||
virtual bool cursorChanged(CefRefPtr<CefBrowser>& browser,
|
||||
CefCursorHandle cursor,
|
||||
cef_cursor_type_t type,
|
||||
const CefCursorInfo& custom_cursor_info) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// download hander
|
||||
#pragma region DownloadHandler
|
||||
virtual void onBeforeDownload(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefDownloadItem>& download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback>& callback) = 0;
|
||||
|
||||
virtual void onDownloadUpdated(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefDownloadItem>& download_item,
|
||||
CefRefPtr<CefDownloadItemCallback>& callback) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// drag hander
|
||||
#pragma region DragHandler
|
||||
virtual bool onDragEnter(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefDragData>& dragData,
|
||||
CefDragHandler::DragOperationsMask mask)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void draggableRegionChanged(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
const std::vector<CefDraggableRegion>& regions) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// focus handler
|
||||
#pragma region FocusHandler
|
||||
virtual void takeFocus(CefRefPtr<CefBrowser>& browser, bool next) = 0;
|
||||
|
||||
virtual bool setFocus(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
|
||||
virtual void gotFocus(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// JS dialog handler
|
||||
#pragma region JSDialogHandler
|
||||
virtual bool onJSDialog(CefRefPtr<CefBrowser>& browser,
|
||||
const CefString& origin_url,
|
||||
CefJSDialogHandler::JSDialogType dialog_type,
|
||||
const CefString& message_text,
|
||||
const CefString& default_prompt_text,
|
||||
CefRefPtr<CefJSDialogCallback>& callback,
|
||||
bool& suppress_message) = 0;
|
||||
|
||||
virtual bool onBeforeUnloadDialog(CefRefPtr<CefBrowser>& browser,
|
||||
const CefString& message_text,
|
||||
bool is_reload,
|
||||
CefRefPtr<CefJSDialogCallback>& callback) = 0;
|
||||
virtual void onResetDialogState(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
virtual void onDialogClosed(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// keyboard handler
|
||||
#pragma region KeyboardHandler
|
||||
virtual bool onPreKeyEvent(CefRefPtr<CefBrowser>& browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event,
|
||||
bool* is_keyboard_shortcut) = 0;
|
||||
|
||||
virtual bool onKeyEvent(CefRefPtr<CefBrowser>& browser, const CefKeyEvent& event, CefEventHandle os_event) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// life span handler
|
||||
#pragma region LifeSpanHandler
|
||||
virtual bool onBeforePopup(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
const CefString& targetUrl,
|
||||
const CefString& targetFrameName,
|
||||
CefLifeSpanHandler::WindowOpenDisposition targetDisposition,
|
||||
CefWindowInfo& windowInfo,
|
||||
CefBrowserSettings& settings,
|
||||
bool& DisableJavascriptAccess) = 0;
|
||||
virtual void onAfterCreate(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
|
||||
virtual bool doClose(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
|
||||
virtual bool requestClose(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
|
||||
virtual void onBeforeClose(CefRefPtr<CefBrowser>& browser) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// load handler
|
||||
#pragma region LoadHandler
|
||||
virtual void loadingStateChanged(CefRefPtr<CefBrowser>& browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) = 0;
|
||||
|
||||
virtual void loadStart(CefRefPtr<CefBrowser>& browser, CefRefPtr<CefFrame>& frame, int transition_type) = 0;
|
||||
|
||||
virtual void loadEnd(CefRefPtr<CefBrowser>& browser, CefRefPtr<CefFrame>& frame, int httpStatusCode) = 0;
|
||||
|
||||
virtual void loadError(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefFrame>& frame,
|
||||
int errorCode,
|
||||
const CefString& errorMsg,
|
||||
const CefString& failedUrl,
|
||||
bool& handled) = 0;
|
||||
#pragma endregion
|
||||
|
||||
// Off screen rendering
|
||||
#pragma region RenderHandler
|
||||
virtual bool getRootScreenRect(CefRefPtr<CefBrowser>& browser, CefRect& rect) { return false; }
|
||||
virtual void getViewRect(CefRefPtr<CefBrowser>& browser, CefRect& rect) {}
|
||||
virtual bool getScreenPoint(CefRefPtr<CefBrowser>& browser, int viewX, int viewY, int& screenX, int& screenY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool getScreenInfo(CefRefPtr<CefBrowser>& browser, CefScreenInfo& screen_info) { return false; }
|
||||
virtual void onPopupShow(CefRefPtr<CefBrowser>& browser, bool show) {}
|
||||
virtual void onPopupSize(CefRefPtr<CefBrowser>& browser, const CefRect& rect) {}
|
||||
virtual void onPaint(CefRefPtr<CefBrowser>& browser,
|
||||
CefRenderHandler::PaintElementType type,
|
||||
const CefRenderHandler::RectList& dirtyRects,
|
||||
const void* buffer,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
}
|
||||
#if CEF_VERSION_MAJOR < 124
|
||||
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser>& browser,
|
||||
CefRenderHandler::PaintElementType type,
|
||||
const CefRenderHandler::RectList& dirtyRects,
|
||||
void* shared_handle)
|
||||
{
|
||||
}
|
||||
#else
|
||||
virtual void onAcceleratedPaint(CefRefPtr<CefBrowser>& browser,
|
||||
CefRenderHandler::PaintElementType type,
|
||||
const CefRenderHandler::RectList& dirtyRects,
|
||||
const CefAcceleratedPaintInfo& info)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
virtual bool startDragging(CefRefPtr<CefBrowser>& browser,
|
||||
CefRefPtr<CefDragData>& drag_data,
|
||||
CefRenderHandler::DragOperationsMask allowed_ops,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void updateDragCursor(CefRefPtr<CefBrowser>& browser, CefRenderHandler::DragOperation operation) {}
|
||||
virtual void onScrollOffsetChanged(CefRefPtr<CefBrowser>& browser, double x, double y) {}
|
||||
virtual void onImeCompositionRangeChanged(CefRefPtr<CefBrowser>& browser,
|
||||
const CefRange& selected_range,
|
||||
const CefRenderHandler::RectList& character_bounds)
|
||||
{
|
||||
}
|
||||
virtual void onTextSelectionChanged(CefRefPtr<CefBrowser>& browser,
|
||||
const CefString& selected_text,
|
||||
const CefRange& selected_range)
|
||||
{
|
||||
}
|
||||
virtual void onVirtualKeyboardRequested(CefRefPtr<CefBrowser>& browser, CefRenderHandler::TextInputMode input_mode) {}
|
||||
#pragma endregion
|
||||
};
|
||||
|
||||
#endif
|
44
3rdparty/QCefView/include/QCefCore/CefViewCoreGlobal.h
vendored
Normal file
44
3rdparty/QCefView/include/QCefCore/CefViewCoreGlobal.h
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
//
|
||||
// CefViewCoreGlobal.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2023/5/30.
|
||||
//
|
||||
|
||||
#ifndef CefViewCoreGlobal_h
|
||||
#define CefViewCoreGlobal_h
|
||||
#pragma once
|
||||
|
||||
#pragma region stl_headers
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#pragma endregion
|
||||
|
||||
#pragma region cef_headers
|
||||
#include <include/cef_app.h>
|
||||
#include <include/cef_client.h>
|
||||
#include <include/cef_version.h>
|
||||
#include <include/cef_parser.h>
|
||||
#include <include/wrapper/cef_helpers.h>
|
||||
#include <include/wrapper/cef_message_router.h>
|
||||
#include <include/wrapper/cef_resource_manager.h>
|
||||
#pragma endregion
|
||||
|
||||
#if CEF_VERSION_MAJOR < 122
|
||||
using CefFrameId = int64_t;
|
||||
#else
|
||||
using CefFrameId = CefString;
|
||||
|
||||
template<>
|
||||
struct std::hash<CefFrameId>
|
||||
{
|
||||
std::size_t operator()(const CefFrameId& k) const
|
||||
{
|
||||
using std::hash;
|
||||
using std::string;
|
||||
return std::hash<std::string>()(k.ToString());
|
||||
}
|
||||
};
|
||||
#endif // CEF_VERSION_MAJOR < 122
|
||||
|
||||
#endif // CefViewCoreGlobal_h
|
135
3rdparty/QCefView/include/QCefCore/CefViewCoreProtocol.h
vendored
Normal file
135
3rdparty/QCefView/include/QCefCore/CefViewCoreProtocol.h
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
//
|
||||
// CefViewCoreProtocol.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2020/6/11.
|
||||
// This file was generated during CMake configuring.
|
||||
// Do not edit this file directly by manual.
|
||||
// Edit the CefViewCoreProtocol.h.in and then re-config project with CMake.
|
||||
//
|
||||
|
||||
#ifndef CefViewCoreProtocol_h
|
||||
#define CefViewCoreProtocol_h
|
||||
#pragma once
|
||||
|
||||
/// <summary>
|
||||
/// CefView Helper Process Name
|
||||
/// </summary>
|
||||
#define kCefViewRenderProcessName "CefViewWing"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewQueryFuntionName "cefViewQuery"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewQueryCancelFunctionName "cefViewQueryCancel"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewBridgeObjectNameKey "bridge-obj-name"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewBuiltinSchemeNameKey "builtin-scheme-name"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewWindowsJobNameKey "windows-job-name"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewDefaultBridgeObjectName "CefViewClient"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewDefaultBuiltinSchemaName "CefView"
|
||||
|
||||
/// <summary>
|
||||
/// CEFVIEWClient.invokeMethod("method_name", ...)
|
||||
/// </summary>
|
||||
#define kCefViewInvokeMethodFunctionName "invoke"
|
||||
|
||||
/// <summary>
|
||||
/// CEFVIEWClient.addEventListener(type, listener)
|
||||
/// </summary>
|
||||
#define kCefViewAddEventListenerFunctionName "addEventListener"
|
||||
|
||||
/// <summary>
|
||||
/// CEFVIEWClient.removeEventListener(type, listener)
|
||||
/// </summary>
|
||||
#define kCefViewRemoveEventListenerFunctionName "removeEventListener"
|
||||
|
||||
/// <summary>
|
||||
/// this message is sent from render process to browser process
|
||||
/// and is processed in the Qt UI thread
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewClientRenderFocusedNodeChangedMessage "CefViewClientRender.FocusedNodeChanged"
|
||||
|
||||
/// <summary>
|
||||
/// this message is sent from render process to browser process
|
||||
/// and is processed in the Qt UI thread
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewClientRenderReportJSResultMessage "CefViewClientRender.ReportJSResult"
|
||||
|
||||
/// <summary>
|
||||
/// this message is sent from render process to browser process
|
||||
/// and is processed in the Qt UI thread
|
||||
///
|
||||
/// format
|
||||
/// msg.name
|
||||
/// msg.arg[0]: function name
|
||||
/// msg.arg[1~...]: function parameters
|
||||
/// </summary>
|
||||
#define kCefViewClientRenderInvokeMethodMessage "CefViewClientRender.InvokeMethod"
|
||||
|
||||
/// <summary>
|
||||
/// this message is sent from browser process to render process
|
||||
/// and is processed in the CefRenderer_Main thread
|
||||
///
|
||||
/// format:
|
||||
/// msg.name:
|
||||
/// msg.arg[0]: function name
|
||||
/// msg.arg[1~...]: function parameters
|
||||
/// </summary>
|
||||
#define kCefViewClientBrowserTriggerEventMessage "CefViewClientBrowser.TriggerEvent"
|
||||
|
||||
/// <summary>
|
||||
/// window.__cefview_report_js_result__(context, result)
|
||||
/// context must be double
|
||||
/// </summary>
|
||||
#define kCefViewReportJSResultFunctionName "__cefview_report_js_result__"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewResourceDirectoryName "resources"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#define kCefViewLocalesDirectoryName "locales"
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
#if defined(OS_WINDOWS)
|
||||
#define kCefViewDefaultUserAgent "CefView/1.0 (Windows; en-us)"
|
||||
#elif defined(OS_MACOS)
|
||||
#define kCefViewDefaultUserAgent "CefView/1.0 (macOS; en-us)"
|
||||
#elif defined(OS_LINUX)
|
||||
#define kCefViewDefaultUserAgent "CefView/1.0 (Linux; en-us)"
|
||||
#else
|
||||
#define kCefViewDefaultUserAgent "CefView/1.0 (Unknown; en-us)"
|
||||
#endif
|
||||
|
||||
#endif
|
24
3rdparty/QCefView/include/QCefView/CefVersion.h
vendored
Normal file
24
3rdparty/QCefView/include/QCefView/CefVersion.h
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// CefVersion.h
|
||||
// CefViewCore
|
||||
//
|
||||
// Created by Sheen Tian on 2025/1/19.
|
||||
// This file was generated during CMake configuring.
|
||||
// Do not edit this file directly by manual.
|
||||
// Edit the CefVersion.h.in and then re-config project with CMake.
|
||||
//
|
||||
|
||||
#ifndef CefVersion_h
|
||||
#define CefVersion_h
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#define CEF_VERSION "134.3.6+g96006d1+chromium-134.0.6998.118"
|
||||
#define CEF_VERSION_MAJOR 134
|
||||
#define CEF_VERSION_MINOR 3
|
||||
#define CEF_VERSION_PATCH 6
|
||||
#define CEF_COMMIT_NUMBER 3155
|
||||
#define CEF_COMMIT_HASH "96006d11935cd82a004d992db6e7124825352e19"
|
||||
// clang-format on
|
||||
|
||||
#endif // CefVersion
|
320
3rdparty/QCefView/include/QCefView/QCefConfig.h
vendored
Normal file
320
3rdparty/QCefView/include/QCefView/QCefConfig.h
vendored
Normal file
@ -0,0 +1,320 @@
|
||||
/*
|
||||
* File: QCefConfig.h
|
||||
* Project: QCefView
|
||||
* Created: 21nd January 2021
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFCONFIG_H
|
||||
#define QCEFCONFIG_H
|
||||
#pragma once
|
||||
#include <QCefView_global.h>
|
||||
|
||||
#pragma region qt_headers
|
||||
#include <QColor>
|
||||
#include <QScopedPointer>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#pragma endregion
|
||||
|
||||
class QCefConfigPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the CEF setting. For more details please refer to:
|
||||
/// https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage.md#markdown-header-cefsettings
|
||||
/// </summary>
|
||||
class QCEFVIEW_EXPORT QCefConfig
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QCefConfig)
|
||||
QScopedPointer<QCefConfigPrivate> d_ptr;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Represents the log severity
|
||||
/// </summary>
|
||||
enum LogLevel
|
||||
{
|
||||
/// Default logging (currently INFO logging)
|
||||
LOGSEVERITY_DEFAULT,
|
||||
|
||||
/// Verbose logging
|
||||
LOGSEVERITY_VERBOSE,
|
||||
|
||||
/// DEBUG logging
|
||||
LOGSEVERITY_DEBUG,
|
||||
|
||||
/// INFO logging
|
||||
LOGSEVERITY_INFO,
|
||||
|
||||
/// WARNING logging
|
||||
LOGSEVERITY_WARNING,
|
||||
|
||||
/// ERROR logging
|
||||
LOGSEVERITY_ERROR,
|
||||
|
||||
/// FATAL logging
|
||||
LOGSEVERITY_FATAL,
|
||||
|
||||
/// Disable logging to file for all messages, and to stderr for messages with severity less than FATAL
|
||||
LOGSEVERITY_DISABLE = 99
|
||||
};
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructs a CEF config instance
|
||||
/// </summary>
|
||||
QCefConfig();
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a CEF setting from existing one
|
||||
/// </summary>
|
||||
QCefConfig(const QCefConfig& other);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns an existing config to current
|
||||
/// </summary>
|
||||
QCefConfig& operator=(const QCefConfig& other);
|
||||
|
||||
/// <summary>
|
||||
/// Destructs the config
|
||||
/// </summary>
|
||||
~QCefConfig();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a switch to the commandline args used to initialize the CEF
|
||||
/// </summary>
|
||||
/// <param name="smitch">The switch name</param>
|
||||
void addCommandLineSwitch(const QString& smitch);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a switch with value to the commandline args used to initialize the CEF
|
||||
/// </summary>
|
||||
/// <param name="smitch">The swtich name</param>
|
||||
/// <param name="v">The switch value</param>
|
||||
void addCommandLineSwitchWithValue(const QString& smitch, const QString& v);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the flag to enable/disable OSR mode
|
||||
/// </summary>
|
||||
/// <param name="enabled">True to enable OSR mode, false to disable</param>
|
||||
void setWindowlessRenderingEnabled(const bool enabled);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OSR mode flag
|
||||
/// </summary>
|
||||
/// <returns>The flag indicates the enable/disable of OSR mode</returns>
|
||||
const QVariant WindowlessRenderingEnabled() const;
|
||||
|
||||
#if !defined(Q_OS_MACOS)
|
||||
/// <summary>
|
||||
/// Sets the browser subprocess path
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the sub process executable</param>
|
||||
void setBrowserSubProcessPath(const QString& path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the browser subprocess path
|
||||
/// </summary>
|
||||
const QString browserSubProcessPath() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the resource directory path
|
||||
/// </summary>
|
||||
/// <param name="path">The resource directory path</param>
|
||||
void setResourceDirectoryPath(const QString& path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resource directory path
|
||||
/// </summary>
|
||||
const QString resourceDirectoryPath() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the locales directory path
|
||||
/// </summary>
|
||||
/// <param name="path">The locales directory path</param>
|
||||
void setLocalesDirectoryPath(const QString& path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the locales directory path
|
||||
/// </summary>
|
||||
const QString localesDirectoryPath() const;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Sets the log level
|
||||
/// </summary>
|
||||
/// <param name="lvl"></param>
|
||||
void setLogLevel(const LogLevel lvl);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the log level
|
||||
/// </summary>
|
||||
/// <returns>The current log level</returns>
|
||||
const QCefConfig::LogLevel logLevel() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the locale
|
||||
/// </summary>
|
||||
/// <param name="locale">The locale to use. If empty the default locale of "en-US" will be used. This value is ignored
|
||||
/// on Linux where locale is determined using environment variable parsing with the precedence order: LANGUAGE,
|
||||
/// LC_ALL, LC_MESSAGES and LANG. Also configurable using the "lang" command-line switch.</param>
|
||||
void setLocale(const QString& locale);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the locale
|
||||
/// </summary>
|
||||
const QString locale() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the user agent
|
||||
/// </summary>
|
||||
/// <param name="agent">The user agent</param>
|
||||
void setUserAgent(const QString& agent);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user agent
|
||||
/// </summary>
|
||||
const QString userAgent() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the cache directory path
|
||||
/// </summary>
|
||||
/// <param name="path">The cache path</param>
|
||||
void setCachePath(const QString& path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the cache directory path
|
||||
/// </summary>
|
||||
const QString cachePath() const;
|
||||
|
||||
#if CEF_VERSION_MAJOR < 115
|
||||
/// <summary>
|
||||
/// Sets the user data directory path
|
||||
/// </summary>
|
||||
/// <param name="path">The user data directory path</param>
|
||||
void setUserDataPath(const QString& path);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user data directory path
|
||||
/// </summary>
|
||||
const QString userDataPath() const;
|
||||
|
||||
#else
|
||||
|
||||
/// <summary>
|
||||
/// Gets the root cache directory path
|
||||
/// </summary>
|
||||
const QString rootCachePath() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the root cache directory path
|
||||
/// </summary>
|
||||
/// <param name="path">The root cache directory path</param>
|
||||
void setRootCachePath(const QString& path);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Sets the bridge object name
|
||||
/// </summary>
|
||||
/// <param name="name">The bridge object name</param>
|
||||
/// <remarks>
|
||||
/// The bridge object represents a Javascript object which will be inserted
|
||||
/// into all browser and frames. This object is designated for communicating
|
||||
/// between Javascript in web content and native context(C/C++) code.
|
||||
/// This object is set as an property of window object. That means it can be
|
||||
/// obtained by calling window.bridgeObject in the Javascript code
|
||||
/// </remarks>
|
||||
void setBridgeObjectName(const QString& name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the bridge object name
|
||||
/// </summary>
|
||||
const QString bridgeObjectName() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the built-in scheme name
|
||||
/// </summary>
|
||||
/// <param name="name">The scheme name</param>
|
||||
/// <remarks>
|
||||
/// The default value is CefView
|
||||
/// </remarks>
|
||||
void setBuiltinSchemeName(const QString& name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the built-in scheme object name
|
||||
/// </summary>
|
||||
const QString builtinSchemeName() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the background color of the web page
|
||||
/// </summary>
|
||||
/// <param name="color">The color to be set</param>
|
||||
/// <remarks>
|
||||
/// This only works if the web page has no background color set. The alpha component value
|
||||
/// will be adjusted to 0 or 255, it means if you pass a value with alpha value
|
||||
/// in the range of [1, 255], it will be accepted as 255. The default value is qRgba(255, 255, 255, 255)
|
||||
/// </remarks>
|
||||
void setBackgroundColor(const QColor& color);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the background color
|
||||
/// </summary>
|
||||
const QVariant backgroundColor() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the acceptable language list
|
||||
/// </summary>
|
||||
/// <param name="languages">Comma delimited ordered list of language codes without any whitespace
|
||||
/// that will be used in the "Accept-Language" HTTP header.</param>
|
||||
void setAcceptLanguageList(const QString& languages);
|
||||
|
||||
/// <summary>
|
||||
/// Get the acceptable language list
|
||||
/// </summary>
|
||||
const QString acceptLanguageList() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether to persist session cookie
|
||||
/// </summary>
|
||||
/// <param name="enabled">True if to persist session cookie</param>
|
||||
void setPersistSessionCookies(bool enabled);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to persist session cookie
|
||||
/// </summary>
|
||||
const QVariant persistSessionCookies() const;
|
||||
|
||||
#if CEF_VERSION_MAJOR < 128
|
||||
/// <summary>
|
||||
/// Sets whether to persist user preferences
|
||||
/// </summary>
|
||||
/// <param name="enabled">True if to persist user preferences</param>
|
||||
void setPersistUserPreferences(bool enabled);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to persist user preferences
|
||||
/// </summary>
|
||||
const QVariant persistUserPreferences() const;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Sets the remote debugging port
|
||||
/// </summary>
|
||||
/// <param name="port">The port to use</param>
|
||||
/// <remarks>
|
||||
/// CEF supports the remote debugging with Dev Tools in Chrome/Edge.
|
||||
/// if this value is set then you can debug the web application by
|
||||
/// accessing http://127.0.0.1:port from Chrome/Edge
|
||||
/// </remarks>
|
||||
void setRemoteDebuggingPort(short port);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the remote debugging port
|
||||
/// </summary>
|
||||
const QVariant remoteDebuggingPort() const;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QCefConfig);
|
||||
|
||||
#endif
|
149
3rdparty/QCefView/include/QCefView/QCefContext.h
vendored
Normal file
149
3rdparty/QCefView/include/QCefView/QCefContext.h
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* File: QCefContext.h
|
||||
* Project: QCefView
|
||||
* Created: 29th March 2016
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFCONTEXT_H
|
||||
#define QCEFCONTEXT_H
|
||||
#pragma once
|
||||
#include <QCefView_global.h>
|
||||
|
||||
#pragma region qt_headers
|
||||
#include <QCoreApplication>
|
||||
#include <QScopedPointer>
|
||||
#pragma endregion
|
||||
|
||||
#include <QCefConfig.h>
|
||||
|
||||
class QCefContextPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the CEF context
|
||||
/// </summary>
|
||||
class QCEFVIEW_EXPORT QCefContext : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QCefContext)
|
||||
QScopedPointer<QCefContextPrivate> d_ptr;
|
||||
|
||||
friend class QCefView;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructs the CEF context
|
||||
/// </summary>
|
||||
/// <param name="app">The application</param>
|
||||
/// <param name="argc">The argument count</param>
|
||||
/// <param name="argv">The argument list pointer</param>
|
||||
/// <param name="config">The <see cref="QCefConfig"/> instance</param>
|
||||
QCefContext(QCoreApplication* app, int argc, char** argv, const QCefConfig* config);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique default instance
|
||||
/// </summary>
|
||||
/// <returns>The default instance</returns>
|
||||
static QCefContext* instance();
|
||||
|
||||
/// <summary>
|
||||
/// Destructs the CEF context
|
||||
/// </summary>
|
||||
~QCefContext();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a url mapping item with local web resource directory. This works for all <see ref="QCefView" /> instances
|
||||
/// created subsequently
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the local resource directory</param>
|
||||
/// <param name="url">The url to be mapped to</param>
|
||||
/// <param name="priority">The priority</param>
|
||||
void addLocalFolderResource(const QString& path, const QString& url, int priority = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a url mapping item with local archive (.zip) file which contains the web resource. This works for all <see
|
||||
/// ref="QCefView" /> instances created subsequently
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the local archive file</param>
|
||||
/// <param name="url">The url to be mapped to</param>
|
||||
/// <param name="password">The password of the archive</param>
|
||||
/// <param name="priority">The priority</param>
|
||||
void addArchiveResource(const QString& path, const QString& url, const QString& password = "", int priority = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a cookie to the CEF context, this cookie is accessible from all browsers created with this context
|
||||
/// </summary>
|
||||
/// <param name="name">The cookie item name</param>
|
||||
/// <param name="value">The cookie item value</param>
|
||||
/// <param name="domain">The applicable domain name</param>
|
||||
/// <param name="url">The applicable url</param>
|
||||
/// <returns>True on success; otherwise false</returns>
|
||||
bool addCookie(const QString& name, const QString& value, const QString& domain, const QString& url);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all cookies from the CEF context
|
||||
/// </summary>
|
||||
/// <returns>True on success; otherwise false</returns>
|
||||
bool deleteAllCookies();
|
||||
|
||||
/// <summary>
|
||||
/// Adds an entry to the cross-origin access whitelist. For details please refer to:
|
||||
/// https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L81C23-L81C23
|
||||
/// </summary>
|
||||
/// <param name="sourceOrigin">The source origin</param>
|
||||
/// <param name="targetSchema">The target schema</param>
|
||||
/// <param name="targetDomain">The target domain</param>
|
||||
/// <param name="allowTargetSubdomains">Whether to allow subdomain or not</param>
|
||||
/// <returns>True on success; otherwise false</returns>
|
||||
bool addCrossOriginWhitelistEntry(const QString& sourceOrigin,
|
||||
const QString& targetSchema,
|
||||
const QString& targetDomain,
|
||||
bool allowTargetSubdomains);
|
||||
|
||||
/// <summary>
|
||||
/// Removes an entry from the cross-origin access whitelist. For details please refer to:
|
||||
/// https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L91C12-L91C12
|
||||
/// </summary>
|
||||
/// <param name="sourceOrigin">The source origin</param>
|
||||
/// <param name="targetSchema">The target schema</param>
|
||||
/// <param name="targetDomain">The target domain</param>
|
||||
/// <param name="allowTargetSubdomains">Whether to allow subdomain or not</param>
|
||||
/// <returns>True on success; otherwise false</returns>
|
||||
bool removeCrossOriginWhitelistEntry(const QString& sourceOrigin,
|
||||
const QString& targetSchema,
|
||||
const QString& targetDomain,
|
||||
bool allowTargetSubdomains);
|
||||
|
||||
/// <summary>
|
||||
/// Removes all entries from the cross-origin access whitelist.
|
||||
/// </summary>
|
||||
bool clearCrossOriginWhitelistEntry();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the QCefConfig
|
||||
/// </summary>
|
||||
/// <returns>The QCefConfig instance</returns>
|
||||
const QCefConfig* cefConfig() const;
|
||||
|
||||
protected:
|
||||
/// <summary>
|
||||
/// Initialize the CEF context
|
||||
/// </summary>
|
||||
/// <param name="config">The <see cref="QCefConfig"/> instance</param>
|
||||
/// <returns>True on success; otherwise false</returns>
|
||||
bool init(const QCefConfig* config);
|
||||
|
||||
/// <summary>
|
||||
/// Uninitialize the CEF context
|
||||
/// </summary>
|
||||
void uninit();
|
||||
|
||||
private:
|
||||
/// <summary>
|
||||
/// The default instance
|
||||
/// </summary>
|
||||
static QCefContext* s_self;
|
||||
};
|
||||
|
||||
#endif // QCEFCONTEXT_H
|
177
3rdparty/QCefView/include/QCefView/QCefDownloadItem.h
vendored
Normal file
177
3rdparty/QCefView/include/QCefView/QCefDownloadItem.h
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
/*
|
||||
* File: QCefDownloadItem.h
|
||||
* Project: QCefView
|
||||
* Created: 13th July 2022
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFDOWNLOADITEM_H
|
||||
#define QCEFDOWNLOADITEM_H
|
||||
#pragma once
|
||||
#include <QCefView_global.h>
|
||||
|
||||
#pragma region qt_headers
|
||||
#include <QDateTime>
|
||||
#include <QScopedPointer>
|
||||
#include <QString>
|
||||
#pragma endregion
|
||||
|
||||
class QCefDownloadItemPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the download item
|
||||
/// </summary>
|
||||
class QCEFVIEW_EXPORT QCefDownloadItem
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QCefDownloadItem)
|
||||
QScopedPointer<QCefDownloadItemPrivate> d_ptr;
|
||||
|
||||
Q_DISABLE_COPY(QCefDownloadItem)
|
||||
QCefDownloadItem(QCefDownloadItem&&) = delete;
|
||||
QCefDownloadItem& operator=(QCefDownloadItem&&) = delete;
|
||||
|
||||
friend class QCefView;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a download item instance
|
||||
/// </summary>
|
||||
QCefDownloadItem();
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Destructs the download item instance
|
||||
/// </summary>
|
||||
~QCefDownloadItem();
|
||||
|
||||
/// <summary>
|
||||
/// Starts to download the item.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path name (must include file name) to save the downloaded item</param>
|
||||
/// <param name="useDefaultDialog">Whether to use the default 'Save As...' dialog or not</param>
|
||||
/// <remarks>
|
||||
/// The 'path' parameter only works when 'useDefaultDialog' is set to false.
|
||||
/// If you set 'useDefaultDialog' to true then you cannot control the initial
|
||||
/// location of the opened 'Save As...' dialog, it is determined by CEF internal implementation.
|
||||
/// </remarks>
|
||||
void start(const QString& path, bool useDefaultDialog = true) const;
|
||||
|
||||
/// <summary>
|
||||
/// Pauses the download
|
||||
/// </summary>
|
||||
void pause() const;
|
||||
|
||||
/// <summary>
|
||||
/// Resume the download
|
||||
/// </summary>
|
||||
void resume() const;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels the download
|
||||
/// </summary>
|
||||
void cancel() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the download is started
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool isStarted() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the download is in progress
|
||||
/// </summary>
|
||||
/// <returns>True if the download is in progress; otherwise false</returns>
|
||||
bool isInProgress() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the download is complete
|
||||
/// </summary>
|
||||
/// <returns>True if the download is complete; otherwise false</returns>
|
||||
bool isComplete() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the download has been canceled or interrupted
|
||||
/// </summary>
|
||||
/// <returns>True if the download has been canceled or interrupted; otherwise false</returns>
|
||||
bool isCanceled() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets current download speed
|
||||
/// </summary>
|
||||
/// <returns>A simple speed estimate in bytes/s</returns>
|
||||
qint64 currentSpeed() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the completion percentage
|
||||
/// </summary>
|
||||
/// <returns>The rough percent complete or -1 if the receive total size is unknown</returns>
|
||||
int percentComplete() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets total number of bytes
|
||||
/// </summary>
|
||||
/// <returns>The total number of bytes</returns>
|
||||
qint64 totalBytes() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets number of received bytes
|
||||
/// </summary>
|
||||
/// <returns>The number of received bytes</returns>
|
||||
qint64 receivedBytes() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time that the download started
|
||||
/// </summary>
|
||||
/// <returns>The time that the download started</returns>
|
||||
QDateTime startTime() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time that the download ended
|
||||
/// </summary>
|
||||
/// <returns>The time that the download ended</returns>
|
||||
QDateTime endTime() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full path to the downloaded or downloading file
|
||||
/// </summary>
|
||||
/// <returns>The full path to the downloaded or downloading file</returns>
|
||||
QString fullPath() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique identifier for this download
|
||||
/// </summary>
|
||||
/// <returns>The unique identifier for this download</returns>
|
||||
quint32 id() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the URL
|
||||
/// </summary>
|
||||
/// <returns>The the URL</returns>
|
||||
QString url() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the original URL before any redirections
|
||||
/// </summary>
|
||||
/// <returns>The original URL before any redirections</returns>
|
||||
QString originalUrl() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the suggested file name
|
||||
/// </summary>
|
||||
/// <returns>The suggested file name</returns>
|
||||
QString suggestedFileName() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content disposition
|
||||
/// </summary>
|
||||
/// <returns>The the content disposition</returns>
|
||||
QString contentDisposition() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mime type
|
||||
/// </summary>
|
||||
/// <returns>The mime type</returns>
|
||||
QString mimeType() const;
|
||||
};
|
||||
|
||||
#endif /// QCEFDOWNLOADITEM_H
|
88
3rdparty/QCefView/include/QCefView/QCefEvent.h
vendored
Normal file
88
3rdparty/QCefView/include/QCefView/QCefEvent.h
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* File: QCefEvent.h
|
||||
* Project: QCefView
|
||||
* Created: 29th March 2016
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFEVENT_H
|
||||
#define QCEFEVENT_H
|
||||
#pragma once
|
||||
#include <QCefView_global.h>
|
||||
|
||||
#pragma region qt_headers
|
||||
#include <QScopedPointer>
|
||||
#include <QString>
|
||||
#include <QVariantList>
|
||||
#pragma endregion
|
||||
|
||||
class QCefEventPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the event sent from native context(C/C++ code) to the web context(javascript)
|
||||
/// </summary>
|
||||
class QCEFVIEW_EXPORT QCefEvent
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QCefEvent)
|
||||
QScopedPointer<QCefEventPrivate> d_ptr;
|
||||
|
||||
friend class QCefView;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructs an event instance
|
||||
/// </summary>
|
||||
QCefEvent();
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an event instance with name
|
||||
/// </summary>
|
||||
/// <param name="name">The event name</param>
|
||||
QCefEvent(const QString& name);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an event instance from existing one
|
||||
/// </summary>
|
||||
/// <param name="other">The other event instance</param>
|
||||
QCefEvent(const QCefEvent& other);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns an existing event instance to current
|
||||
/// </summary>
|
||||
/// <param name="other">The other event instance</param>
|
||||
QCefEvent& operator=(const QCefEvent& other);
|
||||
|
||||
/// <summary>
|
||||
/// Destructs the event instance
|
||||
/// </summary>
|
||||
~QCefEvent();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the event name
|
||||
/// </summary>
|
||||
/// <param name="name">The name to be set</param>
|
||||
void setEventName(const QString& name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event name
|
||||
/// </summary>
|
||||
/// <returns>The event name</returns>
|
||||
const QString eventName() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the argument list
|
||||
/// </summary>
|
||||
/// <param name="args">The argument list</param>
|
||||
void setArguments(const QVariantList& args);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the argument list
|
||||
/// </summary>
|
||||
/// <returns>The argument list</returns>
|
||||
QVariantList& arguments();
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QCefEvent);
|
||||
|
||||
#endif // QCEFEVENT_H
|
109
3rdparty/QCefView/include/QCefView/QCefQuery.h
vendored
Normal file
109
3rdparty/QCefView/include/QCefView/QCefQuery.h
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* File: QCefQuery.h
|
||||
* Project: QCefView
|
||||
* Created: 29th March 2016
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFQUERY_H
|
||||
#define QCEFQUERY_H
|
||||
#pragma once
|
||||
#include <QCefView_global.h>
|
||||
|
||||
#pragma region stl_headers
|
||||
#include <cstdint>
|
||||
#pragma endregion
|
||||
|
||||
#pragma region qt_headers
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#pragma endregion
|
||||
|
||||
class QCefQueryPrivate;
|
||||
class QCefViewPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the query request sent from the web content(Javascript)
|
||||
/// </summary>
|
||||
class QCEFVIEW_EXPORT QCefQuery
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QCefQuery)
|
||||
QSharedPointer<QCefQueryPrivate> d_ptr;
|
||||
|
||||
friend class QCefViewPrivate;
|
||||
|
||||
protected:
|
||||
/// <summary>
|
||||
/// Constructs a query instance with request context and query id
|
||||
/// </summary>
|
||||
/// <param name="source">The source CefView</param>
|
||||
/// <param name="req">The request context</param>
|
||||
/// <param name="query">The query id</param>
|
||||
QCefQuery(QCefViewPrivate* source, const QString& req, const int64_t query);
|
||||
|
||||
/// <summary>
|
||||
/// Marks the query as replied (for internal use only)
|
||||
/// </summary>
|
||||
void markAsReplied() const;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructs a query instance
|
||||
/// </summary>
|
||||
QCefQuery();
|
||||
|
||||
/// <summary>
|
||||
/// Destructs a query instance
|
||||
/// </summary>
|
||||
~QCefQuery();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the query content
|
||||
/// </summary>
|
||||
/// <returns>The content string</returns>
|
||||
const QString request() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the query id
|
||||
/// </summary>
|
||||
/// <returns>The query id</returns>
|
||||
const qint64 id() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response content string
|
||||
/// </summary>
|
||||
/// <returns>The response content string</returns>
|
||||
const QString response() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response result
|
||||
/// </summary>
|
||||
/// <returns>The respone result</returns>
|
||||
const bool result() const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the response error
|
||||
/// </summary>
|
||||
/// <returns>The response error</returns>
|
||||
const int error() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the response
|
||||
/// </summary>
|
||||
/// <param name="success">True if the query is successful; otherwise false</param>
|
||||
/// <param name="response">The response content string</param>
|
||||
/// <param name="error">The response error</param>
|
||||
void setResponseResult(bool success, const QString& response, int error = 0) const;
|
||||
|
||||
/// <summary>
|
||||
/// Replies the query
|
||||
/// </summary>
|
||||
/// <param name="success">The result</param>
|
||||
/// <param name="response">The response data</param>
|
||||
/// <param name="error">The error code</param>
|
||||
void reply(bool success, const QString& response, int error = 0) const;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QCefQuery);
|
||||
#endif // QCEFQUERY_H
|
419
3rdparty/QCefView/include/QCefView/QCefSetting.h
vendored
Normal file
419
3rdparty/QCefView/include/QCefView/QCefSetting.h
vendored
Normal file
@ -0,0 +1,419 @@
|
||||
/*
|
||||
* File: QCefSetting.h
|
||||
* Project: QCefView
|
||||
* Created: 29th March 2016
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFSETTING_H
|
||||
#define QCEFSETTING_H
|
||||
#pragma once
|
||||
#include <QCefView_global.h>
|
||||
|
||||
#pragma region qt_headers
|
||||
#include <QColor>
|
||||
#include <QScopedPointer>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#pragma endregion
|
||||
|
||||
class QCefSettingPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the settings for individual browser
|
||||
/// </summary>
|
||||
class QCEFVIEW_EXPORT QCefSetting
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QCefSetting)
|
||||
QScopedPointer<QCefSettingPrivate> d_ptr;
|
||||
|
||||
friend class QCefView;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructs the QCefSetting instance
|
||||
/// </summary>
|
||||
QCefSetting();
|
||||
|
||||
/// <summary>
|
||||
/// Constructs the QCefSetting instance from existing one
|
||||
/// </summary>
|
||||
/// <param name="other">The existing QCefSetting instance</param>
|
||||
QCefSetting(const QCefSetting& other);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns the existing QCefSetting instance to current
|
||||
/// </summary>
|
||||
/// <param name="other"></param>
|
||||
QCefSetting& operator=(const QCefSetting& other);
|
||||
|
||||
/// <summary>
|
||||
/// Destructs the instance
|
||||
/// </summary>
|
||||
~QCefSetting();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the initial size of the browser
|
||||
/// </summary>
|
||||
/// <param name="size">The initial size</param>
|
||||
void setWindowInitialSize(const QSize& size);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the initial size of the browser
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
const QSize windowInitialSize() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the standard font family
|
||||
/// </summary>
|
||||
/// <param name="value">The font family</param>
|
||||
void setStandardFontFamily(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the standard font family
|
||||
/// </summary>
|
||||
/// <returns>The font family</returns>
|
||||
const QString standardFontFamily() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the fixed font family
|
||||
/// </summary>
|
||||
/// <param name="value">The font family</param>
|
||||
void setFixedFontFamily(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the fixed font family
|
||||
/// </summary>
|
||||
/// <returns>The font family</returns>
|
||||
const QString fixedFontFamily() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the serif font family
|
||||
/// </summary>
|
||||
/// <param name="value">The font family</param>
|
||||
void setSerifFontFamily(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the serif font family
|
||||
/// </summary>
|
||||
/// <returns>The font family</returns>
|
||||
const QString serifFontFamily() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the sans serif font family
|
||||
/// </summary>
|
||||
/// <param name="value">The font family</param>
|
||||
void setSansSerifFontFamily(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sans serif font family
|
||||
/// </summary>
|
||||
/// <returns>The font family</returns>
|
||||
const QString sansSerifFontFamily() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the cursive font family
|
||||
/// </summary>
|
||||
/// <param name="value">The font family</param>
|
||||
void setCursiveFontFamily(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the cursive font family
|
||||
/// </summary>
|
||||
/// <returns>The font family</returns>
|
||||
const QString cursiveFontFamily() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the fantasy font family
|
||||
/// </summary>
|
||||
/// <param name="value">The font family</param>
|
||||
void setFantasyFontFamily(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the fantasy font family
|
||||
/// </summary>
|
||||
/// <returns>The font family</returns>
|
||||
const QString fantasyFontFamily() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the default encoding
|
||||
/// </summary>
|
||||
/// <param name="value">The encoding name</param>
|
||||
void setDefaultEncoding(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default encoding
|
||||
/// </summary>
|
||||
/// <returns>The encoding name</returns>
|
||||
const QString defaultEncoding() const;
|
||||
|
||||
#if CEF_VERSION_MAJOR < 118
|
||||
/// <summary>
|
||||
/// Sets the acceptable language list
|
||||
/// </summary>
|
||||
/// <param name="value">The acceptable languate list</param>
|
||||
void setAcceptLanguageList(const QString& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the acceptable language list
|
||||
/// </summary>
|
||||
/// <returns>The acceptable languate list</returns>
|
||||
const QString acceptLanguageList() const;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Sets the frame rate in window less mode
|
||||
/// </summary>
|
||||
/// <param name="value">The frame rate</param>
|
||||
void setWindowlessFrameRate(const int value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the frame rate in window less mode
|
||||
/// </summary>
|
||||
/// <returns>The frame rate</returns>
|
||||
const QVariant windowlessFrameRate() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the default font size
|
||||
/// </summary>
|
||||
/// <param name="value">The font size</param>
|
||||
void setDefaultFontSize(const int value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default font size
|
||||
/// </summary>
|
||||
/// <returns>The font size</returns>
|
||||
const QVariant defaultFontSize() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the default fixed font size
|
||||
/// </summary>
|
||||
/// <param name="value">The font size</param>
|
||||
void setDefaultFixedFontSize(const int value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default fixed font size
|
||||
/// </summary>
|
||||
/// <returns>The font size</returns>
|
||||
const QVariant defaultFixedFontSize() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the minimum font size
|
||||
/// </summary>
|
||||
/// <param name="value">The font size</param>
|
||||
void setMinimumFontSize(const int value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minimum font size
|
||||
/// </summary>
|
||||
/// <returns>The font size</returns>
|
||||
const QVariant minimumFontSize() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the minimum logical font size
|
||||
/// </summary>
|
||||
/// <param name="value">The font size</param>
|
||||
void setMinimumLogicalFontSize(const int value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minimum logical font size
|
||||
/// </summary>
|
||||
/// <returns>The font size</returns>
|
||||
const QVariant minimumLogicalFontSize() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable remote fonts
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setRemoteFonts(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable the remote fonts
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant remoteFonts() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable Javascript
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setJavascript(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable Javascript
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant javascript() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable the permission of closing window from Javascript
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setJavascriptCloseWindows(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable the permission of closing window from Javascript
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant javascriptCloseWindows() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable the permission of accessing clipboard from Javascript
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setJavascriptAccessClipboard(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable the permission of accessing clipboard from Javascript
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant javascriptAccessClipboard() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable the permission of pasting DOM in Javascript
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setJavascriptDomPaste(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable the permission of pasting DOM in Javascript
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant javascriptDomPaste() const;
|
||||
|
||||
#if CEF_VERSION_MAJOR < 100
|
||||
/// <summary>
|
||||
/// Sets to enable or disable plugins
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setPlugins(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable plugins
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant plugins() const;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable the permission of loading images
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setImageLoading(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable the permission of loading images
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant imageLoading() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable the shrinking image standalone to fit
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setImageShrinkStandaloneToFit(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable the shrinking image standalone to fit
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant imageShrinkStandaloneToFit() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable the resizing of text area
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setTextAreaResize(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable the resizing of text area
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant textAreaResize() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable tab to links
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setTabToLinks(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable tab to links
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant tabToLinks() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable local storage
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setLocalStorage(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable local storage
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant localStorage() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable database
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setDatabases(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable database
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant databases() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets to enable or disable webGL
|
||||
/// </summary>
|
||||
/// <param name="value">True to enable; false to disable</param>
|
||||
void setWebGL(const bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable or disable webGL
|
||||
/// </summary>
|
||||
/// <returns>True to enable; false to disable</returns>
|
||||
const QVariant webGL() const;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the background color
|
||||
/// </summary>
|
||||
/// <param name="value">The color</param>
|
||||
/// <remarks>
|
||||
/// This only works if the web page has no background color set. The alpha component value
|
||||
/// will be adjusted to 0 or 255, it means if you pass a value with alpha value
|
||||
/// in the range of [1, 255], it will be accepted as 255. The default value is inherited from
|
||||
/// <see cref="QCefConfig::backgroundColor()"/>
|
||||
/// </remarks>
|
||||
void setBackgroundColor(const QColor& value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the background color
|
||||
/// </summary>
|
||||
/// <returns>The color</returns>
|
||||
const QVariant backgroundColor() const;
|
||||
|
||||
#if CEF_VERSION_MAJOR >= 125
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
void setHardwareAcceleration(const bool value);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
const bool hardwareAcceleration() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QCefSetting);
|
||||
|
||||
#endif
|
604
3rdparty/QCefView/include/QCefView/QCefView.h
vendored
Normal file
604
3rdparty/QCefView/include/QCefView/QCefView.h
vendored
Normal file
@ -0,0 +1,604 @@
|
||||
/*
|
||||
* File: QCefView.h
|
||||
* Project: QCefView
|
||||
* Created: 29th March 2016
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFVIEW_H
|
||||
#define QCEFVIEW_H
|
||||
#pragma once
|
||||
#include <QCefView_global.h>
|
||||
|
||||
#pragma region qt_headers
|
||||
#include <QScopedPointer>
|
||||
#include <QVariantList>
|
||||
#include <QWidget>
|
||||
#include <QWindow>
|
||||
#pragma endregion
|
||||
|
||||
#include <QCefDownloadItem.h>
|
||||
#include <QCefEvent.h>
|
||||
#include <QCefQuery.h>
|
||||
#include <QCefSetting.h>
|
||||
|
||||
/// <summary>
|
||||
/// Type alias for CEF browser id
|
||||
/// </summary>
|
||||
#define QCefBrowserId int
|
||||
|
||||
/// <summary>
|
||||
/// Type alias for CEF frame id
|
||||
/// </summary>
|
||||
#if CEF_VERSION_MAJOR < 122
|
||||
#define QCefFrameId qint64
|
||||
#else
|
||||
#define QCefFrameId QString
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Private implementation
|
||||
/// </summary>
|
||||
class QCefViewPrivate;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the CEF browser view
|
||||
/// </summary>
|
||||
class QCEFVIEW_EXPORT QCefView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QCefView)
|
||||
Q_DISABLE_COPY(QCefView)
|
||||
QScopedPointer<QCefViewPrivate> d_ptr;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// The main frame identity
|
||||
/// </summary>
|
||||
static const QCefFrameId MainFrameID;
|
||||
|
||||
/// <summary>
|
||||
/// The identifier for all frames
|
||||
/// </summary>
|
||||
static const QCefFrameId AllFrameID;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the CEF pop-up windows open disposition
|
||||
/// </summary>
|
||||
enum CefWindowOpenDisposition
|
||||
{
|
||||
CefWindowOpenDispositionUnknown,
|
||||
CefWindowOpenDispositionCurrentTab,
|
||||
CefWindowOpenDispositionSingletonTab,
|
||||
CefWindowOpenDispositionNewForeGroundTab,
|
||||
CefWindowOpenDispositionNewBackgroundTab,
|
||||
CefWindowOpenDispositionNewPopup,
|
||||
CefWindowOpenDispositionNewWindow,
|
||||
CefWindowOpenDispositionSaveToDisk,
|
||||
CefWindowOpenDispositionOffTheRecord,
|
||||
CefWindowOpenDispositionIgnoreAction,
|
||||
};
|
||||
Q_ENUM(CefWindowOpenDisposition)
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Constructs a QCefView instance
|
||||
/// </summary>
|
||||
/// <param name="url">The target url</param>
|
||||
/// <param name="setting">The <see cref="QCefSetting"/> instance</param>
|
||||
/// <param name="parent">The parent</param>
|
||||
/// <param name="f">The Qt WindowFlags</param>
|
||||
QCefView(const QString& url,
|
||||
const QCefSetting* setting,
|
||||
QWidget* parent = nullptr,
|
||||
Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a QCefView instance
|
||||
/// </summary>
|
||||
/// <param name="parent">The parent</param>
|
||||
/// <param name="f">The Qt WindowFlags</param>
|
||||
QCefView(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
||||
/// <summary>
|
||||
/// Destructs the QCefView instance
|
||||
/// </summary>
|
||||
~QCefView();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a url mapping item with local web resource directory
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the local resource directory</param>
|
||||
/// <param name="url">The url to be mapped to</param>
|
||||
/// <param name="priority">The priority</param>
|
||||
void addLocalFolderResource(const QString& path, const QString& url, int priority = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a url mapping item with local archive (.zip) file which contains the web resource
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the local archive file</param>
|
||||
/// <param name="url">The url to be mapped to</param>
|
||||
/// <param name="password">The password of the archive</param>
|
||||
/// <param name="priority">The priority</param>
|
||||
void addArchiveResource(const QString& path, const QString& url, const QString& password = "", int priority = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the browser id
|
||||
/// </summary>
|
||||
/// <returns>The browser id</returns>
|
||||
QCefBrowserId browserId();
|
||||
|
||||
/// <summary>
|
||||
/// Navigates to the content.
|
||||
/// </summary>
|
||||
/// <param name="content">The content</param>
|
||||
void navigateToString(const QString& content);
|
||||
|
||||
/// <summary>
|
||||
/// Navigates to the URL
|
||||
/// </summary>
|
||||
/// <param name="url">The url</param>
|
||||
void navigateToUrl(const QString& url);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the browser can go back
|
||||
/// </summary>
|
||||
/// <returns>True if can; otherwise false</returns>
|
||||
bool browserCanGoBack();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the browser can go forward
|
||||
/// </summary>
|
||||
/// <returns>True if can; otherwise false</returns>
|
||||
bool browserCanGoForward();
|
||||
|
||||
/// <summary>
|
||||
/// Requires the browser to go back
|
||||
/// </summary>
|
||||
void browserGoBack();
|
||||
|
||||
/// <summary>
|
||||
/// Requires the browser to go forward
|
||||
/// </summary>
|
||||
void browserGoForward();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the browser is loading
|
||||
/// </summary>
|
||||
/// <returns>True if it is loading; otherwise false</returns>
|
||||
bool browserIsLoading();
|
||||
|
||||
/// <summary>
|
||||
/// Requires the browser to reload
|
||||
/// </summary>
|
||||
void browserReload();
|
||||
|
||||
/// <summary>
|
||||
/// Requires the browser to stop load
|
||||
/// </summary>
|
||||
void browserStopLoad();
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the event for main frame
|
||||
/// </summary>
|
||||
/// <param name="event">The <see cref="QCefEvent"/> instance</param>
|
||||
/// <returns>True on successful; otherwise false</returns>
|
||||
bool triggerEvent(const QCefEvent& event);
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the event for specified frame
|
||||
/// </summary>
|
||||
/// <param name="event">The <see cref="QCefEvent"/> instance</param>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <returns>True on successful; otherwise false</returns>
|
||||
bool triggerEvent(const QCefEvent& event, const QCefFrameId& frameId);
|
||||
|
||||
/// <summary>
|
||||
/// Broad cast the event for all frames
|
||||
/// </summary>
|
||||
/// <param name="event">The <see cref="QCefEvent"/> instance</param>
|
||||
/// <returns>True on successful; otherwise false</returns>
|
||||
bool broadcastEvent(const QCefEvent& event);
|
||||
|
||||
/// <summary>
|
||||
/// Response the <see cref="QCefQuery"/> request
|
||||
/// </summary>
|
||||
/// <param name="query">The query instance</param>
|
||||
/// <returns>True on successful; otherwise false</returns>
|
||||
bool responseQCefQuery(const QCefQuery& query);
|
||||
|
||||
/// <summary>
|
||||
/// Executes javascript code in specified frame, this method does not report the result of the javascript.
|
||||
/// To get the result of the javascript execution use <see cref="executeJavascriptWithResult"/>
|
||||
/// </summary>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <param name="code">The javascript code</param>
|
||||
/// <param name="url">
|
||||
/// The URL where the script in question can be found, if any. The renderer may request this URL to show the developer
|
||||
/// the source of the error
|
||||
/// </param>
|
||||
/// <returns>True on successful; otherwise false</returns>
|
||||
bool executeJavascript(const QCefFrameId& frameId, const QString& code, const QString& url);
|
||||
|
||||
/// <summary>
|
||||
/// Executes javascript code in specified frame and the result will be reported through <see
|
||||
/// cref="reportJavascriptResult"/> signal
|
||||
/// </summary>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <param name="code">The javascript code</param>
|
||||
/// <param name="url">
|
||||
/// The URL where the script in question can be found, if any. The renderer may request this URL to show the developer
|
||||
/// the source of the error
|
||||
/// </param>
|
||||
/// <param name="context">The context used to identify the one execution</param>
|
||||
/// <returns>True on successful; otherwise false</returns>
|
||||
bool executeJavascriptWithResult(const QCefFrameId& frameId,
|
||||
const QString& code,
|
||||
const QString& url,
|
||||
const QString& context);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the preference for this browser
|
||||
/// </summary>
|
||||
/// <param name="name">The preference name</param>
|
||||
/// <param name="value">
|
||||
/// The preference value, if this value is QVariant::UnknownType or QVariant::Invalid, the
|
||||
/// preference will be restored to default value
|
||||
/// </param>
|
||||
/// <param name="error">The error message populated on failure</param>
|
||||
/// <returns>True on successful; otherwise false</returns>
|
||||
bool setPreference(const QString& name, const QVariant& value, const QString& error);
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether to disable the context menu for popup browser
|
||||
/// </summary>
|
||||
/// <param name="disable">True to disable; otherwise false</param>
|
||||
void setDisablePopupContextMenu(bool disable);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to disable the context menu for popup browser
|
||||
/// </summary>
|
||||
/// <returns>True to disable; otherwise false</returns>
|
||||
bool isPopupContextMenuDisabled();
|
||||
|
||||
/// <summary>
|
||||
/// Detects whether this browser has a devtools opened
|
||||
/// </summary>
|
||||
/// <returns>True if opend already; otherwise false</returns>
|
||||
bool hasDevTools();
|
||||
|
||||
/// <summary>
|
||||
/// Opens the devtools dialog
|
||||
/// </summary>
|
||||
void showDevTools();
|
||||
|
||||
/// <summary>
|
||||
/// Closes the devtools dialog
|
||||
/// </summary>
|
||||
void closeDevTools();
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether to enable drag and drop
|
||||
/// </summary>
|
||||
/// <param name="enable">True to enable; otherwise false</param>
|
||||
/// <remarks>
|
||||
/// This function does not work for OSR mode. There is a problem, when dragging a file to a non dragging area,
|
||||
/// the content of the file will be displayed. You need to solve the problem yourself.
|
||||
/// </remarks>
|
||||
void setEnableDragAndDrop(bool enable);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable drag and drop
|
||||
/// </summary>
|
||||
/// <returns>True to enable; otherwise false</returns>
|
||||
bool isDragAndDropEnabled() const;
|
||||
|
||||
signals:
|
||||
/// <summary>
|
||||
/// Gets called on loading state changed
|
||||
/// </summary>
|
||||
/// <param name="browserId">Indicates the browser id</param>
|
||||
/// <param name="isLoading">Indicates the browser is loading</param>
|
||||
/// <param name="canGoBack">Indicates the browser can go back</param>
|
||||
/// <param name="canGoForward">Indicates the browser can go forward</param>
|
||||
void loadingStateChanged(const QCefBrowserId& browserId, bool isLoading, bool canGoBack, bool canGoForward);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on loading starts
|
||||
/// </summary>
|
||||
/// <param name="browserId">Indicates the browser id</param>
|
||||
/// <param name="frameId">Indicates the frame id</param>
|
||||
/// <param name="isMainFrame">Indicates the whether this is the main frame</param>
|
||||
/// <param name="transitionType">transition type</param>
|
||||
void loadStart(const QCefBrowserId& browserId, const QCefFrameId& frameId, bool isMainFrame, int transitionType);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on loading ends
|
||||
/// </summary>
|
||||
/// <param name="browserId">Indicates the browser id</param>
|
||||
/// <param name="frameId">Indicates the frame id</param>
|
||||
/// <param name="isMainFrame">Indicates the whether this is the main frame</param>
|
||||
/// <param name="httpStatusCode">The HTTP status code</param>
|
||||
void loadEnd(const QCefBrowserId& browserId, const QCefFrameId& frameId, bool isMainFrame, int httpStatusCode);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on loading failed due to error
|
||||
/// </summary>
|
||||
/// <param name="browserId">Indicates the browser id</param>
|
||||
/// <param name="frameId">Indicates the frame id</param>
|
||||
/// <param name="isMainFrame">Indicates the whether this is the main frame</param>
|
||||
/// <param name="errorCode">The error code</param>
|
||||
/// <param name="errorMsg">The error message</param>
|
||||
/// <param name="failedUrl">The url caused the failure</param>
|
||||
void loadError(const QCefBrowserId& browserId,
|
||||
const QCefFrameId& frameId,
|
||||
bool isMainFrame,
|
||||
int errorCode,
|
||||
const QString& errorMsg,
|
||||
const QString& failedUrl);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on draggable region changed
|
||||
/// </summary>
|
||||
/// <param name="draggableRegion">The new draggable region</param>
|
||||
/// <param name="nonDraggableRegion">The new non-draggable region</param>
|
||||
void draggableRegionChanged(const QRegion& draggableRegion, const QRegion& nonDraggableRegion);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on the address changed
|
||||
/// </summary>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <param name="url">The address</param>
|
||||
void addressChanged(const QCefFrameId& frameId, const QString& url);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on title changed
|
||||
/// </summary>
|
||||
/// <param name="title">The title</param>
|
||||
void titleChanged(const QString& title);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on favicon url changed
|
||||
/// </summary>
|
||||
/// <param name="urls">The urls</param>
|
||||
void faviconURLChanged(const QStringList& urls);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on fullscreen mode changed
|
||||
/// </summary>
|
||||
/// <param name="fullscreen">The current fullscreen mode</param>
|
||||
void fullscreenModeChanged(bool fullscreen);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on status message changed
|
||||
/// </summary>
|
||||
/// <param name="message">The status message</param>
|
||||
void statusMessage(const QString& message);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on console message from the web content
|
||||
/// </summary>
|
||||
/// <param name="message">The message</param>
|
||||
/// <param name="level">The level</param>
|
||||
void consoleMessage(const QString& message, int level);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on loading progress changed
|
||||
/// </summary>
|
||||
/// <param name="progress">Current progress</param>
|
||||
void loadingProgressChanged(double progress);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on built-in scheme URL access
|
||||
/// </summary>
|
||||
/// <param name="browserId">The browser id</param>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <param name="query">The full url</param>
|
||||
void cefUrlRequest(const QCefBrowserId& browserId, const QCefFrameId& frameId, const QString& url);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on new <see cref="QCefQuery"/> request
|
||||
/// </summary>
|
||||
/// <param name="browserId">The browser id</param>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <param name="query">The query request</param>
|
||||
void cefQueryRequest(const QCefBrowserId& browserId, const QCefFrameId& frameId, const QCefQuery& query);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on invoking method request from web content(Javascript)
|
||||
/// </summary>
|
||||
/// <param name="browserId">The browser id</param>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <param name="method">The method name</param>
|
||||
/// <param name="arguments">The arguments list</param>
|
||||
void invokeMethod(const QCefBrowserId& browserId,
|
||||
const QCefFrameId& frameId,
|
||||
const QString& method,
|
||||
const QVariantList& arguments);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on the result of the javascript executed with <see cref="executeJavascriptWithResult"/> returned
|
||||
/// </summary>
|
||||
/// <param name="browserId">The browser id</param>
|
||||
/// <param name="frameId">The frame id</param>
|
||||
/// <param name="context">The context</param>
|
||||
/// <param name="result">The result</param>
|
||||
void reportJavascriptResult(const QCefBrowserId& browserId,
|
||||
const QCefFrameId& frameId,
|
||||
const QString& context,
|
||||
const QVariant& result);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called after the native browser window created. This slot does not work for OSR mode.
|
||||
/// </summary>
|
||||
/// <param name="window">The native browser windows</param>
|
||||
void nativeBrowserCreated(QWindow* window);
|
||||
|
||||
protected:
|
||||
/// <summary>
|
||||
/// Gets called before a new browser created (only for browser created by non-JavaScript)
|
||||
/// </summary>
|
||||
/// <param name="frameId">The source frame id</param>
|
||||
/// <param name="url">The target URL</param>
|
||||
/// <param name="name">The target name</param>
|
||||
/// <param name="targetDisposition">Target window open method</param>
|
||||
/// <param name="rect">Rect to be used for the popup</param>
|
||||
/// <param name="settings">Settings to be used for the popup</param>
|
||||
/// <returns>True to cancel the popup; false to allow</returns>
|
||||
/// <returns></returns>
|
||||
virtual QCefView* onNewBrowser(const QCefFrameId& sourceFrameId,
|
||||
const QString& url,
|
||||
const QString& name,
|
||||
QCefView::CefWindowOpenDisposition targetDisposition,
|
||||
QRect& rect,
|
||||
QCefSetting& settings);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called before the popup browser created (only for browser created by JavaScript)
|
||||
/// </summary>
|
||||
/// <param name="frameId">The source frame id</param>
|
||||
/// <param name="targetUrl">The target URL</param>
|
||||
/// <param name="targetFrameName">The target name</param>
|
||||
/// <param name="targetDisposition">Target window open method</param>
|
||||
/// <param name="rect">Rect to be used for the popup</param>
|
||||
/// <param name="settings">Settings to be used for the popup</param>
|
||||
/// <returns>True to cancel the popup; false to allow</returns>
|
||||
virtual bool onNewPopup(const QCefFrameId& frameId,
|
||||
const QString& targetUrl,
|
||||
QString& targetFrameName,
|
||||
QCefView::CefWindowOpenDisposition targetDisposition,
|
||||
QRect& rect,
|
||||
QCefSetting& settings,
|
||||
bool& disableJavascriptAccess);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on new download item was required. Keep reference to the download item
|
||||
/// and call <see cref="QCefDownloadItem::start"/> method to allow and start the download,
|
||||
/// Ignore the download item to disallow the download
|
||||
/// </summary>
|
||||
/// <param name="item">The new download item</param>
|
||||
/// <param name="suggestedName">The new suggested name</param>
|
||||
virtual void onNewDownloadItem(const QSharedPointer<QCefDownloadItem>& item, const QString& suggestedName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on download item updated. To get this method called <see cref="QCefDownloadItem::start"/> method must
|
||||
/// be called in <see cref="newDownloadItem"/> method
|
||||
/// </summary>
|
||||
/// <param name="item">The download item</param>
|
||||
virtual void onUpdateDownloadItem(const QSharedPointer<QCefDownloadItem>& item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called on close request from web
|
||||
/// </summary>
|
||||
/// <returns>True to allow the close, false to cancel the close</returns>
|
||||
virtual bool onRequestCloseFromWeb();
|
||||
|
||||
#pragma region QWidget
|
||||
public slots:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
inline void setFocus() { setFocus(Qt::OtherFocusReason); }
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::setFocus
|
||||
/// </summary>
|
||||
void setFocus(Qt::FocusReason reason);
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::inputMethodQuery
|
||||
/// </summary>
|
||||
QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
|
||||
|
||||
/// <summary>
|
||||
/// Renders the view content to target painter
|
||||
/// </summary>
|
||||
/// <param name="painter">The target painter</param>
|
||||
void render(QPainter* painter);
|
||||
|
||||
protected:
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::paintEngine
|
||||
/// </summary>
|
||||
QPaintEngine* paintEngine() const override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::paintEvent
|
||||
/// </summary>
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::inputMethodEvent
|
||||
/// </summary>
|
||||
void inputMethodEvent(QInputMethodEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::showEvent
|
||||
/// </summary>
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::hideEvent
|
||||
/// </summary>
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::focusInEvent
|
||||
/// </summary>
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::focusOutEvent
|
||||
/// </summary>
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::resizeEvent
|
||||
/// </summary>
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::keyPressEvent
|
||||
/// </summary>
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::keyReleaseEvent
|
||||
/// </summary>
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::mouseMoveEvent
|
||||
/// </summary>
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::mousePressEvent
|
||||
/// </summary>
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::mouseReleaseEvent
|
||||
/// </summary>
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::wheelEvent
|
||||
/// </summary>
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::leaveEvent
|
||||
/// </summary>
|
||||
void leaveEvent(QEvent* event) override;
|
||||
|
||||
/// <summary>
|
||||
/// Please refer to QWidget::contextMenuEvent
|
||||
/// </summary>
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
#pragma endregion
|
||||
};
|
||||
|
||||
#endif // QCEFVIEW_H
|
40
3rdparty/QCefView/include/QCefView/QCefView_global.h
vendored
Normal file
40
3rdparty/QCefView/include/QCefView/QCefView_global.h
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* File: QCefView_global.h
|
||||
* Project: QCefView
|
||||
* Created: 29th March 2016
|
||||
* Author: Sheen
|
||||
* Source: https://github.com/cefview/qcefview
|
||||
* Docs: https://cefview.github.io/QCefView/
|
||||
*/
|
||||
#ifndef QCEFEVIEW_GLOBAL_H
|
||||
#define QCEFEVIEW_GLOBAL_H
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#pragma region qt_headers
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QMetaType>
|
||||
#pragma endregion
|
||||
|
||||
#ifdef QCEFVIEW_STATIC
|
||||
// Static library, no need export
|
||||
#define QCEFVIEW_EXPORT
|
||||
#else
|
||||
// Dynamic library
|
||||
#ifdef QCEFVIEW_LIB
|
||||
// Build QCefView project, export API
|
||||
#define QCEFVIEW_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
// Referenced by other project, import API
|
||||
#define QCEFVIEW_EXPORT Q_DECL_IMPORT
|
||||
#if _WIN32
|
||||
#pragma comment(lib, "QCefView.lib")
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// CEF version numbers
|
||||
#include <CefVersion.h>
|
||||
|
||||
#endif // QCEFEVIEW_GLOBAL_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user