代码拉取完成,页面将自动刷新
同步操作将从 qmutz/WebView2Browser 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "framework.h"
#include "Tab.h"
class BrowserWindow
{
public:
static const int c_uiBarHeight = 70;
static const int c_optionsDropdownHeight = 108;
static const int c_optionsDropdownWidth = 200;
static ATOM RegisterClass(_In_ HINSTANCE hInstance);
static LRESULT CALLBACK WndProcStatic(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static BOOL LaunchWindow(_In_ HINSTANCE hInstance, _In_ int nCmdShow);
static std::wstring GetAppDataDirectory();
std::wstring GetFullPathFor(LPCWSTR relativePath);
HRESULT HandleTabURIUpdate(size_t tabId, ICoreWebView2* webview);
HRESULT HandleTabHistoryUpdate(size_t tabId, ICoreWebView2* webview);
HRESULT HandleTabNavStarting(size_t tabId, ICoreWebView2* webview);
HRESULT HandleTabNavCompleted(size_t tabId, ICoreWebView2* webview, ICoreWebView2NavigationCompletedEventArgs* args);
HRESULT HandleTabSecurityUpdate(size_t tabId, ICoreWebView2* webview, ICoreWebView2DevToolsProtocolEventReceivedEventArgs* args);
void HandleTabCreated(size_t tabId, bool shouldBeActive);
HRESULT HandleTabMessageReceived(size_t tabId, ICoreWebView2* webview, ICoreWebView2WebMessageReceivedEventArgs* eventArgs);
int GetDPIAwareBound(int bound);
static void CheckFailure(HRESULT hr, LPCWSTR errorMessage);
protected:
HINSTANCE m_hInst = nullptr; // Current app instance
HWND m_hWnd = nullptr;
static WCHAR s_windowClass[MAX_LOADSTRING]; // The window class name
static WCHAR s_title[MAX_LOADSTRING]; // The title bar text
int m_minWindowWidth = 0;
int m_minWindowHeight = 0;
Microsoft::WRL::ComPtr<ICoreWebView2Environment> m_uiEnv;
Microsoft::WRL::ComPtr<ICoreWebView2Environment> m_contentEnv;
Microsoft::WRL::ComPtr<ICoreWebView2Controller> m_controlsController;
Microsoft::WRL::ComPtr<ICoreWebView2Controller> m_optionsController;
Microsoft::WRL::ComPtr<ICoreWebView2> m_controlsWebView;
Microsoft::WRL::ComPtr<ICoreWebView2> m_optionsWebView;
std::map<size_t,std::unique_ptr<Tab>> m_tabs;
size_t m_activeTabId = 0;
EventRegistrationToken m_controlsUIMessageBrokerToken = {}; // Token for the UI message handler in controls WebView
EventRegistrationToken m_controlsZoomToken = {};
EventRegistrationToken m_optionsUIMessageBrokerToken = {}; // Token for the UI message handler in options WebView
EventRegistrationToken m_optionsZoomToken = {};
EventRegistrationToken m_lostOptionsFocus = {}; // Token for the lost focus handler in options WebView
Microsoft::WRL::ComPtr<ICoreWebView2WebMessageReceivedEventHandler> m_uiMessageBroker;
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow);
HRESULT InitUIWebViews();
HRESULT CreateBrowserControlsWebView();
HRESULT CreateBrowserOptionsWebView();
HRESULT ClearContentCache();
HRESULT ClearControlsCache();
HRESULT ClearContentCookies();
HRESULT ClearControlsCookies();
void SetUIMessageBroker();
HRESULT ResizeUIWebViews();
void UpdateMinWindowSize();
HRESULT PostJsonToWebView(web::json::value jsonObj, ICoreWebView2* webview);
HRESULT SwitchToTab(size_t tabId);
std::wstring GetFilePathAsURI(std::wstring fullPath);
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。