-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CefBrowserHostWrapper.h
176 lines (131 loc) · 6.25 KB
/
CefBrowserHostWrapper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Copyright © 2015 The CefSharp Authors. 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 "Stdafx.h"
#include "CefWrapper.h"
using namespace System::Threading::Tasks;
using namespace CefSharp::Structs;
using namespace CefSharp::Enums;
using namespace CefSharp::Callback;
namespace CefSharp
{
namespace Internals
{
private ref class CefBrowserHostWrapper : public IBrowserHost, public CefWrapper
{
private:
MCefRefPtr<CefBrowserHost> _browserHost;
int _lastDevToolsMessageId = 0;
double GetZoomLevelOnUI();
internal:
CefBrowserHostWrapper(CefRefPtr<CefBrowserHost> &browserHost) : _browserHost(browserHost)
{
}
!CefBrowserHostWrapper()
{
_browserHost = nullptr;
}
~CefBrowserHostWrapper()
{
this->!CefBrowserHostWrapper();
_disposed = true;
}
public:
virtual void StartDownload(String^ url);
virtual void Print();
virtual void PrintToPdf(String^ path, PdfPrintSettings^ settings, IPrintToPdfCallback^ callback);
virtual void SetZoomLevel(double zoomLevel);
virtual double GetZoomLevel();
virtual Task<double>^ GetZoomLevelAsync();
virtual IntPtr GetWindowHandle();
virtual void CloseBrowser(bool forceClose);
virtual bool TryCloseBrowser();
virtual void DragTargetDragEnter(IDragData^ dragData, MouseEvent mouseEvent, DragOperationsMask allowedOperations);
virtual void DragTargetDragOver(MouseEvent mouseEvent, DragOperationsMask allowedOperations);
virtual void DragTargetDragDrop(MouseEvent mouseEvent);
virtual void DragSourceEndedAt(int x, int y, DragOperationsMask op);
virtual void DragTargetDragLeave();
virtual void DragSourceSystemDragEnded();
virtual void ShowDevTools(IWindowInfo^ windowInfo, int inspectElementAtX, int inspectElementAtY);
virtual void CloseDevTools();
///
// Returns true if this browser currently has an associated DevTools browser.
// Must be called on the browser process UI thread.
///
/*--cef()--*/
virtual property bool HasDevTools
{
bool get();
}
virtual bool SendDevToolsMessage(String^ messageAsJson);
virtual int ExecuteDevToolsMethod(int messageId, String^ method, String^ paramsAsJson);
virtual int ExecuteDevToolsMethod(int messageId, String^ method, IDictionary<String^, Object^>^ paramaters);
virtual IRegistration^ AddDevToolsMessageObserver(IDevToolsMessageObserver^ observer);
virtual int GetNextDevToolsMessageId();
virtual void AddWordToDictionary(String^ word);
virtual void ReplaceMisspelling(String^ word);
virtual property IExtension^ Extension
{
IExtension^ get();
}
virtual void RunFileDialog(CefFileDialogMode mode, String^ title, String^ defaultFilePath, IList<String^>^ acceptFilters, IRunFileDialogCallback^ callback);
virtual void Find(String^ searchText, bool forward, bool matchCase, bool findNext);
virtual void StopFinding(bool clearSelection);
virtual void SetFocus(bool focus);
virtual void SendFocusEvent(bool setFocus);
virtual void SendKeyEvent(KeyEvent keyEvent);
virtual void SendKeyEvent(int message, int wParam, int lParam);
virtual void SendMouseWheelEvent(MouseEvent mouseEvent, int deltaX, int deltaY);
virtual void SendTouchEvent(TouchEvent evt);
virtual void Invalidate(PaintElementType type);
virtual property bool IsBackgroundHost
{
bool get();
}
virtual void ImeSetComposition(String^ text, cli::array<CompositionUnderline>^ underlines, Nullable<CefSharp::Structs::Range> replacementRange, Nullable<CefSharp::Structs::Range> selectionRange);
virtual void ImeCommitText(String^ text, Nullable<CefSharp::Structs::Range> replacementRange, int relativeCursorPos);
virtual void ImeFinishComposingText(bool keepSelection);
virtual void ImeCancelComposition();
virtual void SendMouseClickEvent(MouseEvent mouseEvent, MouseButtonType mouseButtonType, bool mouseUp, int clickCount);
virtual void SendMouseMoveEvent(MouseEvent mouseEvent, bool mouseLeave);
virtual void SetAccessibilityState(CefState accessibilityState);
virtual void SetAutoResizeEnabled(bool enabled, Size minSize, Size maxSize);
virtual void NotifyMoveOrResizeStarted();
virtual void NotifyScreenInfoChanged();
virtual void WasResized();
virtual void WasHidden(bool hidden);
virtual void GetNavigationEntries(INavigationEntryVisitor^ visitor, bool currentOnly);
virtual NavigationEntry^ GetVisibleNavigationEntry();
virtual property int WindowlessFrameRate
{
int get();
void set(int val);
}
virtual property bool WindowRenderingDisabled
{
bool get();
}
virtual property bool IsAudioMuted
{
bool get();
}
virtual void SetAudioMuted(bool mute);
virtual IntPtr GetOpenerWindowHandle();
virtual void SendExternalBeginFrame();
virtual void SendCaptureLostEvent();
virtual property IRequestContext^ RequestContext
{
IRequestContext^ get();
}
// Misc. private functions:
CefMouseEvent GetCefMouseEvent(MouseEvent mouseEvent);
int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
// Private keyboard functions:
bool IsKeyDown(WPARAM wparam)
{
return (GetKeyState(wparam) & 0x8000) != 0;
}
};
}
}