forked from MicrosoftEdge/WebView2Browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tab.h
31 lines (26 loc) · 1.24 KB
/
Tab.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
// 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"
class Tab
{
public:
Microsoft::WRL::ComPtr<ICoreWebView2Controller> m_contentController;
Microsoft::WRL::ComPtr<ICoreWebView2> m_contentWebView;
Microsoft::WRL::ComPtr<ICoreWebView2DevToolsProtocolEventReceiver> m_securityStateChangedReceiver;
static std::unique_ptr<Tab> CreateNewTab(HWND hWnd, ICoreWebView2Environment* env, size_t id, bool shouldBeActive);
HRESULT ResizeWebView();
protected:
HWND m_parentHWnd = nullptr;
size_t m_tabId = INVALID_TAB_ID;
EventRegistrationToken m_historyUpdateForwarderToken = {};
EventRegistrationToken m_uriUpdateForwarderToken = {};
EventRegistrationToken m_navStartingToken = {};
EventRegistrationToken m_navCompletedToken = {};
EventRegistrationToken m_securityUpdateToken = {};
EventRegistrationToken m_messageBrokerToken = {}; // Message broker for browser pages loaded in a tab
Microsoft::WRL::ComPtr<ICoreWebView2WebMessageReceivedEventHandler> m_messageBroker;
HRESULT Init(ICoreWebView2Environment* env, bool shouldBeActive);
void SetMessageBroker();
};