Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdddddddd committed Dec 21, 2020
1 parent 496f1d2 commit 3db2d1c
Show file tree
Hide file tree
Showing 26 changed files with 2,056 additions and 0 deletions.
33 changes: 33 additions & 0 deletions CefHelper.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
https://dev.yunxin.163.com/docs/product/%E9%80%9A%E7%94%A8/Demo%E6%BA%90%E7%A0%81%E5%AF%BC%E8%AF%BB/PC%E9%80%9A%E7%94%A8/Demo%20CEF%E5%BC%80%E5%8F%91%E6%8C%87%E5%8D%97
https://github.com/fanfeilong/cefutil

CefClient �з��صĻص��������

CefContextMenuHandler���ص��࣬��Ҫ���ڴ��� Context Menu �¼���

CefDialogHandler���ص��࣬��Ҫ���������Ի����¼���

CefDisplayHandler���ص��࣬������ҳ��״̬��ص��¼�����ҳ���������ı仯����ַ���仯������仯���¼���

CefDownloadHandler���ص��࣬��Ҫ���������ļ����ء�

CefFocusHandler���ص��࣬��Ҫ�������������¼���

CefGeolocationHandler���ص��࣬�������� geolocation Ȩ�ޡ�

CefJSDialogHandler���ص��࣬��Ҫ�������� JS �Ի����¼���

CefKeyboardHandler���ص��࣬��Ҫ�����������������¼���

CefLifeSpanHandler���ص��࣬��Ҫ�������������������������ص��¼��������������Ĵ����������Լ�������Ĺ�����

CefLoadHandler���ص��࣬��Ҫ�������������ҳ�����״̬�ı仯����ҳ����ؿ�ʼ����ɣ������ȡ�

CefRenderHandler���ص��࣬��Ҫ���������ڴ�����Ⱦ���ܱ��رյ�����µ��¼���

CefRequestHandler���ص��࣬��Ҫ���������������������صĵ��¼�������Դ�ĵļ��أ��ض���ȡ�


https://blog.csdn.net/cair2/article/details/91047363

https://blog.csdn.net/sc303165/article/details/105175449
41 changes: 41 additions & 0 deletions Publisher.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Publisher", "Publisher\Publisher.vcxproj", "{63480BEA-504C-4DC5-80AE-21DE279E1AA1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cef_wrapper", "..\cef_wrapper\cef_wrapper\cef_wrapper.vcxproj", "{AA143F23-2465-4A44-9F56-40B0C734A9ED}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Debug|x64.ActiveCfg = Debug|x64
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Debug|x64.Build.0 = Debug|x64
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Debug|x86.ActiveCfg = Debug|Win32
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Debug|x86.Build.0 = Debug|Win32
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Release|x64.ActiveCfg = Release|x64
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Release|x64.Build.0 = Release|x64
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Release|x86.ActiveCfg = Release|Win32
{63480BEA-504C-4DC5-80AE-21DE279E1AA1}.Release|x86.Build.0 = Release|Win32
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Debug|x64.ActiveCfg = Debug|x64
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Debug|x64.Build.0 = Debug|x64
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Debug|x86.ActiveCfg = Debug|Win32
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Debug|x86.Build.0 = Debug|Win32
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Release|x64.ActiveCfg = Release|x64
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Release|x64.Build.0 = Release|x64
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Release|x86.ActiveCfg = Release|Win32
{AA143F23-2465-4A44-9F56-40B0C734A9ED}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FEAA9479-D476-4E3A-AA6E-5B5591374FE3}
EndGlobalSection
EndGlobal
18 changes: 18 additions & 0 deletions Publisher/Publisher.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
#include <Objbase.h>

#include <Entrance/QWindows.Entry.h>

#include <Browser/Browser.WinMain.h>

#if !(defined(DEBUG) || defined(_DEBUG))
#pragma comment(linker, R"(/SubSystem:Windows /Entry:mainCRTStartup)")
#endif // DEBUG

//#pragma comment(linker, R"(/DelayLoad:libcef.dll /DelayLoad:libEGL.dll)")

