blob: 20b9145b2194a7982012f117d4434c4ad786f40b (
plain)
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
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WEB_ENGINE_PAGE_HOST_H
#define WEB_ENGINE_PAGE_HOST_H
#include "content/public/browser/web_contents_observer.h"
#include <QtGlobal>
namespace content {
class WebContents;
}
namespace mojo {
template<typename Type>
class AssociatedRemote;
}
namespace qtwebenginepage {
namespace mojom {
class WebEnginePageRenderFrame;
}
}
namespace QtWebEngineCore {
using WebEnginePageRenderFrameRemote = mojo::AssociatedRemote<qtwebenginepage::mojom::WebEnginePageRenderFrame>;
class WebContentsAdapterClient;
class WebEnginePageHost : public content::WebContentsObserver
{
public:
WebEnginePageHost(content::WebContents *, WebContentsAdapterClient *adapterClient);
void FetchDocumentMarkup(uint64_t requestId);
void FetchDocumentInnerText(uint64_t requestId);
void RenderFrameDeleted(content::RenderFrameHost *render_frame) override;
void SetBackgroundColor(uint32_t color);
private:
void OnDidFetchDocumentMarkup(uint64_t requestId, const std::string &markup);
void OnDidFetchDocumentInnerText(uint64_t requestId, const std::string &innerText);
const WebEnginePageRenderFrameRemote &
GetWebEnginePageRenderFrame(content::RenderFrameHost *rfh);
private:
WebContentsAdapterClient *m_adapterClient;
std::map<content::RenderFrameHost *, WebEnginePageRenderFrameRemote> m_renderFrames;
};
} // namespace QtWebEngineCore
#endif // WEB_ENGINE_PAGE_HOST_H
|