@@ -56,7 +56,7 @@ class CWebWindow
56
56
[this , url2, zoom, userAgent, args, deferral, callback2](HRESULT result, ICoreWebView2Controller* controller) -> HRESULT {
57
57
if (FAILED (result))
58
58
{
59
- m_parent->SetToolTipText (L" Failed to create WebView2 controller" );
59
+ m_parent->SetErrorToolTipText (L" Failed to create WebView2 controller" );
60
60
m_parent->ShowToolTip (true );
61
61
}
62
62
@@ -267,10 +267,11 @@ class CWebWindow
267
267
return m_hWnd;
268
268
}
269
269
270
- HRESULT Create (HINSTANCE hInstance, HWND hWndParent, const wchar_t * url, const wchar_t * userDataFolder,
270
+ HRESULT Create (IWebDiffWindow* pDiffWindow, HINSTANCE hInstance, HWND hWndParent, const wchar_t * url, const wchar_t * userDataFolder,
271
271
const SIZE& size, bool fitToWindow, double zoom, std::wstring& userAgent,
272
272
IWebDiffCallback* callback, std::function<void (WebDiffEvent::EVENT_TYPE, IUnknown*, IUnknown*)> eventHandler)
273
273
{
274
+ m_pDiffWindow = pDiffWindow;
274
275
m_fitToWindow = fitToWindow;
275
276
m_size = size;
276
277
m_eventHandler = eventHandler;
@@ -1049,7 +1050,7 @@ class CWebWindow
1049
1050
[this , callback2, msg](HRESULT errorCode, LPCWSTR returnObjectAsJson) -> HRESULT {
1050
1051
if (FAILED (errorCode))
1051
1052
{
1052
- SetToolTipText (*msg + returnObjectAsJson);
1053
+ SetErrorToolTipText (*msg + returnObjectAsJson);
1053
1054
ShowToolTip (true , TOOLTIP_TIMEOUT);
1054
1055
}
1055
1056
if (callback2)
@@ -1069,7 +1070,7 @@ class CWebWindow
1069
1070
[this , callback2](HRESULT errorCode, LPCWSTR resultObjectAsJson) -> HRESULT {
1070
1071
if (FAILED (errorCode))
1071
1072
{
1072
- SetToolTipText (resultObjectAsJson);
1073
+ SetErrorToolTipText (resultObjectAsJson);
1073
1074
ShowToolTip (true , TOOLTIP_TIMEOUT);
1074
1075
}
1075
1076
if (callback2)
@@ -1092,7 +1093,7 @@ class CWebWindow
1092
1093
[this , callback2](HRESULT errorCode, LPCWSTR resultObjectAsJson) -> HRESULT {
1093
1094
if (FAILED (errorCode))
1094
1095
{
1095
- SetToolTipText (resultObjectAsJson);
1096
+ SetErrorToolTipText (resultObjectAsJson);
1096
1097
ShowToolTip (true , TOOLTIP_TIMEOUT);
1097
1098
}
1098
1099
if (callback2)
@@ -1107,7 +1108,7 @@ class CWebWindow
1107
1108
[this , callback2](HRESULT errorCode, LPCWSTR resultObjectAsJson) -> HRESULT {
1108
1109
if (FAILED (errorCode))
1109
1110
{
1110
- SetToolTipText (resultObjectAsJson);
1111
+ SetErrorToolTipText (resultObjectAsJson);
1111
1112
ShowToolTip (true , TOOLTIP_TIMEOUT);
1112
1113
}
1113
1114
if (callback2)
@@ -1309,6 +1310,14 @@ class CWebWindow
1309
1310
return webView2Profile2->ClearBrowsingData (static_cast <COREWEBVIEW2_BROWSING_DATA_KINDS>(dataKinds), nullptr );
1310
1311
}
1311
1312
1313
+ HRESULT SetErrorToolTipText (const std::wstring& text)
1314
+ {
1315
+ IWebDiffWindow::LogCallback logCallback = m_pDiffWindow->GetLogCallback ();
1316
+ if (logCallback)
1317
+ logCallback (IWebDiffWindow::LogLevel::ERR, text.c_str ());
1318
+ return SetToolTipText (text);
1319
+ }
1320
+
1312
1321
HRESULT SetToolTipText (const std::wstring& text)
1313
1322
{
1314
1323
if (!m_hToolTip)
@@ -2089,5 +2098,6 @@ class CWebWindow
2089
2098
return reinterpret_cast <decltype (&::GetDpiForWindow)>(
2090
2099
::GetProcAddress (hUser32, " GetDpiForWindow" ));
2091
2100
}();
2101
+ IWebDiffWindow* m_pDiffWindow = nullptr ;
2092
2102
};
2093
2103
0 commit comments