int main(int argc, char* argv[])
{
Chromium::BrowserWinMain run(argc, argv);
return run.InitializeBrowser(argc, argv, GetModuleHandle(nullptr));
}
282 changes: 282 additions & 0 deletions Publisher/Publisher.vcxproj

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions Publisher/Publisher.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Interface">
<UniqueIdentifier>{048f7e20-9fee-4b25-9b59-634552c8eb8f}</UniqueIdentifier>
</Filter>
<Filter Include="Entrance">
<UniqueIdentifier>{30dd44c5-48a3-4283-a3b4-e0177d3a45b4}</UniqueIdentifier>
</Filter>
<Filter Include="Bridge">
<UniqueIdentifier>{9ed5ae68-1fe9-4202-83a4-cf154ff43204}</UniqueIdentifier>
</Filter>
<Filter Include="Interface\Improt">
<UniqueIdentifier>{9af1bbeb-57bd-484f-9385-0d4687135984}</UniqueIdentifier>
</Filter>
<Filter Include="Browser">
<UniqueIdentifier>{bca86d29-a4ca-421f-a9f8-b1430cd0a0a1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Publisher.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\Source\Entrance\QWindows.Entry.cpp">
<Filter>Entrance</Filter>
</ClCompile>
<ClCompile Include="..\Source\Interface\ApplicationMain.cc">
<Filter>Interface</Filter>
</ClCompile>
<ClCompile Include="..\Source\Bridge\Compilation.Object.cpp">
<Filter>Bridge</Filter>
</ClCompile>
<ClCompile Include="..\Source\Browser\Browser.WinMain.cc">
<Filter>Browser</Filter>
</ClCompile>
<ClCompile Include="..\Source\Browser\Browser.Client.cc">
<Filter>Browser</Filter>
</ClCompile>
<ClCompile Include="..\Source\Browser\Browser.Handler.cc">
<Filter>Browser</Filter>
</ClCompile>
<ClCompile Include="..\Source\Browser\Browser.Windows.cc">
<Filter>Browser</Filter>
</ClCompile>
<ClCompile Include="..\Source\Browser\Browser.Closure.cc">
<Filter>Browser</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Source\Entrance\QWindows.Entry.h">
<Filter>Entrance</Filter>
</ClInclude>
<ClInclude Include="..\Source\Interface\Improt\ApplicationMain.h">
<Filter>Interface\Improt</Filter>
</ClInclude>
<ClInclude Include="..\Source\Browser\Browser.WinMain.h">
<Filter>Browser</Filter>
</ClInclude>
<ClInclude Include="..\Source\Browser\Browser.Client.h">
<Filter>Browser</Filter>
</ClInclude>
<ClInclude Include="..\Source\Browser\Browser.Handler.h">
<Filter>Browser</Filter>
</ClInclude>
<ClInclude Include="..\Source\Browser\Browser.Closure.h">
<Filter>Browser</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\Source\Interface\ApplicationMain.h">
<Filter>Interface</Filter>
</CustomBuild>
<CustomBuild Include="..\Source\Browser\Browser.Windows.h">
<Filter>Browser</Filter>
</CustomBuild>
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions Publisher/QTSheet.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<QTDIR>F:\common\qt\kernel\$(PlatformShortName)</QTDIR>
</PropertyGroup>
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup>
<BuildMacro Include="QTDIR">
<Value>$(QTDIR)</Value>
<EnvironmentVariable>true</EnvironmentVariable>
</BuildMacro>
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions Source/Bridge/Compilation.Object.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef __Compilation_Object_H__
#define __Compilation_Object_H__
#include <Interface/Bridge/ApplicationMain.cpp>
#include <Browser/Bridge/Browser.Windows.cpp>
#endif // __Compilation_Object_H__
97 changes: 97 additions & 0 deletions Source/Browser/Bridge/Browser.Windows.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/****************************************************************************
** Meta object code from reading C++ file 'Browser.Windows.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include <memory>
#include "../Browser.Windows.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'Browser.Windows.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.15.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif

QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_Cry__Chromium__BrowserWindows_t {
QByteArrayData data[1];
char stringdata0[30];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_Cry__Chromium__BrowserWindows_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_Cry__Chromium__BrowserWindows_t qt_meta_stringdata_Cry__Chromium__BrowserWindows = {
{
QT_MOC_LITERAL(0, 0, 29) // "Cry::Chromium::BrowserWindows"

},
"Cry::Chromium::BrowserWindows"
};
#undef QT_MOC_LITERAL

static const uint qt_meta_data_Cry__Chromium__BrowserWindows[] = {

// content:
8, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount

0 // eod
};

void Cry::Chromium::BrowserWindows::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}

QT_INIT_METAOBJECT const QMetaObject Cry::Chromium::BrowserWindows::staticMetaObject = { {
QMetaObject::SuperData::link<QWidget::staticMetaObject>(),
qt_meta_stringdata_Cry__Chromium__BrowserWindows.data,
qt_meta_data_Cry__Chromium__BrowserWindows,
qt_static_metacall,
nullptr,
nullptr
} };


const QMetaObject *Cry::Chromium::BrowserWindows::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}

void *Cry::Chromium::BrowserWindows::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_Cry__Chromium__BrowserWindows.stringdata0))
return static_cast<void*>(this);
if (!strcmp(_clname, "CefTask"))
return static_cast< CefTask*>(this);
return QWidget::qt_metacast(_clname);
}

int Cry::Chromium::BrowserWindows::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
42 changes: 42 additions & 0 deletions Source/Browser/Browser.Client.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <Browser/Browser.Client.h>
#include <Browser/Browser.Handler.h>
namespace Cry
{
namespace Chromium
{
BrowserClient::BrowserClient()
{

}

BrowserClient::~BrowserClient()
{

}

void BrowserClient::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
{
command_line->AppendSwitchWithValue("--lang", "zh-CN");
command_line->AppendSwitchWithValue("--enable-features", "OverlayScrollbar");
command_line->AppendSwitch("disable-extensions");

// command_line->AppendSwitch("disable-gpu");
// command_line->AppendSwitch("disable-gpu-compositing");
}

void BrowserClient::OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar)
{
registrar->AddCustomScheme("Client", CEF_SCHEME_OPTION_STANDARD | CEF_SCHEME_OPTION_CORS_ENABLED);
}

CefRefPtr<CefBrowserProcessHandler> BrowserClient::GetBrowserProcessHandler()
{
return this;
}

void BrowserClient::OnContextInitialized()
{
return;
}
}
}
28 changes: 28 additions & 0 deletions Source/Browser/Browser.Client.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#ifndef __Browser_Client_H__
#define __Browser_Client_H__

#include <vector>
#include <include/cef_app.h>

namespace Cry
{
namespace Chromium
{
class BrowserClient : public CefApp, public CefBrowserProcessHandler
{
public:
explicit BrowserClient();
virtual ~BrowserClient();
private:
virtual void OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line) override;
virtual void OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) override;
virtual void OnContextInitialized() override;
private:
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override;
private:
IMPLEMENT_REFCOUNTING(BrowserClient);
};
}
}
#endif // __Browser_Client_H__
Loading

0 comments on commit 3db2d1c

Please sign in to comment.