trunk cef

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64195 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
Oleg.Korshul
2015-08-20 15:48:46 +00:00
committed by Alexander Trofimov
parent 4c06d217db
commit 3911418fc3
575 changed files with 96939 additions and 0 deletions

159
.gitattributes vendored
View File

@ -911,6 +911,165 @@ Common/DocxFormat/Source/XML/libxml2/win_build/support svnc_tsvn_003alogminsize=
Common/DocxFormat/Source/XlsxFormat/ExternalLinks svnc_tsvn_003alogminsize=5
/DesktopEditor svn_global_002dignores=build%0A
DesktopEditor/ChromiumBasedEditors svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2 svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64 svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/cef.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/cef_100_percent.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/cef_200_percent.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/cef_extensions.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/cef_sandbox.lib svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/d3dcompiler_43.dll svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/d3dcompiler_47.dll svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/devtools_resources.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/icudtl.dat svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/libEGL.dll svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/libGLESv2.dll svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/libcef.dll svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/libcef.lib svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/am.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ar.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/bg.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/bn.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ca.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/cs.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/da.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/de.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/el.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/en-GB.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/en-US.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/es-419.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/es.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/et.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/fa.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/fi.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/fil.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/fr.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/gu.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/he.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/hi.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/hr.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/hu.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/id.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/it.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ja.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/kn.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ko.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/lt.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/lv.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ml.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/mr.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ms.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/nb.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/nl.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/pl.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/pt-BR.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/pt-PT.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ro.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ru.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/sk.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/sl.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/sr.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/sv.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/sw.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/ta.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/te.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/th.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/tr.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/uk.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/vi.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/zh-CN.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/locales/zh-TW.pak svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/cefbuilds/win64/snapshot_blob.bin svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/corebuilds svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/corebuilds/win64 svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/corebuilds/win64/ascdocumentscore.dll svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/corebuilds/win64/ascdocumentscore.lib svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/corebuilds/win64/debug svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/corebuilds/win64/debug/ascdocumentscore.dll svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/corebuilds/win64/debug/ascdocumentscore.lib svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Debug svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/Documents_active_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/Documents_active_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/Documents_disabled_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/Documents_disabled_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_left_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_left_disabled.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_left_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_left_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_right_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_right_disabled.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_right_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/changetab_right_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/collapse_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/collapse_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/collapse_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/deploy2_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/deploy2_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/deploy2_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/deploy_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/deploy_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/deploy_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/exit_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/exit_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/exit_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/first_tab_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/first_tab_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/first_tab_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_collapse_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_collapse_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_deploy2_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_deploy2_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_deploy_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_deploy_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_exit_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/new_exit_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/output_tab_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/output_tab_hover.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/output_tab_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/tabicon_DE_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/tabicon_DE_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/tabicon_PE_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/tabicon_PE_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/tabicon_SE_active.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Icons/tabicon_SE_normal.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/Release svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/asceditor_32.ico svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/app/test/asceditor_64.ico svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/include svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/qcefview svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/linux svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/mac svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/browser svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/common svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/renderer svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/resources svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/resources/logo.png svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/resources/pdf.pdf svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/resources/win svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/resources/win/cefclient.ico svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/cefclient/resources/win/small.ico svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/include svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/include/base svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/include/base/internal svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/include/capi svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/include/internal svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/include/wrapper svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/libcef_dll svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/libcef_dll/base svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/libcef_dll/cpptoc svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/libcef_dll/ctocpp svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cef/windows/libcef_dll/wrapper svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors[!!-~]2/lib/src/cefwrapper svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors/app svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors/app/cefbuilds svnc_tsvn_003alogminsize=5
DesktopEditor/ChromiumBasedEditors/app/cefbuilds/linux64 svnc_tsvn_003alogminsize=5

View File

@ -0,0 +1,102 @@
QT += core gui widgets gui-private widgets-private core-private printsupport
TEMPLATE = app
CONFIG += app_bundle
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/build/windows/Debug
} else {
DESTDIR = $$PWD/build/windows/Release
}
HEADERS += \
mainwindow.h \
qmainpanel.h \
qwinhost.h \
qwinwidget.h \
asctabwidget.h \
../../lib/qcefview/qcefview.h \
QAscApplicationManager.h \
../../lib/include/qascprinter.h
SOURCES += \
main.cpp \
mainwindow.cpp \
qmainpanel.cpp \
qwinhost.cpp \
qwinwidget.cpp \
../../lib/qcefview/qcefview.cpp
RESOURCES += \
Icons.qrc
LIBS += -lwininet \
-ldnsapi \
-lversion \
-lmsimg32 \
-lws2_32 \
-lusp10 \
-lpsapi \
-ldbghelp \
-lwinmm \
-lshlwapi \
-lkernel32 \
-lgdi32 \
-lwinspool \
-lcomdlg32 \
-ladvapi32 \
-lshell32 \
-lole32 \
-loleaut32 \
-luser32 \
-luuid \
-lodbc32 \
-lodbccp32 \
-ldelayimp \
-lcredui \
-lnetapi32 \
-lcomctl32 \
-lrpcrt4 \
-ldwmapi \
-lOpenGL32
win32:contains(QMAKE_TARGET.arch, x86_64):{
DEFINES += JAS_WIN_MSVC_BUILD WIN32
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.02
CONFIG(debug, debug|release) {
LIBS += -L../../cefbuilds/win64 -llibcef
LIBS += -L../../../lib/build/Debug/debug -lascdocumentscore
} else {
LIBS += -L../../cefbuilds/win64 -llibcef
LIBS += -L../../../lib/build/Release/release -lascdocumentscore
}
message(windows64)
}
win32:!contains(QMAKE_TARGET.arch, x86_64):{
DEFINES += JAS_WIN_MSVC_BUILD WIN32 _WIN32
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
CONFIG(debug, debug|release) {
LIBS += -L../../cefbuilds/win32 -llibcef
LIBS += -L../../../lib/build/Debug/debug -lascdocumentscore
} else {
LIBS += -L../../cefbuilds/win32 -llibcef
LIBS += -L../../../lib/build/Release/release -lascdocumentscore
}
message(windows32)
}

View File

@ -0,0 +1,48 @@
<RCC>
<qresource prefix="/">
<file>Icons/collapse_active.png</file>
<file>Icons/collapse_hover.png</file>
<file>Icons/collapse_normal.png</file>
<file>Icons/deploy_active.png</file>
<file>Icons/deploy_hover.png</file>
<file>Icons/deploy_normal.png</file>
<file>Icons/exit_active.png</file>
<file>Icons/exit_hover.png</file>
<file>Icons/exit_normal.png</file>
<file>Icons/first_tab_active.png</file>
<file>Icons/first_tab_hover.png</file>
<file>Icons/first_tab_normal.png</file>
<file>Icons/output_tab_active.png</file>
<file>Icons/output_tab_hover.png</file>
<file>Icons/output_tab_normal.png</file>
<file>Icons/tabicon_DE_active.png</file>
<file>Icons/tabicon_DE_normal.png</file>
<file>Icons/tabicon_PE_active.png</file>
<file>Icons/tabicon_PE_normal.png</file>
<file>Icons/tabicon_SE_active.png</file>
<file>Icons/tabicon_SE_normal.png</file>
<file>Icons/changetab_left_active.png</file>
<file>Icons/changetab_left_hover.png</file>
<file>Icons/changetab_left_normal.png</file>
<file>Icons/changetab_right_active.png</file>
<file>Icons/changetab_right_hover.png</file>
<file>Icons/changetab_right_normal.png</file>
<file>Icons/changetab_left_disabled.png</file>
<file>Icons/changetab_right_disabled.png</file>
<file>Icons/deploy2_active.png</file>
<file>Icons/deploy2_hover.png</file>
<file>Icons/deploy2_normal.png</file>
<file>Icons/Documents_active_hover.png</file>
<file>Icons/Documents_active_normal.png</file>
<file>Icons/Documents_disabled_hover.png</file>
<file>Icons/Documents_disabled_normal.png</file>
<file>Icons/new_collapse_normal.png</file>
<file>Icons/new_deploy_hover.png</file>
<file>Icons/new_deploy_normal.png</file>
<file>Icons/new_exit_hover.png</file>
<file>Icons/new_exit_normal.png</file>
<file>Icons/new_deploy2_hover.png</file>
<file>Icons/new_deploy2_normal.png</file>
<file>Icons/new_collapse_hover.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View File

@ -0,0 +1,36 @@
#ifndef QASCAPPLICATIONMANAGER
#define QASCAPPLICATIONMANAGER
#include "../../lib/include/cefapplication.h"
#include "../../lib/include/applicationmanager.h"
#include <shlwapi.h>
#include <shlobj.h>
#include <QFileDialog>
#include "qmainpanel.h"
class QAscApplicationManager : public CAscApplicationManager
{
public:
QMainPanel* m_pPanel;
public:
QAscApplicationManager()
{
m_pPanel = NULL;
}
public:
virtual void StartSaveDialog(const std::wstring& sName)
{
// сделал через QMainPanel - чтобы использовать сигналы-слоты.
// если сделать QAscApplicationManager : public QObject, то он будет прокидывать
// слоты родителю. Т.е. классу CAscApplicationManager.
// А в либе я не буду затачиваться на QT
((QMainPanel*)m_pPanel)->sendDialogSave(sName);
}
};
#endif // QASCAPPLICATIONMANAGER

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,398 @@
#ifndef ASCTABWIDGET
#define ASCTABWIDGET
#include <QResizeEvent>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QTabBar>
#include <QtWidgets/QPushButton>
#include <QStylePainter>
#include <QStyleOption>
#include "../../lib/include/applicationmanager.h"
#include "../../lib/qcefview/qcefview.h"
class QPushButtonWrapper : public QPushButton
{
Q_OBJECT
public:
QCefView* m_pView;
public:
QPushButtonWrapper(QWidget *parent = 0) : QPushButton(parent)
{
m_pView = NULL;
}
public:
virtual void paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
};
class CAscTabWidget : public QTabWidget
{
Q_OBJECT
public:
QWidget* m_pMainWidget;
QPushButton* m_pMainButton;
CAscApplicationManager* m_pManager;
std::map<int, QCefView*> m_mapDownloads;
int m_nAreaWidth;
int m_nAreaHeight;
signals:
void sendPopup( QString );
void sendDownload( QString, int );
void sendEndDownload( int );
void sendName( QString, int );
public:
CAscTabWidget(QWidget *parent = 0) : QTabWidget(parent)
{
m_nAreaWidth = -1;
m_nAreaHeight = -1;
QObject::connect(this, SIGNAL( sendPopup( QString ) ), this, SLOT( openPopup(QString) ), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( sendDownload( QString , int) ), this, SLOT( openDownload(QString, int) ), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( sendEndDownload( int ) ), this, SLOT( endDownload(int) ), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( sendName(QString,int)), this, SLOT( onSendName(QString, int) ), Qt::QueuedConnection );
this->tabBar()->setMovable(true);
//QString strPaneColor = "#FFFFFF";
QString strPaneColor = "#313437";
QString strStyleQSS = "";
//strStyleQSS += "QTabWidget QWidget { background-color:#FFFFFF;border:none;padding:0;margin:0; }";
strStyleQSS += ("QTabWidget::pane { background-color:" + strPaneColor + "; border:none; }");
strStyleQSS += "QTabWidget::tab-bar { height: 29px; left: 111px; }";
strStyleQSS += "QTabBar::tab { \
background-color: #CFCFCF; border: 1px solid #CFCFCF; border-radius: 1px; \
min-width: 41px; max-width: 135px; \
width:135px; height: 27px; \
margin-left: 0px; margin-right: 1px; margin-top: 0px; margin-bottom: 0px; }";
strStyleQSS += "QTabBar::tab:hover { \
background-color: #DDDDDD; border: 1px solid #DDDDDD; border-radius: 1px; }";
strStyleQSS += "QTabBar::tab:selected { \
background-color: #F1F1F1; border: 1px solid #F1F1F1; border-radius: 1px;}";
strStyleQSS += "QTabBar::tab:first { margin-left: 0px; }";
strStyleQSS += "QTabBar::tab:last { }";
strStyleQSS += "QTabBar::tear { width: 0px; }";
strStyleQSS += "QTabBar QToolButton::left-arrow {margin:-2;background-color:#FFFFFF;border: 1px solid #FFFFFF; }";
strStyleQSS += "QTabBar QToolButton::left-arrow { image: url(:/Icons/changetab_left_normal.png) }";
strStyleQSS += "QTabBar QToolButton::left-arrow:hover { image: url(:/Icons/changetab_left_hover.png) }";
strStyleQSS += "QTabBar QToolButton::left-arrow:disabled { image: url(:/Icons/changetab_left_disabled.png) }";
strStyleQSS += "QTabBar QToolButton::left-arrow:pressed { image: url(:/Icons/changetab_left_active.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow {margin:-2;background-color:#FFFFFF;border: 1px solid #FFFFFF;}";
strStyleQSS += "QTabBar QToolButton::right-arrow { image: url(:/Icons/changetab_right_normal.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow:hover { image: url(:/Icons/changetab_right_hover.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow:disabled { image: url(:/Icons/changetab_right_disabled.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow:pressed { image: url(:/Icons/changetab_right_active.png) }";
strStyleQSS += "QTabBar::scroller { padding: 0px; margin: 0px;background-color:#FFFFFF;border: 1px solid #FFFFFF; width:10; }";
setStyleSheet(strStyleQSS);
QSize iconSize;
iconSize.setWidth(18);
iconSize.setHeight(10);
this->setIconSize(iconSize);
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChangedSlot(int)));
}
void addEditor(QString strName, AscEditorType etType = etDocument, std::wstring strUrl = L"")
{
if (!m_pManager)
return;
QCefView* pView = new QCefView(this);
pView->SetBackgroundCefColor(244, 244, 244);
pView->Create(m_pManager, cvwtEditor);
this->addTab(pView, strName);
this->resizeEvent(NULL);
pView->GetCefView()->load(strUrl);
QPushButtonWrapper *close = new QPushButtonWrapper(pView);
close->m_pView = pView;
QObject::connect(close, SIGNAL(clicked()), this, SLOT(clickedSlotClose()));
QString sStyleClose = "QPushButton {background:transparent;background-repeat: no-repeat;background-image:url(:/Icons/output_tab_normal.png);border:none;width:8px;height:11px;margin-right:5px;} ";
sStyleClose += "QPushButton:hover {background-image:url(:/Icons/output_tab_hover.png);border:none;width:8px;height:11px;margin-right:5px;}";
sStyleClose += "QPushButton:pressed {background-image:url(:/Icons/output_tab_active.png);border:none;width:8px;height:11px;margin-right:5px;}";
close->setStyleSheet(sStyleClose);
this->tabBar()->setTabButton(this->tabBar()->count() - 1, QTabBar::RightSide, close);
this->resizeEvent(NULL);
}
protected:
void resizeEvent(QResizeEvent* e)
{
Q_UNUSED(e);
int nMin = 41;
int nMax = 135;
int nFirst = 44;
int nStartOffset = 5;
int nBetweenApp = 5;
int nButtonW = 16;
int nEndOffset = 40;
int nControlWidth = this->width();
int nTabBarWidth = nControlWidth - nFirst - nStartOffset - nEndOffset - 3 * nButtonW - 2 * nBetweenApp;
int nCountTabs = this->tabBar()->count();
if (nCountTabs == 0)
nCountTabs = 1;
int nTabWidth = (nTabBarWidth - (2 + 2) * nCountTabs) / nCountTabs;
if (nTabWidth > nMax)
nTabWidth = nMax;
if (nTabWidth < nMin)
nTabWidth = nMin;
int nMinTabBarWidth = (nTabWidth + 2 + 2) * nCountTabs;
if (nTabBarWidth > nMinTabBarWidth)
nTabBarWidth = nMinTabBarWidth;
//QString strPaneColor = "#FFFFFF";
QString strPaneColor = "#313437";
QString strStyleQSS = "";
//strStyleQSS += "QTabWidget QWidget { background-color:#FFFFFF;border:none;padding:0;margin:0; }";
strStyleQSS += ("QTabWidget::pane { background-color:" + strPaneColor + "; border: none; }");
strStyleQSS += QString("QTabWidget::tab-bar { width:%1px; height: 29px; left: 111px; }").arg(nTabBarWidth);
strStyleQSS += QString("QTabBar::tab { \
background-color: #CFCFCF; border: 1px solid #CFCFCF; border-radius: 1px; \
min-width: 41px; max-width: 135px; \
width:%1px; height: 27px; \
margin-right: 1px; margin-left: 0px; margin-top: 0px; margin-bottom: 0px; }").arg(nTabWidth);
strStyleQSS += "QTabBar::tab:hover { \
background-color: #DDDDDD; border: 1px solid #DDDDDD; border-radius: 1px; }";
strStyleQSS += "QTabBar::tab:selected { \
background-color: #F1F1F1; border: 1px solid #F1F1F1; border-radius: 1px;}";
strStyleQSS += "QTabBar::tab:first { margin-left: 0px; }";
strStyleQSS += "QTabBar::tab:last { }";
strStyleQSS += "QTabBar::tear { width: 0px; }";
strStyleQSS += "QTabBar QToolButton::left-arrow {margin:-2;background-color:#FFFFFF;border: 1px solid #FFFFFF; }";
strStyleQSS += "QTabBar QToolButton::left-arrow { image: url(:/Icons/changetab_left_normal.png) }";
strStyleQSS += "QTabBar QToolButton::left-arrow:hover { image: url(:/Icons/changetab_left_hover.png) }";
strStyleQSS += "QTabBar QToolButton::left-arrow:disabled { image: url(:/Icons/changetab_left_disabled.png) }";
strStyleQSS += "QTabBar QToolButton::left-arrow:pressed { image: url(:/Icons/changetab_left_active.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow {margin:-2;background-color:#FFFFFF;border: 1px solid #FFFFFF;}";
strStyleQSS += "QTabBar QToolButton::right-arrow { image: url(:/Icons/changetab_right_normal.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow:hover { image: url(:/Icons/changetab_right_hover.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow:disabled { image: url(:/Icons/changetab_right_disabled.png) }";
strStyleQSS += "QTabBar QToolButton::right-arrow:pressed { image: url(:/Icons/changetab_right_active.png) }";
strStyleQSS += "QTabBar::scroller { padding: 0px; margin: 0px;background-color:#FFFFFF;border: 1px solid #FFFFFF; width:10; }";
strStyleQSS += "QTabBar QIcon { offset: 10px; }";
strStyleQSS += "QTabBar::tab:text{ font:Arial;font-weight:normal;font-size:8pt;text-align:left;}";
setStyleSheet(strStyleQSS);
int nNewAreaWidth = width();
int nNewAreaHeight = height() - this->tabBar()->height();
if (nNewAreaWidth != m_nAreaWidth || nNewAreaHeight != m_nAreaHeight)
{
m_nAreaWidth = nNewAreaWidth;
m_nAreaHeight = nNewAreaHeight;
int nCountNatural = this->count();
for (int i = 0; i < nCountNatural; ++i)
{
if (i == this->currentIndex())
continue;
((QCefView*)widget(i))->GetCefView()->resizeEvent(m_nAreaWidth, m_nAreaHeight);
}
}
}
public:
void OpenPopup(QString strUrl)
{
if (strUrl.length() == 0)
return;
emit sendPopup(strUrl);
}
void OpenDownload(QString strUrl, int nParentId)
{
if (strUrl.length() == 0)
return;
emit sendDownload(strUrl, nParentId);
}
void EndDownload(int nId)
{
emit sendEndDownload(nId);
}
public slots:
void currentChangedSlot(int index)
{
resizeEvent(NULL);
if (!m_pMainWidget->isHidden())
{
m_pMainWidget->setHidden(true);
m_pMainButton->setStyleSheet("QPushButton {background-image:url(:/Icons/Documents_disabled_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/Documents_disabled_normal.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/Documents_disabled_hover.png);border:none;margin:0;padding:0;}");
}
FireFocus(index);
UpdateIcons();
}
void openPopup(QString sValue)
{
this->addEditor("Editor", etDocument, sValue.toStdWString());
}
void openDownload(QString sUrl, int nParentId)
{
std::wstring strUrl = sUrl.toStdWString();
if (!m_pManager)
return;
QCefView* pView = new QCefView(NULL);
pView->Create(m_pManager, cvwtEditor);
pView->GetCefView()->SetParentCef(nParentId);
pView->GetCefView()->load(strUrl);
m_mapDownloads.insert(std::pair<int, QCefView*>(pView->GetCefView()->GetId(), pView));
}
void endDownload(int nId)
{
std::map<int, QCefView*>::iterator i = m_mapDownloads.find(nId);
if (i != m_mapDownloads.end())
{
QCefView* pView = i->second;
RELEASEOBJECT(pView);
m_mapDownloads.erase(i);
}
}
void onSendNameAsync(QString sUrl, int nId)
{
emit sendName(sUrl, nId);
}
void onSendName(QString sUrl, int nId)
{
int nIndex = this->GetTabIndexById(nId);
this->tabBar()->setTabText(nIndex, sUrl);
}
void FireFocus(int index = -1)
{
int nIndex = (index >= 0) ? index : this->currentIndex();
if (nIndex >= 0)
((QCefView*)this->widget(nIndex))->GetCefView()->focus();
}
void UpdateIcons()
{
QTabBar* pBar = this->tabBar();
int nCount = pBar->count();
int nSelectedIndex = pBar->currentIndex();
for (int i = 0; i < nCount; ++i)
{
CCefViewEditor* pEditor = (CCefViewEditor*)(((QCefView*)(this->widget(i)))->GetCefView());
bool bIsActive = (i == nSelectedIndex) ? true : false;
switch (pEditor->GetEditorType())
{
case etPresentation:
{
pBar->setTabIcon(i, bIsActive ? QIcon(":/Icons/tabicon_PE_active.png") : QIcon(":/Icons/tabicon_PE_normal.png"));
break;
}
case etSpreadsheet:
{
pBar->setTabIcon(i, bIsActive ? QIcon(":/Icons/tabicon_SE_active.png") : QIcon(":/Icons/tabicon_SE_normal.png"));
break;
}
case etDocument:
default:
{
pBar->setTabIcon(i, bIsActive ? QIcon(":/Icons/tabicon_DE_active.png") : QIcon(":/Icons/tabicon_DE_normal.png"));
break;
}
}
//pBar->setTabTextColor(nIndex, bIsActive ? QColor(255, 255, 255) : QColor(51, 51, 51));
pBar->setTabTextColor(i, QColor(51, 51, 51));
}
}
public slots:
void clickedSlotClose()
{
QPushButtonWrapper* pButton = (QPushButtonWrapper*)sender();
QCefView* pViewCef = pButton->m_pView;
int nId = pViewCef->GetCefView()->GetId();
#if 1
std::string sId = std::to_string(nId);sId += "\n";
OutputDebugStringA(sId.c_str());
#endif
NSEditorApi::CAscMenuEvent* pEvent = new NSEditorApi::CAscMenuEvent();
pEvent->m_nType = ASC_MENU_EVENT_TYPE_CEF_CLOSE;
pViewCef->GetCefView()->Apply(pEvent);
}
int GetTabIndexById(int nId)
{
QTabBar* pBar = this->tabBar();
int nCount = pBar->count();
for (int i = 0; i < nCount; ++i)
{
CCefView* pEditor = (CCefView*)(((QCefView*)(this->widget(i)))->GetCefView());
if (pEditor->GetId() == nId)
return i;
}
return -1;
}
};
#endif // ASCTABWIDGET

View File

@ -0,0 +1,149 @@
#ifndef ASCEDITORWIDGET
#define ASCEDITORWIDGET
#include <QWidget>
#include <QTabWidget>
#include <QTabBar>
#include <QStyleOption>
#include <QPainter>
#include <QApplication>
namespace NSAscEditor
{
enum EditorType
{
etDocument = 0,
etPresentation = 1,
etSpreadsheet = 2
};
}
#if 0
class CAscEditorWidget : public QWidget
{
Q_OBJECT
public:
NSAscEditor::EditorType m_etType;
public:
CAscEditorWidget(QWidget *parent = 0, NSAscEditor::EditorType etType = NSAscEditor::etDocument) : QWidget(parent)
{
m_etType = etType;
setStyleSheet("background-color:#FF00FF");
}
~CAscEditorWidget()
{
}
void SetIcon(int nIndex, QTabWidget* pWidget)
{
int nSelectedIndex = pWidget->tabBar()->currentIndex();
QTabBar* pTabBar = pWidget->tabBar();
bool bIsActive = (nIndex == nSelectedIndex) ? true : false;
switch (m_etType)
{
case NSAscEditor::etPresentation:
{
pTabBar->setTabIcon(nIndex, bIsActive ? QIcon(":/Icons/tabicon_PE_active.png") : QIcon(":/Icons/tabicon_PE_normal.png"));
break;
}
case NSAscEditor::etSpreadsheet:
{
pTabBar->setTabIcon(nIndex, bIsActive ? QIcon(":/Icons/tabicon_SE_active.png") : QIcon(":/Icons/tabicon_SE_normal.png"));
break;
}
case NSAscEditor::etDocument:
default:
{
pTabBar->setTabIcon(nIndex, bIsActive ? QIcon(":/Icons/tabicon_DE_active.png") : QIcon(":/Icons/tabicon_DE_normal.png"));
break;
}
}
pTabBar->setTabTextColor(nIndex, bIsActive ? QColor(255, 255, 255) : QColor(51, 51, 51));
}
protected:
void paintEvent(QPaintEvent* e)
{
Q_UNUSED(e);
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
};
#else
#include "./cef/qcefwebview.h"
class CAscEditorWidget : public QCefWebView
{
Q_OBJECT
public:
NSAscEditor::EditorType m_etType;
public:
CAscEditorWidget(QWidget *parent = 0, NSAscEditor::EditorType etType = NSAscEditor::etDocument, std::wstring strUrl = L"") : QCefWebView(parent)
{
this->setParentTabs((QTabWidget*)parent);
m_etType = etType;
std::wstring sUrl = QApplication::applicationDirPath().toStdWString();
sUrl += L"/deploy/apps/api/documents/index.html";
if (etType == NSAscEditor::etSpreadsheet)
sUrl += L"?doctype=spreadsheet";
if (etType == NSAscEditor::etPresentation)
sUrl += L"?doctype=presentation";
if (strUrl.length() != 0)
sUrl = strUrl;
this->load(sUrl);
}
virtual ~CAscEditorWidget()
{
}
void SetIcon(int nIndex, QTabWidget* pWidget)
{
int nSelectedIndex = pWidget->tabBar()->currentIndex();
QTabBar* pTabBar = pWidget->tabBar();
bool bIsActive = (nIndex == nSelectedIndex) ? true : false;
switch (m_etType)
{
case NSAscEditor::etPresentation:
{
pTabBar->setTabIcon(nIndex, bIsActive ? QIcon(":/Icons/tabicon_PE_active.png") : QIcon(":/Icons/tabicon_PE_normal.png"));
break;
}
case NSAscEditor::etSpreadsheet:
{
pTabBar->setTabIcon(nIndex, bIsActive ? QIcon(":/Icons/tabicon_SE_active.png") : QIcon(":/Icons/tabicon_SE_normal.png"));
break;
}
case NSAscEditor::etDocument:
default:
{
pTabBar->setTabIcon(nIndex, bIsActive ? QIcon(":/Icons/tabicon_DE_active.png") : QIcon(":/Icons/tabicon_DE_normal.png"));
break;
}
}
//pTabBar->setTabTextColor(nIndex, bIsActive ? QColor(255, 255, 255) : QColor(51, 51, 51));
pTabBar->setTabTextColor(nIndex, QColor(51, 51, 51));
}
};
#endif
#endif // ASCEDITORWIDGET

View File

@ -0,0 +1,102 @@
#include <QFile>
#include "QAscApplicationManager.h"
#include "mainwindow.h"
#include <QScreen>
#include <shlwapi.h>
#include <shlobj.h>
int main( int argc, char *argv[] )
{
bool bIsChromiumSubprocess = false;
for (int i = 0; i < argc; ++i)
{
if ((0 == strcmp("--type=gpu-process", argv[i])) ||
(0 == strcmp("--type=renderer", argv[i])))
{
bIsChromiumSubprocess = true;
break;
}
}
#if 0
FILE* f = fopen("E:\\12345.txt", "a+");
fprintf(f, "-----------------------------------------------\n");
for (int i = 0; i < argc; ++i)
{
fprintf(f, argv[i]);
fprintf(f, "\n");
}
fprintf(f, "-----------------------------------------------\n");
fclose(f);
#endif
if (bIsChromiumSubprocess)
{
QApplication aa(argc, argv);
CApplicationCEF oCef;
CAscApplicationManager oManager;
WCHAR szPath[MAX_PATH];
// Get path for each computer, non-user specific and non-roaming data.
if ( SUCCEEDED( SHGetFolderPathW( NULL, CSIDL_COMMON_APPDATA, NULL, 0, szPath ) ) )
{
// Append product-specific path
std::wstring sAppData(szPath);
sAppData += L"/ONLYOFFICE";
oManager.m_oSettings.SetUserDataPath(sAppData);
}
oCef.Init_CEF(&oManager);
return aa.exec();
}
QApplication a(argc, argv);
CApplicationCEF* application_cef = new CApplicationCEF();
CAscApplicationManager* pApplicationManager = new QAscApplicationManager();
WCHAR szPath[MAX_PATH];
// Get path for each computer, non-user specific and non-roaming data.
if ( SUCCEEDED( SHGetFolderPathW( NULL, CSIDL_COMMON_APPDATA, NULL, 0, szPath ) ) )
{
// Append product-specific path
std::wstring sAppData(szPath);
sAppData += L"/ONLYOFFICE";
pApplicationManager->m_oSettings.SetUserDataPath(sAppData);
}
qreal ww = a.primaryScreen()->logicalDotsPerInch();
qreal hh = a.primaryScreen()->physicalDotsPerInch();
application_cef->Init_CEF(pApplicationManager);
pApplicationManager->CheckFonts();
a.setStyleSheet("#mainPanel { margin: 0; padding: 0; }\
#systemPanel { margin: 0; padding: 0; } \
#centralWidget { background: #fff; }");
// Font
QFont mainFont = a.font();
mainFont.setStyleStrategy( QFont::PreferAntialias );
a.setFont( mainFont );
// Background color
HBRUSH windowBackground = CreateSolidBrush( RGB( 49, 52, 55 ) );
// Create window
CMainWindow window( &a, windowBackground, 100, 100, 1024 * 2, 600 * 2, pApplicationManager );
window.setMinimumSize( 100, 100 );
((QAscApplicationManager*)pApplicationManager)->m_pPanel = window.mainPanel;
// Launch
a.exec();
// release all subprocesses
pApplicationManager->CloseApplication();
delete application_cef;
delete pApplicationManager;
}

View File

@ -0,0 +1,588 @@
#include "MainWindow.h"
#include <dwmapi.h>
#include <windowsx.h>
#include <windows.h>
#include <stdexcept>
#include <QtWidgets/QPushButton>
#include <QFile>
#include <QPixmap>
#include <QDebug>
HWND winId = 0;
//QMainPanel* CMainWindow::mainPanel;
//QApplication* CMainWindow::a;
CMainWindow::CMainWindow( QApplication *app, HBRUSH windowBackground, const int x, const int y, const int width, const int height, CAscApplicationManager* pManager ) :
hWnd(0),
hInstance( GetModuleHandle( NULL ) ),
borderless( false ),
borderlessResizeable( true ),
aeroShadow( true ),
closed( false ),
visible( false )
{
mainPanel = NULL;
m_pManager = pManager;
m_pManager->StartSpellChecker();
WNDCLASSEXW wcx = { 0 };
wcx.cbSize = sizeof( WNDCLASSEX );
wcx.style = CS_HREDRAW | CS_VREDRAW;
wcx.hInstance = hInstance;
wcx.lpfnWndProc = WndProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.lpszClassName = L"WindowClass";
wcx.hbrBackground = windowBackground;
wcx.hCursor = LoadCursor( hInstance, IDC_ARROW );
std::wstring sPath = NSFile::GetProcessDirectory() + L"/asceditor_64.ico";
wcx.hIcon = (HICON) LoadImageW( // returns a HANDLE so we have to cast to HICON
NULL, // hInstance must be NULL when loading from a file
sPath.c_str(), // the icon file name
IMAGE_ICON, // specifies that the file is an icon
0, // width of the image (we'll specify default later on)
0, // height of the image
LR_LOADFROMFILE| // we want to load a file (as opposed to a resource)
LR_DEFAULTSIZE| // default metrics based on the type (IMAGE_ICON, 32x32)
LR_SHARED // let the system release the handle when it's no longer used
);
RegisterClassExW( &wcx );
if ( FAILED( RegisterClassExW( &wcx ) ) )
throw std::runtime_error( "Couldn't register window class" );
hWnd = CreateWindowW( L"WindowClass", L"CMainWindow", static_cast<DWORD>( Style::windowed ) , x, y, width, height, 0, 0, hInstance, nullptr );
if ( !hWnd )
throw std::runtime_error( "couldn't create window because of reasons" );
SetWindowLongPtr( hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>( this ) );
mainPanel = new QMainPanel( hWnd, m_pManager );
winId = ( HWND )mainPanel->winId();
SetWindowPos(winId, NULL, 0, 0, width, height, SWP_FRAMECHANGED);
//show();
visible = true;
toggleBorderless();
a = app;
m_nTimerLanguageId = 5000;
SetTimer(hWnd, m_nTimerLanguageId, 100, NULL);
}
CMainWindow::~CMainWindow()
{
if (-1 != m_nTimerLanguageId)
::KillTimer(hWnd, m_nTimerLanguageId);
hide();
DestroyWindow( hWnd );
//m_pManager->StopSpellChecker();
//RELEASEOBJECT(m_pManager);
}
LRESULT CALLBACK CMainWindow::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
CMainWindow *window = reinterpret_cast<CMainWindow*>( GetWindowLongPtr( hWnd, GWLP_USERDATA ) );
if ( !window )
return DefWindowProc( hWnd, message, wParam, lParam );
switch ( message )
{
case WM_KEYDOWN:
{
switch ( wParam )
{
case VK_F5:
{
window->borderlessResizeable = !window->borderlessResizeable;
break;
}
case VK_F6:
{
window->toggleShadow();
window->toggleBorderless();
SetFocus( winId );
break;
}
case VK_F7:
{
window->toggleShadow();
break;
}
}
if ( wParam != VK_TAB )
return DefWindowProc( hWnd, message, wParam, lParam );
SetFocus( winId );
break;
}
// ALT + SPACE or F10 system menu
case WM_SYSCOMMAND:
{
if ( wParam == SC_KEYMENU )
{
return 0;
RECT winrect;
GetWindowRect( hWnd, &winrect );
TrackPopupMenu( GetSystemMenu( hWnd, false ), TPM_TOPALIGN | TPM_LEFTALIGN, winrect.left + 5, winrect.top + 5, 0, hWnd, NULL);
break;
}
else
{
return DefWindowProc( hWnd, message, wParam, lParam );
}
}
case WM_SETFOCUS:
{
QString str( "Got focus" );
QWidget *widget = QWidget::find( ( WId )HWND( wParam ) );
if ( widget )
str += QString( " from %1 (%2)" ).arg( widget->objectName() ).arg(widget->metaObject()->className() );
str += "\n";
OutputDebugStringA( str.toLocal8Bit().data() );
break;
}
case WM_NCCALCSIZE:
{
//this kills the window frame and title bar we added with
//WS_THICKFRAME and WS_CAPTION
if (window->borderless)
{
return 0;
}
break;
}
case WM_KILLFOCUS:
{
QString str( "Lost focus" );
QWidget *widget = QWidget::find( (WId)HWND( wParam ) );
if ( widget )
str += QString( " to %1 (%2)" ).arg( widget->objectName() ).arg(widget->metaObject()->className() );
str += "\n";
OutputDebugStringA( str.toLocal8Bit().data() );
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
case WM_TIMER:
{
if (NULL != window->m_pManager)
window->m_pManager->CheckKeyboard();
break;
}
case WM_NCHITTEST:
{
if ( window->borderless )
{
const LONG borderWidth = 8; //in pixels
RECT winrect;
GetWindowRect( hWnd, &winrect );
long x = GET_X_LPARAM( lParam );
long y = GET_Y_LPARAM( lParam );
if ( window->borderlessResizeable )
{
//bottom left corner
if ( x >= winrect.left && x < winrect.left + borderWidth &&
y < winrect.bottom && y >= winrect.bottom - borderWidth )
{
return HTBOTTOMLEFT;
}
//bottom right corner
if ( x < winrect.right && x >= winrect.right - borderWidth &&
y < winrect.bottom && y >= winrect.bottom - borderWidth )
{
return HTBOTTOMRIGHT;
}
//top left corner
if ( x >= winrect.left && x < winrect.left + borderWidth &&
y >= winrect.top && y < winrect.top + borderWidth )
{
return HTTOPLEFT;
}
//top right corner
if ( x < winrect.right && x >= winrect.right - borderWidth &&
y >= winrect.top && y < winrect.top + borderWidth )
{
return HTTOPRIGHT;
}
//left border
if ( x >= winrect.left && x < winrect.left + borderWidth )
{
return HTLEFT;
}
//right border
if ( x < winrect.right && x >= winrect.right - borderWidth )
{
return HTRIGHT;
}
//bottom border
if ( y < winrect.bottom && y >= winrect.bottom - borderWidth )
{
return HTBOTTOM;
}
//top border
if ( y >= winrect.top && y < winrect.top + borderWidth )
{
return HTTOP;
}
}
return HTCAPTION;
}
break;
}
case WM_SIZE:
{
RECT lpWindowRect;
GetWindowRect(hWnd, &lpWindowRect);
bool bIsMaximize = false;
int nMaxOffsetX = 0;
int nMaxOffsetY = 0;
int nMaxOffsetR = 0;
int nMaxOffsetB = 0;
if (window->mainPanel)
{
RECT winrect;
GetClientRect( hWnd, &winrect );
WINDOWPLACEMENT wp;
wp.length = sizeof( WINDOWPLACEMENT );
GetWindowPlacement( hWnd, &wp );
int nSizeBorder_normal = 3;
int nSizeBorder_max = nSizeBorder_normal;
if ( wp.showCmd == SW_MAXIMIZE )
{
QPushButton* pushButtonMaximize = window->mainPanel->findChild<QPushButton*>( "pushButtonMaximize" );
pushButtonMaximize->setStyleSheet("QPushButton {background-image:url(:/Icons/new_deploy_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/new_deploy_hover.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/new_deploy_hover.png);border:none;margin:0;padding:0;}");
LONG lTestW = 640;
LONG lTestH = 480;
RECT wrect;
wrect.left = 0;
wrect.top = 0;
wrect.right = lTestW;
wrect.bottom = lTestH;
AdjustWindowRectEx(&wrect, (GetWindowStyle(hWnd) & ~WS_DLGFRAME), FALSE, 0);
if (0 > wrect.left)
nMaxOffsetX = -wrect.left;
if (0 > wrect.top)
nMaxOffsetY = -wrect.top;
if (wrect.right > lTestW)
nMaxOffsetR = (wrect.right - lTestW);
if (wrect.bottom > lTestH)
nMaxOffsetB = (wrect.bottom - lTestH);
// TODO: вот тут бордер!!!
window->mainPanel->setGeometry( nMaxOffsetX + nSizeBorder_max,
nMaxOffsetY + nSizeBorder_max,
winrect.right - (nMaxOffsetX + nMaxOffsetR + 2 * nSizeBorder_max),
winrect.bottom - (nMaxOffsetY + nMaxOffsetB + 2 * nSizeBorder_max));
bIsMaximize = true;
}
else
{
QPushButton* pushButtonMaximize = window->mainPanel->findChild<QPushButton*>( "pushButtonMaximize" );
pushButtonMaximize->setStyleSheet("QPushButton {background-image:url(:/Icons/new_deploy2_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/new_deploy2_hover.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/new_deploy2_hover.png);border:none;margin:0;padding:0;}");
// TODO: вот тут бордер!!!
window->mainPanel->setGeometry( nSizeBorder_normal, nSizeBorder_normal,
winrect.right - 2 * nSizeBorder_normal,
winrect.bottom - 2 * nSizeBorder_normal);
}
}
HRGN hRgn = CreateRectRgn(nMaxOffsetX,
nMaxOffsetY,
lpWindowRect.right - lpWindowRect.left - nMaxOffsetX,
lpWindowRect.bottom - lpWindowRect.top - nMaxOffsetY);
SetWindowRgn(hWnd, hRgn, TRUE);
break;
}
case WM_ERASEBKGND:
{
#if 1
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hWnd, &ps);
RECT rect;
GetClientRect(hWnd, &rect);
LONG lMargin = 0;
rect.left -= lMargin;
rect.top -= lMargin;
rect.right += lMargin;
rect.bottom += lMargin;
// тут цвет бекграунда!
HBRUSH hBrush = CreateSolidBrush(RGB( 49, 52, 55 ));
FillRect(hDC, &rect, (HBRUSH)hBrush);
DeleteObject(hBrush);
EndPaint(hWnd, &ps);
#else
HDC hDC = GetWindowDC(hWnd);
RECT rect;
//GetClientRect(hWnd, &rect);
GetWindowRect(hWnd, &rect);
int nW = (int)(rect.right-rect.left);
int nH = (int)(rect.bottom-rect.top);
HDC hCDC = ::CreateCompatibleDC(hDC);
HBITMAP hBmp = ::CreateCompatibleBitmap(hDC, nW, nH);
HBITMAP hBmpOld = (HBITMAP)::SelectObject(hCDC, hBmp);
HBRUSH hBrush = ::CreateSolidBrush(RGB( 49, 52, 55 ));
HBRUSH hBrushOld = (HBRUSH )::SelectObject(hCDC, hBrush);
::PatBlt(hCDC, 0,0, nW, nH, PATCOPY);
::BitBlt(hDC, rect.left, rect.top, nW, nH, hCDC, 0,0, SRCCOPY);
::SelectObject(hCDC, hBrushOld);
::SelectObject(hCDC, hBmpOld);
::DeleteObject(hBrush);
::DeleteObject(hBmp);
::ReleaseDC(hWnd, hDC);
#endif
return 0;
}
case WM_NCPAINT:
{
return 0;
#if 0
if (true)
{
//if (QSysInfo::windowsVersion() != QSysInfo::WV_XP)
// DefWindowProc(hWnd, message, wParam, lParam);
HDC hdc;
//hdc = GetDCEx(hWnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
hdc = GetWindowDC(hWnd);
// Paint into this DC
RECT rect;
GetWindowRect(hWnd, &rect);
rect.left = 0;
rect.top = 0;
HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0));
//FillRect(hdc, &rect, (HBRUSH)hBrush);
FillRgn(hdc, (HRGN)wParam, hBrush);
DeleteObject(hBrush);
ReleaseDC(hWnd, hdc);
return 0;
}
break;
#endif
}
case WM_NCACTIVATE:
{
return 1;
}
case WM_GETMINMAXINFO:
{
MINMAXINFO* minMaxInfo = ( MINMAXINFO* )lParam;
if ( window->minimumSize.required )
{
minMaxInfo->ptMinTrackSize.x = window->getMinimumWidth();
minMaxInfo->ptMinTrackSize.y = window->getMinimumHeight();
}
if ( window->maximumSize.required )
{
minMaxInfo->ptMaxTrackSize.x = window->getMaximumWidth();
minMaxInfo->ptMaxTrackSize.y = window->getMaximumHeight();
}
return 0;
}
case WM_QUERYENDSESSION:
{
break;
}
case WM_ENDSESSION:
{
window->m_pManager->CloseApplication();
if (-1 != window->m_nTimerLanguageId)
{
::KillTimer(hWnd, window->m_nTimerLanguageId);
window->m_nTimerLanguageId = -1;
}
break;
}
#if 0
case WM_INPUTLANGCHANGE:
case WM_INPUTLANGCHANGEREQUEST:
{
int _lang = LOWORD(lParam);
m_oLanguage.Check(_lang);
}
#endif
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
void CMainWindow::toggleBorderless()
{
if ( visible )
{
LONG newStyle = (LONG)Style::windowed;
// чтобы не было мерцания. перерисовку при "неактивном окне" - перекроем
//newStyle &= (~WS_CAPTION);
newStyle &= (~WS_SYSMENU);
if (borderless)
{
newStyle = (LONG)Style::aero_borderless;
}
SetWindowLongPtr( hWnd, GWL_STYLE, newStyle );
borderless = !borderless;
if ( !borderless )
{
toggleShadow();
}
//redraw frame
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE /*| SWP_NOZORDER | SWP_NOOWNERZORDER */);
show();
}
}
void CMainWindow::toggleShadow()
{
if ( borderless )
{
aeroShadow = !aeroShadow;
const MARGINS shadow_on = { 1, 1, 1, 1 };
const MARGINS shadow_off = { 0, 0, 0, 0 };
//DwmExtendFrameIntoClientArea( hWnd, ( aeroShadow ) ? ( &shadow_on ) : ( &shadow_off ) );
}
}
void CMainWindow::toggleResizeable()
{
borderlessResizeable = borderlessResizeable ? false : true;
}
bool CMainWindow::isResizeable()
{
return borderlessResizeable ? true : false;
}
void CMainWindow::show()
{
ShowWindow( hWnd, SW_SHOW );
visible = true;
}
void CMainWindow::hide()
{
ShowWindow( hWnd, SW_HIDE );
visible = false;
}
bool CMainWindow::isVisible()
{
return visible ? true : false;
}
// Minimum size
void CMainWindow::setMinimumSize( const int width, const int height )
{
this->minimumSize.required = true;
this->minimumSize.width = width;
this->minimumSize.height = height;
}
bool CMainWindow::isSetMinimumSize()
{
return this->minimumSize.required;
}
void CMainWindow::removeMinimumSize()
{
this->minimumSize.required = false;
this->minimumSize.width = 0;
this->minimumSize.height = 0;
}
int CMainWindow::getMinimumWidth()
{
return minimumSize.width;
}
int CMainWindow::getMinimumHeight()
{
return minimumSize.height;
}
// Maximum size
void CMainWindow::setMaximumSize( const int width, const int height )
{
this->maximumSize.required = true;
this->maximumSize.width = width;
this->maximumSize.height = height;
}
bool CMainWindow::isSetMaximumSize()
{
return this->maximumSize.required;
}
void CMainWindow::removeMaximumSize()
{
this->maximumSize.required = false;
this->maximumSize.width = 0;
this->maximumSize.height = 0;
}
int CMainWindow::getMaximumWidth()
{
return maximumSize.width;
}
int CMainWindow::getMaximumHeight()
{
return maximumSize.height;
}

View File

@ -0,0 +1,76 @@
#include <windows.h>
#include "../../lib/include/applicationmanager.h"
#include "qmainpanel.h"
#include "qwinwidget.h"
#include <QtWidgets/QApplication>
class CMainWindow
{
enum class Style : DWORD
{
//windowed = ( WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN | WS_SYSMENU ),
//aero_borderless = ( WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN )
windowed = ( WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN ),
aero_borderless = ( WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN )
};
public:
HWND hWnd;
HINSTANCE hInstance;
CAscApplicationManager* m_pManager;
CMainWindow( QApplication *app, HBRUSH windowBackground, const int x, const int y, const int width, const int height, CAscApplicationManager* pManager );
~CMainWindow();
static LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
void show();
void hide();
bool isVisible();
void toggleBorderless();
void toggleShadow();
void toggleResizeable();
bool isResizeable();
void setMinimumSize( const int width, const int height );
bool isSetMinimumSize();
void removeMinimumSize();
int getMinimumHeight();
int getMinimumWidth();
void setMaximumSize( const int width, const int height );
bool isSetMaximumSize();
int getMaximumHeight();
int getMaximumWidth();
void removeMaximumSize();
public:
QApplication *a;
QMainPanel *mainPanel;
private:
bool closed;
bool visible;
bool borderless;
bool aeroShadow;
bool borderlessResizeable;
struct sizeType
{
sizeType() : required( false ), width( 0 ), height( 0 ) {}
bool required;
int width;
int height;
};
sizeType minimumSize;
sizeType maximumSize;
UINT_PTR m_nTimerLanguageId;
};

View File

@ -0,0 +1,656 @@
#include <windows.h>
#include <QtWidgets/QApplication>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QPushButton>
#include "asctabwidget.h"
#include <QScrollArea>
#include "qmainpanel.h"
#include <QFileDialog>
#include <windowsx.h>
#include "../../lib/include/qascprinter.h"
#include <shlwapi.h>
#include <shlobj.h>
QMainPanel::QMainPanel( HWND hWnd, CAscApplicationManager* pManager ) : QWinWidget( hWnd )
{
QObject::connect(this, SIGNAL( downloadEvent(NSEditorApi::CAscDownloadFileInfo*) ), this, SLOT( downloadEventSlot(NSEditorApi::CAscDownloadFileInfo*) ), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( setModified(int,bool)) , this, SLOT( onSetModified(int,bool)), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( signalPrint(int,int)) , this, SLOT( slotPrint(int,int)), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( dialogSave(std::wstring)), this, SLOT( onDialogSave(std::wstring)), Qt::QueuedConnection);
windowHandle = hWnd;
m_pManager = pManager;
setObjectName( "mainPanel" );
QGridLayout *mainGridLayout = new QGridLayout();
mainGridLayout->setSpacing( 0 );
mainGridLayout->setMargin( 0 );
setLayout( mainGridLayout );
// Central widget
QWidget *centralWidget = new QWidget( this );
centralWidget->setObjectName( "centralWidget" );
centralWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
centralWidget->setStyleSheet("background-color:#313437");
QWidget *centralWidget2 = new QWidget( centralWidget );
centralWidget->setObjectName( "centralWidget" );
centralWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
CAscTabWidget* pTabs = new CAscTabWidget(centralWidget);
pTabs->setGeometry(0, 0, centralWidget->width(), centralWidget->height());
pTabs->m_pManager = m_pManager;
m_pTabs = (QTabWidget*)pTabs;
m_pSaveModifiedButton = new QPushButton("", centralWidget);
m_pSaveModifiedButton->setObjectName( "pushButtoneModified" );
QObject::connect( m_pSaveModifiedButton, SIGNAL( clicked() ), this, SLOT( pushButtonSaveClicked()) );
m_pSaveModifiedButton->setStyleSheet("background-color:#FFFFFF;border:none;margin:0;padding:0;");
// Minimize
m_pButtonMinimize = new QPushButton( "", centralWidget );
m_pButtonMinimize->setObjectName( "pushButtonMinimize" );
QObject::connect( m_pButtonMinimize, SIGNAL( clicked() ), this, SLOT( pushButtonMinimizeClicked() ) );
m_pButtonMinimize->setStyleSheet("QPushButton {background-image:url(:/Icons/new_collapse_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/new_collapse_hover.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/new_collapse_hover.png);border:none;margin:0;padding:0;}");
// Maximize
m_pButtonMaximize = new QPushButton( "", centralWidget );
m_pButtonMaximize->setObjectName( "pushButtonMaximize" );
QObject::connect( m_pButtonMaximize, SIGNAL( clicked() ), this, SLOT( pushButtonMaximizeClicked() ) );
m_pButtonMaximize->setStyleSheet("QPushButton {background-image:url(:/Icons/new_deploy_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/new_deploy_hover.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/new_deploy_hover.png);border:none;margin:0;padding:0;}");
// Close
m_pButtonClose = new QPushButton( "", centralWidget );
m_pButtonClose->setObjectName( "pushButtonClose" );
QObject::connect( m_pButtonClose, SIGNAL( clicked() ), this, SLOT( pushButtonCloseClicked() ) );
m_pButtonClose->setStyleSheet("QPushButton {background-image:url(:/Icons/new_exit_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/new_exit_hover.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/new_exit_hover.png);border:none;margin:0;padding:0;}");
// Main
m_pButtonMain = new QPushButton( "", centralWidget );
m_pButtonMain->setObjectName( "pushButtonMain" );
QObject::connect( m_pButtonMain, SIGNAL( clicked() ), this, SLOT( pushButtonMainClicked() ) );
m_pButtonMain->setStyleSheet("QPushButton {background-image:url(:/Icons/Documents_active_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/Documents_active_normal.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/Documents_active_hover.png);border:none;margin:0;padding:0;}");
QCefView* pMainWidget = new QCefView(centralWidget);
pMainWidget->Create(m_pManager, cvwtSimple);
pMainWidget->setObjectName( "mainPanel" );
pMainWidget->setHidden(false);
//pMainWidget->GetCefView()->load(L"https://ascdesktop.teamlab.info/products/files/?desktop=true");
//pMainWidget->GetCefView()->load(L"https://testinfo.teamlab.info/products/files/?desktop=true");
//pMainWidget->GetCefView()->load(L"https://denisdenis.teamlab.info/products/files/?desktop=true");
//pMainWidget->GetCefView()->load(L"https://denismy.teamlab.info/products/files/?desktop=true");
//pMainWidget->GetCefView()->load(L"file:///C:/Users/oleg.korshul/Desktop/desktop/index.html");
//pMainWidget->GetCefView()->load(L"file:///C:/Users/oleg.korshul/Desktop/desktop2/index.html");
pMainWidget->GetCefView()->load(L"https://koroleg.teamlab.info/products/files/?desktop=true");
//pMainWidget->GetCefView()->load(L"http://isa2:8086");
m_pMainWidget = (QWidget*)pMainWidget;
pTabs->m_pMainWidget = m_pMainWidget;
pTabs->m_pMainButton = m_pButtonMain;
m_pSeparator = new QWidget(centralWidget);
m_pSeparator->setObjectName("separator");
m_pSeparator->setStyleSheet("background-color:#D6D6D7");
m_pSeparator->setGeometry(0, 28, this->width(), 1);
mainGridLayout->addWidget( centralWidget );
m_pDownloadBackground = new QWidget(centralWidget);
m_pDownloadBackground->setObjectName("downloadBackground");
m_pDownloadBackground->setStyleSheet("background-color:#646464;");
m_pDownloadLable = new QLabel(m_pDownloadBackground);
m_pDownloadLable->setObjectName("downloadLable");
#if 1
QPalette palette;
//white text
QBrush brush(QColor(0, 0, 0, 255));
brush.setStyle(Qt::SolidPattern);
//black background
QBrush brush1(QColor(0x64, 0x64, 0x64, 255));
brush1.setStyle(Qt::SolidPattern);
//set white text
palette.setBrush(QPalette::Active, QPalette::WindowText, brush);
palette.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
//set black background
palette.setBrush(QPalette::Active, QPalette::Window, brush1);
palette.setBrush(QPalette::Inactive, QPalette::Window, brush1);
//set palette
m_pDownloadLable->setPalette(palette);
//set font
QFont font;
font.setPixelSize(32);
font.setBold(true);
m_pDownloadLable->setFont(font);
m_pDownloadLable->setAutoFillBackground(true);
m_pDownloadLable->setText("Oleg");
#endif
m_pDownloadBackground->setHidden(true);
RecalculatePlaces();
show();
m_pManager->SetEventListener(this);
}
void QMainPanel::RecalculatePlaces()
{
int nWindowW = this->width();
int nWindowH = this->height();
int nCaptionH = 29;
m_pTabs->setGeometry(0, 0, nWindowW, nWindowH);
m_pButtonMain->setGeometry(0, 0, 108, nCaptionH);
m_pSeparator->setGeometry(0, 28, this->width(), 1);
int nStartOffset = 12;
int nBetweenApp = 12;
int nButtonW = 12;
int nY = (nCaptionH - nButtonW) >> 1;
nY = 5;
m_pButtonClose->setGeometry(nWindowW - nStartOffset - nButtonW, nY, nButtonW, nButtonW);
m_pButtonMaximize->setGeometry(nWindowW - nStartOffset - 2 * nButtonW - nBetweenApp, nY, nButtonW, nButtonW);
m_pButtonMinimize->setGeometry(nWindowW - nStartOffset - 3 * nButtonW - 2 * nBetweenApp, nY, nButtonW, nButtonW);
m_pSaveModifiedButton->setGeometry(nWindowW - nStartOffset - 4 * nButtonW - 3 * nBetweenApp, nY, nButtonW, nButtonW);
m_pMainWidget->setGeometry(0, nCaptionH, nWindowW, nWindowH - nCaptionH);
m_pDownloadBackground->setGeometry(0, nWindowH - 100, nWindowW, 100);
m_pDownloadLable->setGeometry(0, 0, nWindowW, 100);
}
// Button events
void QMainPanel::pushButtonMinimizeClicked()
{
ShowWindow( parentWindow(), SW_MINIMIZE );
}
void QMainPanel::pushButtonSaveClicked()
{
#if 0
int nCount = m_pTabs->tabBar()->count();
for (int i = 0; i < nCount; ++i)
{
if (i != m_pTabs->tabBar()->currentIndex())
{
CCefView* pCefView = ((QCefView*)m_pTabs->widget(m_pTabs->tabBar()->currentIndex()))->GetCefView();
pCefView->focus(false);
}
}
return;
#endif
#if 0
if (-1 != m_pTabs->tabBar()->currentIndex())
{
CCefView* pCefView = ((QCefView*)m_pTabs->widget(m_pTabs->tabBar()->currentIndex()))->GetCefView();
NSEditorApi::CAscMenuEvent* pEvent = new NSEditorApi::CAscMenuEvent();
pEvent->m_nType = ASC_MENU_EVENT_TYPE_CEF_PRINT_START;
pCefView->Apply(pEvent);
}
#endif
if (m_pSaveModifiedButton->styleSheet() != "background-color:#00FF00;border:none;margin:0;padding:0;")
return;
bool bIsMain = !m_pMainWidget->isHidden();
if (bIsMain)
return;
if (-1 == m_pTabs->tabBar()->currentIndex())
return;
CCefView* pCefView = ((QCefView*)m_pTabs->widget(m_pTabs->tabBar()->currentIndex()))->GetCefView();
NSEditorApi::CAscMenuEvent* pEvent = new NSEditorApi::CAscMenuEvent();
pEvent->m_nType = ASC_MENU_EVENT_TYPE_CEF_SAVE;
pCefView->Apply(pEvent);
}
void QMainPanel::pushButtonMaximizeClicked()
{
WINDOWPLACEMENT wp;
wp.length = sizeof( WINDOWPLACEMENT );
GetWindowPlacement( parentWindow(), &wp );
if ( wp.showCmd == SW_MAXIMIZE )
{
ShowWindow( parentWindow(), SW_RESTORE );
}
else
{
ShowWindow( parentWindow(), SW_MAXIMIZE );
}
}
void QMainPanel::pushButtonCloseClicked()
{
PostQuitMessage( 0 );
}
void QMainPanel::pushButtonMainClicked()
{
// test logout
//m_pManager->Logout(L"ascdesktop.teamlab.info");
m_pMainWidget->setHidden(!m_pMainWidget->isHidden());
if (m_pMainWidget->isHidden())
{
m_pButtonMain->setStyleSheet("QPushButton {background-image:url(:/Icons/Documents_disabled_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/Documents_disabled_normal.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/Documents_disabled_hover.png);border:none;margin:0;padding:0;}");
((QCefView*)m_pMainWidget)->GetCefView()->focus();
}
else
{
m_pButtonMain->setStyleSheet("QPushButton {background-image:url(:/Icons/Documents_active_normal.png);border:none;margin:0;padding:0;}\
QPushButton::hover {background-image:url(:/Icons/Documents_active_normal.png);border:none;margin:0;padding:0;}\
QPushButton::pressed {background-image:url(:/Icons/Documents_active_hover.png);border:none;margin:0;padding:0;}");
((CAscTabWidget*)m_pTabs)->FireFocus();
m_pTabs->setCurrentIndex(-1);
}
}
void QMainPanel::downloadEventSlot(NSEditorApi::CAscDownloadFileInfo* pInfo)
{
if (pInfo->get_IsComplete())
{
// файл докачался, нужно удалить его из списка
std::map<int, NSEditorApi::CAscDownloadFileInfo*>::iterator i = m_mapDownloads.find(pInfo->get_Id());
if (i != m_mapDownloads.end())
{
RELEASEINTERFACE((i->second));
m_mapDownloads.erase(i);
}
}
else
{
std::map<int, NSEditorApi::CAscDownloadFileInfo*>::iterator i = m_mapDownloads.find(pInfo->get_Id());
if (i != m_mapDownloads.end())
{
NSEditorApi::CAscDownloadFileInfo* pCurrent = i->second;
pCurrent->put_Percent(pInfo->get_Percent());
pCurrent->put_Speed(pInfo->get_Speed());
pCurrent->put_IsComplete(pInfo->get_IsComplete());
}
else
{
if (!pInfo->get_FilePath().empty())
{
ADDREFINTERFACE(pInfo);
m_mapDownloads.insert(std::pair<int, NSEditorApi::CAscDownloadFileInfo*>(pInfo->get_Id(), pInfo));
}
}
}
RELEASEINTERFACE(pInfo);
// теперь смотрим, нужно ли показывать загрузки
if (0 == m_mapDownloads.size())
{
m_pDownloadBackground->setHidden(true);
return;
}
m_pDownloadBackground->setHidden(false);
QString sText = "";
for (std::map<int, NSEditorApi::CAscDownloadFileInfo*>::iterator i = m_mapDownloads.begin(); i != m_mapDownloads.end(); i++)
{
NSEditorApi::CAscDownloadFileInfo* pInfo = i->second;
std::wstring sName = pInfo->get_FilePath();
int n1 = sName.find_last_of((wchar_t)'\\');
int n2 = sName.find_last_of((wchar_t)'/');
int n = -1;
if (n1 != std::wstring::npos)
n = n1;
if (n2 != std::wstring::npos && n2 > n1)
n = n2;
if (-1 == n)
continue;
sName = sName.substr(n + 1);
sName += L" : %1; ";
QString ss = QString::fromStdWString(sName);
int nPercent = pInfo->get_Percent();
if (nPercent < 0)
nPercent = 0;
sText += ss.arg(nPercent);
}
m_pDownloadLable->setText(sText);
}
void QMainPanel::onSetModified(int id, bool value)
{
bool bIsMain = !m_pMainWidget->isHidden();
if (bIsMain)
return;
int nTabIndex = ((CAscTabWidget*)m_pTabs)->GetTabIndexById(id);
if (nTabIndex == m_pTabs->tabBar()->currentIndex())
{
if (value == true)
m_pSaveModifiedButton->setStyleSheet("background-color:#00FF00;border:none;margin:0;padding:0;");
else
m_pSaveModifiedButton->setStyleSheet("background-color:#FFFFFF;border:none;margin:0;padding:0;");
}
}
void QMainPanel::slotPrint(int id, int pagesCount)
{
QAscPrinterContext* pContext = new QAscPrinterContext();
//pagesCount = 1;
pContext->getPrinter()->setFromTo(1, pagesCount);
QPrintDialog *dialog = new QPrintDialog(pContext->getPrinter(), NULL);
dialog->setWindowTitle(tr("Print Document"));
dialog->show();
CCefView* pView = m_pManager->GetViewById(id);
pContext->BeginPaint();
for (int i = 0; i < pagesCount; ++i)
{
pContext->AddRef();
NSEditorApi::CAscPrintPage* pData = new NSEditorApi::CAscPrintPage();
pData->put_Context(pContext);
pData->put_Page(i);
NSEditorApi::CAscMenuEvent* pEvent = new NSEditorApi::CAscMenuEvent();
pEvent->m_nType = ASC_MENU_EVENT_TYPE_CEF_PRINT_PAGE;
pEvent->m_pData = pData;
pView->Apply(pEvent);
if (i != (pagesCount - 1))
pContext->getPrinter()->newPage();
}
pContext->EndPaint();
NSEditorApi::CAscMenuEvent* pEventEnd = new NSEditorApi::CAscMenuEvent();
pEventEnd->m_nType = ASC_MENU_EVENT_TYPE_CEF_PRINT_END;
pView->Apply(pEventEnd);
pContext->Release();
}
void QMainPanel::onDialogSave(std::wstring sName)
{
OPENFILENAMEW ofn;
wchar_t szFileName[MAX_PATH] = L"";
wchar_t szFileTitle[MAX_PATH] = L"";
memcpy(szFileTitle, sName.c_str(), (sName.length() + 1) * sizeof(wchar_t));
WCHAR szFolderPath[MAX_PATH];
// Get path for each computer, non-user specific and non-roaming data.
if ( !SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, szFolderPath)) )
{
szFolderPath[0] = 0;
}
std::wstring sFullPathTemplate(szFolderPath);
sFullPathTemplate += L"\\";
sFullPathTemplate += sName;
memcpy(szFileName, sFullPathTemplate.c_str(), (sFullPathTemplate.length() + 1) * sizeof(wchar_t));
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = this->windowHandle;
ofn.lpstrFilter = (LPCWSTR)L"All Files (*.*)\0*.*\0";
ofn.lpstrInitialDir = (LPCWSTR)szFolderPath;
ofn.lpTemplateName = (LPCWSTR)szFileTitle;
ofn.lpstrFile = (LPWSTR)szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = (LPCWSTR)L"txt";
GetSaveFileName(&ofn);
//QString s = QFileDialog::getSaveFileName(NULL);
//std::wstring sPath = s.toStdWString();
std::wstring sPath(ofn.lpstrFile);
m_pManager->EndSaveDialog(sPath);
m_sDownloadName = L"";
}
void QMainPanel::sendDialogSave(std::wstring sName)
{
//emit dialogSave(sName);
m_sDownloadName = sName;
PostMessageA((HWND)this->winId(), WM_USER + 1, 0, 0);
}
bool QMainPanel::nativeEvent( const QByteArray &, void *msg, long * result)
{
Q_UNUSED(result);
MSG *message = ( MSG * )msg;
switch( message->message )
{
case WM_SYSKEYDOWN:
{
if ( message->wParam == VK_SPACE )
{
RECT winrect;
GetWindowRect( windowHandle, &winrect );
TrackPopupMenu( GetSystemMenu( windowHandle, false ), TPM_TOPALIGN | TPM_LEFTALIGN, winrect.left + 5, winrect.top + 5, 0, windowHandle, NULL);
break;
}
}
case WM_KEYDOWN:
{
if ( message->wParam == VK_F5 || message->wParam == VK_F6 || message->wParam == VK_F7)
{
SendMessage( windowHandle, WM_KEYDOWN, message->wParam, message->lParam );
break;
}
}
case (WM_USER + 1):
{
onDialogSave(m_sDownloadName);
break;
}
}
return false;
}
void QMainPanel::mousePressEvent( QMouseEvent *event )
{
if ( event->button() == Qt::LeftButton )
{
ReleaseCapture();
SendMessage( windowHandle, WM_NCLBUTTONDOWN, HTCAPTION, 0 );
}
if ( event->type() == QEvent::MouseButtonDblClick )
{
if (event -> button() == Qt::LeftButton)
{
WINDOWPLACEMENT wp;
wp.length = sizeof( WINDOWPLACEMENT );
GetWindowPlacement( parentWindow(), &wp );
if ( wp.showCmd == SW_MAXIMIZE )
{
ShowWindow( parentWindow(), SW_RESTORE );
}
else
{
ShowWindow( parentWindow(), SW_MAXIMIZE );
}
}
}
}
void QMainPanel::resizeEvent(QResizeEvent* event)
{
QWinWidget::resizeEvent(event);
this->RecalculatePlaces();
}
void QMainPanel::OnEvent(NSEditorApi::CAscMenuEvent* pEvent)
{
if (NULL == pEvent)
return;
switch (pEvent->m_nType)
{
case ASC_MENU_EVENT_TYPE_CEF_CREATETAB:
{
NSEditorApi::CAscCreateTab* pData = (NSEditorApi::CAscCreateTab*)pEvent->m_pData;
QString sUrl = QString::fromStdWString(pData->get_Url());
((CAscTabWidget*)m_pTabs)->OpenPopup(sUrl);
break;
}
case ASC_MENU_EVENT_TYPE_CEF_TABEDITORTYPE:
{
NSEditorApi::CAscTabEditorType* pData = (NSEditorApi::CAscTabEditorType*)pEvent->m_pData;
CCefView* pView = m_pManager->GetViewById(pData->get_Id());
if (NULL != pView && pView->GetType() == cvwtEditor)
{
CCefViewEditor* pEditor = (CCefViewEditor*)pView;
pEditor->SetEditorType((AscEditorType)pData->get_Type());
}
((CAscTabWidget*)m_pTabs)->UpdateIcons();
break;
}
case ASC_MENU_EVENT_TYPE_CEF_ONCLOSE:
{
NSEditorApi::CAscTypeId* pId = (NSEditorApi::CAscTypeId*)pEvent->m_pData;
int nId = pId->get_Id();
int nIndex = ((CAscTabWidget*)m_pTabs)->GetTabIndexById(nId);
m_pManager->DestroyCefView(nId);
if (-1 != nIndex)
m_pTabs->removeTab(nIndex);
break;
}
case ASC_MENU_EVENT_TYPE_CEF_DOWNLOAD_START:
{
NSEditorApi::CAscDownloadFileInfo* pData = (NSEditorApi::CAscDownloadFileInfo*)pEvent->m_pData;
QString sUrl = QString::fromStdWString(pData->get_Url());
((CAscTabWidget*)m_pTabs)->OpenDownload(sUrl, pData->get_Id());
break;
}
case ASC_MENU_EVENT_TYPE_CEF_DOWNLOAD:
{
NSEditorApi::CAscDownloadFileInfo* pData = (NSEditorApi::CAscDownloadFileInfo*)pEvent->m_pData;
if (pData->get_IsComplete())
{
((CAscTabWidget*)m_pTabs)->EndDownload(pData->get_Id());
}
ADDREFINTERFACE(pData);
emit downloadEvent(pData);
break;
}
case ASC_MENU_EVENT_TYPE_CEF_DOCUMENT_NAME:
{
NSEditorApi::CAscDocumentName* pData = (NSEditorApi::CAscDocumentName*)pEvent->m_pData;
QString sUrl = QString::fromStdWString(pData->get_Name());
((CAscTabWidget*)m_pTabs)->onSendNameAsync(sUrl, pData->get_Id());
break;
}
case ASC_MENU_EVENT_TYPE_CEF_MODIFY_CHANGED:
{
NSEditorApi::CAscDocumentModifyChanged* pData = (NSEditorApi::CAscDocumentModifyChanged*)pEvent->m_pData;
emit setModified(pData->get_Id(), pData->get_Changed());
break;
}
case ASC_MENU_EVENT_TYPE_CEF_ONSAVE:
{
OutputDebugStringA("onsave");
break;
}
case ASC_MENU_EVENT_TYPE_CEF_ONBEFORE_PRINT_END:
{
NSEditorApi::CAscPrintEnd* pData = (NSEditorApi::CAscPrintEnd*)pEvent->m_pData;
emit signalPrint(pData->get_Id(), pData->get_PagesCount());
break;
}
case ASC_MENU_EVENT_TYPE_CEF_ONKEYBOARDDOWN:
{
NSEditorApi::CAscKeyboardDown* pData = (NSEditorApi::CAscKeyboardDown*)pEvent->m_pData;
QString sFormat = QString("code: %1, ctrl: %2, shift: %3, alt: %4").arg(
QString::number(pData->get_KeyCode()),
QString::number((int)pData->get_IsCtrl()),
QString::number((int)pData->get_IsShift()),
QString::number((int)pData->get_IsAlt()));
std::string sOut = sFormat.toStdString();
OutputDebugStringA(sOut.c_str());
if (pData->get_KeyCode() == 32 && pData->get_IsAlt() == true)
{
RECT winrect;
GetWindowRect( windowHandle, &winrect );
TrackPopupMenu( GetSystemMenu( windowHandle, false ), TPM_TOPALIGN | TPM_LEFTALIGN, winrect.left + 5, winrect.top + 5, 0, windowHandle, NULL);
}
break;
}
}
RELEASEINTERFACE(pEvent);
}

View File

@ -0,0 +1,84 @@
#ifndef QMAINPANEL_H
#define QMAINPANEL_H
#include <QMouseEvent>
#include <QResizeEvent>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QPushButton>
#include "qwinwidget.h"
#include <QLabel>
#include "../../lib/include/applicationmanager.h"
class QMainPanel : public QWinWidget, public NSEditorApi::CAscMenuEventListener
{
Q_OBJECT
signals:
void downloadEvent( NSEditorApi::CAscDownloadFileInfo* );
void setModified(int, bool);
void signalPrint(int, int);
void dialogSave(std::wstring sName);
public:
QMainPanel( HWND hWnd, CAscApplicationManager* pManager );
bool nativeEvent(const QByteArray &, void *msg, long *result);
void mousePressEvent( QMouseEvent *event );
void resizeEvent(QResizeEvent* event);
public slots:
void pushButtonSaveClicked();
void pushButtonMinimizeClicked();
void pushButtonMaximizeClicked();
void pushButtonCloseClicked();
void pushButtonMainClicked();
void downloadEventSlot( NSEditorApi::CAscDownloadFileInfo* );
void onSetModified(int, bool);
void slotPrint(int, int);
void onDialogSave(std::wstring sName);
private:
HWND windowHandle;
QPushButton* m_pButtonMain;
QWidget* m_pMainWidget;
QPushButton* m_pButtonMinimize;
QPushButton* m_pButtonMaximize;
QPushButton* m_pButtonClose;
QPushButton* m_pSaveModifiedButton;
QTabWidget* m_pTabs;
QWidget* m_pSeparator;
std::wstring m_sDownloadName;
CAscApplicationManager* m_pManager;
std::map<int, NSEditorApi::CAscDownloadFileInfo*> m_mapDownloads;
QWidget* m_pDownloadBackground;
QLabel* m_pDownloadLable;
public:
HWND GetHwndForKeyboard()
{
return (HWND)((QWidget*)m_pTabs->parent())->winId();
}
public:
virtual void OnEvent(NSEditorApi::CAscMenuEvent* pEvent);
virtual bool IsSupportEvent(int nEventType)
{
return true;
}
void sendDialogSave(std::wstring sName);
private:
void RecalculatePlaces();
};
#endif // QMAINPANEL_H

View File

@ -0,0 +1,268 @@
// Implementation of the QWinHost classes
#include "qwinhost.h"
#include <QEvent>
#include <qt_windows.h>
/*!
\class QWinHost qwinhost.h
\brief The QWinHost class provides an API to use native Win32
windows in Qt applications.
QWinHost exists to provide a QWidget that can act as a parent for
any native Win32 control. Since QWinHost is a proper QWidget, it
can be used as a toplevel widget (e.g. 0 parent) or as a child of
any other QWidget.
QWinHost integrates the native control into the Qt user interface,
e.g. handles focus switches and laying out.
Applications moving to Qt may have custom Win32 controls that will
take time to rewrite with Qt. Such applications can use these
custom controls as children of QWinHost widgets. This allows the
application's user interface to be replaced gradually.
When the QWinHost is destroyed, and the Win32 window hasn't been
set with setWindow(), the window will also be destroyed.
*/
/*!
Creates an instance of QWinHost. \a parent and \a f are
passed on to the QWidget constructor. The widget has by default
no background.
\warning You cannot change the parent widget of the QWinHost instance
after the native window has been created, i.e. do not call
QWidget::setParent or move the QWinHost into a different layout.
*/
QWinHost::QWinHost(QWidget *parent, Qt::WindowFlags f) :
QWidget(parent, f), wndproc(0),own_hwnd(false), hwnd(0)
{
setAttribute(Qt::WA_NoBackground);
}
/*!
Destroys the QWinHost object. If the hosted Win32 window has not
been set explicitly using setWindow() the window will be
destroyed.
*/
QWinHost::~QWinHost()
{
if (wndproc)
{
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)wndproc);
}
if (hwnd && own_hwnd)
DestroyWindow(hwnd);
}
/*!
Reimplement this virtual function to create and return the native
Win32 window. \a parent is the handle to this widget, and \a
instance is the handle to the application instance. The returned HWND
must be a child of the \a parent HWND.
The default implementation returns null. The window returned by a
reimplementation of this function is owned by this QWinHost
instance and will be destroyed in the destructor.
This function is called by the implementation of polish() if no
window has been set explicitly using setWindow(). Call polish() to
force this function to be called.
\sa setWindow()
*/
HWND QWinHost::createWindow(HWND parent, HINSTANCE instance)
{
Q_UNUSED(parent);
Q_UNUSED(instance);
return 0;
}
/*!
Ensures that the window provided a child of this widget, unless
it is a WS_OVERLAPPED window.
*/
void QWinHost::fixParent()
{
if (!hwnd)
return;
if (!::IsWindow(hwnd))
{
hwnd = 0;
return;
}
if (::GetParent(hwnd) == (HWND)winId())
return;
long style = GetWindowLong(hwnd, GWL_STYLE);
if (style & WS_OVERLAPPED)
return;
::SetParent(hwnd, (HWND)winId());
}
/*!
Sets the native Win32 window to \a window. If \a window is not a child
window of this widget, then it is reparented to become one. If \a window
is not a child window (i.e. WS_OVERLAPPED is set), then this function does nothing.
The lifetime of the window handle will be managed by Windows, QWinHost does not
call DestroyWindow. To verify that the handle is destroyed when expected, handle
WM_DESTROY in the window procedure.
\sa window(), createWindow()
*/
void QWinHost::setWindow(HWND window)
{
if (hwnd && own_hwnd)
DestroyWindow(hwnd);
hwnd = window;
fixParent();
own_hwnd = false;
}
/*!
Returns the handle to the native Win32 window, or null if no
window has been set or created yet.
\sa setWindow(), createWindow()
*/
HWND QWinHost::window() const
{
return hwnd;
}
void *getWindowProc(QWinHost *host)
{
return host ? host->wndproc : 0;
}
LRESULT CALLBACK WinHostProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
QWinHost *widget = qobject_cast<QWinHost*>(QWidget::find((WId)::GetParent(hwnd)));
WNDPROC oldproc = (WNDPROC)getWindowProc(widget);
if (widget)
{
switch(msg)
{
case WM_LBUTTONDOWN:
if (::GetFocus() != hwnd && (widget->focusPolicy() & Qt::ClickFocus))
{
widget->setFocus(Qt::MouseFocusReason);
}
break;
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
SendMessage((HWND)widget->winId(), msg, wParam, lParam);
break;
case WM_KEYDOWN:
if (wParam == VK_TAB)
{
SendMessage((HWND)widget->winId(), msg, wParam, lParam);
}
break;
default:
break;
}
}
if (oldproc)
return CallWindowProc(oldproc, hwnd, msg, wParam, lParam);
return DefWindowProc(hwnd, msg, wParam, lParam);
}
/*!
\reimp
*/
bool QWinHost::event(QEvent *e)
{
switch(e->type())
{
case QEvent::Polish:
if (!hwnd)
{
hwnd = createWindow((HWND)winId(), qWinAppInst());
fixParent();
own_hwnd = hwnd != 0;
}
if (hwnd && !wndproc && GetParent(hwnd) == (HWND)winId())
{
wndproc = (void*)GetWindowLongPtr(hwnd, GWLP_WNDPROC);
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)WinHostProc);
LONG style = GetWindowLong(hwnd, GWL_STYLE);
if (style & WS_TABSTOP)
setFocusPolicy(Qt::FocusPolicy(focusPolicy() | Qt::StrongFocus));
}
break;
case QEvent::WindowBlocked:
if (hwnd)
EnableWindow(hwnd, false);
break;
case QEvent::WindowUnblocked:
if (hwnd)
EnableWindow(hwnd, true);
break;
}
return QWidget::event(e);
}
/*!
\reimp
*/
void QWinHost::showEvent(QShowEvent *e)
{
QWidget::showEvent(e);
if (hwnd)
SetWindowPos(hwnd, HWND_TOP, 0, 0, width(), height(), SWP_SHOWWINDOW);
}
/*!
\reimp
*/
void QWinHost::focusInEvent(QFocusEvent *e)
{
QWidget::focusInEvent(e);
if (hwnd)
::SetFocus(hwnd);
}
/*!
\reimp
*/
void QWinHost::resizeEvent(QResizeEvent *e)
{
QWidget::resizeEvent(e);
if (hwnd)
SetWindowPos(hwnd, HWND_TOP, 0, 0, width(), height(), 0);
}
/*!
\reimp
*/
bool QWinHost::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
MSG *msg = (MSG *)message;
switch (msg->message)
{
case WM_SETFOCUS:
if (hwnd)
{
::SetFocus(hwnd);
return true;
}
default:
break;
}
return QWidget::nativeEvent(eventType, message, result);
}

View File

@ -0,0 +1,36 @@
#ifndef QWINHOST_H
#define QWINHOST_H
#include <QtWidgets/QWidget>
#include <Windows.h>
class QWinHost : public QWidget
{
Q_OBJECT
public:
QWinHost(QWidget *parent = 0, Qt::WindowFlags f = 0);
~QWinHost();
void setWindow(HWND);
HWND window() const;
protected:
virtual HWND createWindow(HWND parent, HINSTANCE instance);
bool event(QEvent *e);
void showEvent(QShowEvent *);
void focusInEvent(QFocusEvent*);
void resizeEvent(QResizeEvent*);
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
private:
void fixParent();
friend void* getWindowProc(QWinHost*);
void* wndproc;
bool own_hwnd;
HWND hwnd;
};
#endif // QWINHOST_H

View File

@ -0,0 +1,333 @@
#include <qevent.h>
#include "qwinwidget.h"
#include <qt_windows.h>
#include <QtWidgets/QApplication>
#include <QWindow>
#include <qpa/qplatformnativeinterface.h>
/*!
\class QWinWidget qwinwidget.h
\brief The QWinWidget class is a Qt widget that can be child of a
native Win32 widget.
The QWinWidget class is the bridge between an existing application
user interface developed using native Win32 APIs or toolkits like
MFC, and Qt based GUI elements.
Using QWinWidget as the parent of QDialogs will ensure that
modality, placement and stacking works properly throughout the
entire application. If the child widget is a top level window that
uses the \c WDestructiveClose flag, QWinWidget will destroy itself
when the child window closes down.
Applications moving to Qt can use QWinWidget to add new
functionality, and gradually replace the existing interface.
*/
/*!
Creates an instance of QWinWidget. \a hParentWnd is the handle to
the native Win32 parent. If a \a parent is provided the object is
owned by that QObject. \a f is passed on to the QWidget constructor.
*/
QWinWidget::QWinWidget(HWND hParentWnd, QObject *parent, Qt::WindowFlags f)
: QWidget(0, f), hParent(hParentWnd), prevFocus(0), reenable_parent(false)
{
if (parent)
QObject::setParent(parent);
init();
}
void QWinWidget::init()
{
Q_ASSERT(hParent);
if (hParent)
{
// make the widget window style be WS_CHILD so SetParent will work
LONG lStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
SetWindowLong((HWND)winId(), GWL_STYLE, lStyle);
QWindow *window = windowHandle();
window->setProperty("_q_embedded_native_parent_handle", (WId)hParent);
HWND h = static_cast<HWND>(QGuiApplication::platformNativeInterface()->
nativeResourceForWindow("handle", window));
SetParent(h, hParent);
window->setFlags(Qt::FramelessWindowHint);
QEvent e(QEvent::EmbeddingControl);
QApplication::sendEvent(this, &e);
}
}
/*!
Destroys this object, freeing all allocated resources.
*/
QWinWidget::~QWinWidget()
{
}
/*!
Returns the handle of the native Win32 parent window.
*/
HWND QWinWidget::parentWindow() const
{
return hParent;
}
/*!
\reimp
*/
void QWinWidget::childEvent(QChildEvent *e)
{
QObject *obj = e->child();
if (obj->isWidgetType())
{
if (e->added())
{
if (obj->isWidgetType())
{
obj->installEventFilter(this);
}
}
else if (e->removed() && reenable_parent)
{
reenable_parent = false;
EnableWindow(hParent, true);
obj->removeEventFilter(this);
}
}
QWidget::childEvent(e);
}
/*! \internal */
void QWinWidget::saveFocus()
{
if (!prevFocus)
prevFocus = ::GetFocus();
if (!prevFocus)
prevFocus = parentWindow();
}
/*!
Shows this widget. Overrides QWidget::show().
\sa showCentered()
*/
void QWinWidget::show()
{
saveFocus();
QWidget::show();
}
/*!
Centers this widget over the native parent window. Use this
function to have Qt toplevel windows (i.e. dialogs) positioned
correctly over their native parent windows.
\code
QWinWidget qwin(hParent);
qwin.center();
QMessageBox::information(&qwin, "Caption", "Information Text");
\endcode
This will center the message box over the client area of hParent.
*/
void QWinWidget::center()
{
const QWidget *child = findChild<QWidget*>();
if (child && !child->isWindow())
{
qWarning("QWinWidget::center: Call this function only for QWinWidgets with toplevel children");
}
RECT r;
GetWindowRect(hParent, &r);
setGeometry((r.right-r.left)/2+r.left, (r.bottom-r.top)/2+r.top,0,0);
}
/*!
\obsolete
Call center() instead.
*/
void QWinWidget::showCentered()
{
center();
show();
}
/*!
Sets the focus to the window that had the focus before this widget
was shown, or if there was no previous window, sets the focus to
the parent window.
*/
void QWinWidget::resetFocus()
{
if (prevFocus)
::SetFocus(prevFocus);
else
::SetFocus(parentWindow());
}
/*! \reimp
*/
bool QWinWidget::nativeEvent(const QByteArray &, void *message, long *)
{
MSG *msg = (MSG *)message;
if (msg->message == WM_SETFOCUS)
{
Qt::FocusReason reason;
if (::GetKeyState(VK_LBUTTON) < 0 || ::GetKeyState(VK_RBUTTON) < 0)
reason = Qt::MouseFocusReason;
else if (::GetKeyState(VK_SHIFT) < 0)
reason = Qt::BacktabFocusReason;
else
reason = Qt::TabFocusReason;
QFocusEvent e(QEvent::FocusIn, reason);
QApplication::sendEvent(this, &e);
}
return false;
}
/*!
\reimp
*/
bool QWinWidget::eventFilter(QObject *o, QEvent *e)
{
QWidget *w = (QWidget*)o;
switch (e->type())
{
case QEvent::WindowDeactivate:
if (w->isModal() && w->isHidden())
BringWindowToTop(hParent);
break;
case QEvent::Hide:
if (reenable_parent)
{
EnableWindow(hParent, true);
reenable_parent = false;
}
resetFocus();
if (w->testAttribute(Qt::WA_DeleteOnClose) && w->isWindow())
deleteLater();
break;
case QEvent::Show:
if (w->isWindow())
{
saveFocus();
hide();
if (w->isModal() && !reenable_parent)
{
EnableWindow(hParent, false);
reenable_parent = true;
}
}
break;
case QEvent::Close:
::SetActiveWindow(hParent);
if (w->testAttribute(Qt::WA_DeleteOnClose))
deleteLater();
break;
default:
break;
}
return QWidget::eventFilter(o, e);
}
/*! \reimp
*/
void QWinWidget::focusInEvent(QFocusEvent *e)
{
QWidget *candidate = this;
switch (e->reason())
{
case Qt::TabFocusReason:
case Qt::BacktabFocusReason:
while (!(candidate->focusPolicy() & Qt::TabFocus))
{
candidate = candidate->nextInFocusChain();
if (candidate == this)
{
candidate = 0;
break;
}
}
if (candidate)
{
candidate->setFocus(e->reason());
if (e->reason() == Qt::BacktabFocusReason || e->reason() == Qt::TabFocusReason)
{
candidate->setAttribute(Qt::WA_KeyboardFocusChange);
candidate->window()->setAttribute(Qt::WA_KeyboardFocusChange);
}
if (e->reason() == Qt::BacktabFocusReason)
QWidget::focusNextPrevChild(false);
}
break;
default:
break;
}
}
/*! \reimp
*/
bool QWinWidget::focusNextPrevChild(bool next)
{
QWidget *curFocus = focusWidget();
if (!next)
{
if (!curFocus->isWindow())
{
QWidget *nextFocus = curFocus->nextInFocusChain();
QWidget *prevFocus = 0;
QWidget *topLevel = 0;
while (nextFocus != curFocus)
{
if (nextFocus->focusPolicy() & Qt::TabFocus)
{
prevFocus = nextFocus;
topLevel = 0;
}
else if (nextFocus->isWindow())
{
topLevel = nextFocus;
}
nextFocus = nextFocus->nextInFocusChain();
}
if (!topLevel)
{
return QWidget::focusNextPrevChild(false);
}
}
}
else
{
QWidget *nextFocus = curFocus;
while (1)
{
nextFocus = nextFocus->nextInFocusChain();
if (nextFocus->isWindow())
break;
if (nextFocus->focusPolicy() & Qt::TabFocus)
{
return QWidget::focusNextPrevChild(true);
}
}
}
::SetFocus(hParent);
return true;
}

View File

@ -0,0 +1,38 @@
#ifndef QWINWIDGET_H
#define QWINWIDGET_H
#include <QtWidgets/QWidget>
class QWinWidget : public QWidget
{
Q_OBJECT
public:
QWinWidget( HWND hParentWnd, QObject *parent = 0, Qt::WindowFlags f = 0 );
~QWinWidget();
void show();
void center();
void showCentered();
HWND parentWindow() const;
protected:
void childEvent( QChildEvent *e );
bool eventFilter( QObject *o, QEvent *e );
bool focusNextPrevChild(bool next);
void focusInEvent(QFocusEvent *e);
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
private:
void init();
void saveFocus();
void resetFocus();
HWND hParent;
HWND prevFocus;
bool reenable_parent;
};
#endif // QWINWIDGET_H

View File

@ -0,0 +1,643 @@
QT -= core
QT -= gui
TARGET = ascdocumentscore
TEMPLATE = lib
CONFIG += static
CONFIG += shared
CONFIG += plugin
DEFINES += HUNSPELL_STATIC
DEFINES += \
_QT \
FT2_BUILD_LIBRARY \
EXCLUDE_JPG_SUPPORT \
MNG_SUPPORT_DISPLAY \
MNG_SUPPORT_READ \
MNG_SUPPORT_WRITE \
MNG_ACCESS_CHUNKS \
MNG_STORE_CHUNKS\
MNG_ERROR_TELLTALE
DEFINES += \
"V8_DEPRECATION_WARNINGS" \
"_WIN32_WINNT=0x0602" \
"WINVER=0x0602" \
"WIN32" \
"_WINDOWS" \
"NOMINMAX" \
"PSAPI_VERSION=1" \
"_CRT_RAND_S" \
"CERT_CHAIN_PARA_HAS_EXTRA_FIELDS" \
"WIN32_LEAN_AND_MEAN" \
"_ATL_NO_OPENGL" \
"_HAS_EXCEPTIONS=0" \
"_SECURE_ATL" \
"CHROMIUM_BUILD" \
"TOOLKIT_VIEWS=1" \
"USE_AURA=1" \
"USE_ASH=1" \
"USE_DEFAULT_RENDER_THEME=1" \
"USE_LIBJPEG_TURBO=1" \
"ENABLE_ONE_CLICK_SIGNIN" \
"ENABLE_PRE_SYNC_BACKUP" \
"ENABLE_REMOTING=1" \
"ENABLE_WEBRTC=1" \
"ENABLE_PEPPER_CDMS" \
"ENABLE_CONFIGURATION_POLICY" \
"ENABLE_NOTIFICATIONS" \
"ENABLE_HIDPI=1" \
"ENABLE_EGLIMAGE=1" \
"__STD_C" \
"_CRT_SECURE_NO_DEPRECATE" \
"_SCL_SECURE_NO_DEPRECATE" \
"NTDDI_VERSION=0x06020000" \
"_USING_V110_SDK71_" \
"ENABLE_TASK_MANAGER=1" \
"ENABLE_EXTENSIONS=1" \
"ENABLE_PLUGIN_INSTALLATION=1" \
"ENABLE_PLUGINS=1" \
"ENABLE_SESSION_SERVICE=1" \
"ENABLE_THEMES=1" \
"ENABLE_AUTOFILL_DIALOG=1" \
"ENABLE_BACKGROUND=1" \
"ENABLE_GOOGLE_NOW=1" \
"CLD_VERSION=2" \
"CLD2_DATA_SOURCE=static" \
"ENABLE_FULL_PRINTING=1" \
"ENABLE_PRINTING=1" \
"ENABLE_SPELLCHECK=1" \
"ENABLE_CAPTIVE_PORTAL_DETECTION=1" \
"ENABLE_APP_LIST=1" \
"ENABLE_SETTINGS_APP=1" \
"ENABLE_MANAGED_USERS=1" \
"ENABLE_MDNS=1" \
"ENABLE_SERVICE_DISCOVERY=1" \
"ENABLE_WIFI_BOOTSTRAPPING=1" \
"ENABLE_LOAD_COMPLETION_HACKS=1" \
"USING_CEF_SHARED" \
"__STDC_CONSTANT_MACROS" \
"__STDC_FORMAT_MACROS" \
"NDEBUG" \
"NVALGRIND" \
"DYNAMIC_ANNOTATIONS_ENABLED=0"
LIBS += -lwininet \
-ldnsapi \
-lversion \
-lmsimg32 \
-lws2_32 \
-lusp10 \
-lpsapi \
-ldbghelp \
-lwinmm \
-lshlwapi \
-lkernel32 \
-lgdi32 \
-lwinspool \
-lcomdlg32 \
-ladvapi32 \
-lshell32 \
-lole32 \
-loleaut32 \
-luser32 \
-luuid \
-lodbc32 \
-lodbccp32 \
-ldelayimp \
-lcredui \
-lnetapi32 \
-lcomctl32 \
-lrpcrt4 \
-lgdiplus \
-lUrlmon \
-lOpenGL32
INCLUDEPATH += \
src/cef/windows
HEADERS += \
src/cef/windows/include/base/internal/cef_atomicops_x86_msvc.h \
src/cef/windows/include/base/internal/cef_bind_internal.h \
src/cef/windows/include/base/internal/cef_bind_internal_win.h \
src/cef/windows/include/base/internal/cef_callback_internal.h \
src/cef/windows/include/base/internal/cef_lock_impl.h \
src/cef/windows/include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h \
src/cef/windows/include/base/internal/cef_thread_checker_impl.h \
src/cef/windows/include/base/cef_atomic_ref_count.h \
src/cef/windows/include/base/cef_atomicops.h \
src/cef/windows/include/base/cef_basictypes.h \
src/cef/windows/include/base/cef_bind.h \
src/cef/windows/include/base/cef_bind_helpers.h \
src/cef/windows/include/base/cef_build.h \
src/cef/windows/include/base/cef_callback.h \
src/cef/windows/include/base/cef_callback_forward.h \
src/cef/windows/include/base/cef_callback_helpers.h \
src/cef/windows/include/base/cef_callback_list.h \
src/cef/windows/include/base/cef_cancelable_callback.h \
src/cef/windows/include/base/cef_lock.h \
src/cef/windows/include/base/cef_logging.h \
src/cef/windows/include/base/cef_macros.h \
src/cef/windows/include/base/cef_move.h \
src/cef/windows/include/base/cef_platform_thread.h \
src/cef/windows/include/base/cef_ref_counted.h \
src/cef/windows/include/base/cef_scoped_ptr.h \
src/cef/windows/include/base/cef_string16.h \
src/cef/windows/include/base/cef_template_util.h \
src/cef/windows/include/base/cef_thread_checker.h \
src/cef/windows/include/base/cef_thread_collision_warner.h \
src/cef/windows/include/base/cef_trace_event.h \
src/cef/windows/include/base/cef_tuple.h \
src/cef/windows/include/base/cef_weak_ptr.h \
src/cef/windows/include/capi/cef_app_capi.h \
src/cef/windows/include/capi/cef_auth_callback_capi.h \
src/cef/windows/include/capi/cef_base_capi.h \
src/cef/windows/include/capi/cef_browser_capi.h \
src/cef/windows/include/capi/cef_browser_process_handler_capi.h \
src/cef/windows/include/capi/cef_callback_capi.h \
src/cef/windows/include/capi/cef_client_capi.h \
src/cef/windows/include/capi/cef_command_line_capi.h \
src/cef/windows/include/capi/cef_context_menu_handler_capi.h \
src/cef/windows/include/capi/cef_cookie_capi.h \
src/cef/windows/include/capi/cef_dialog_handler_capi.h \
src/cef/windows/include/capi/cef_display_handler_capi.h \
src/cef/windows/include/capi/cef_dom_capi.h \
src/cef/windows/include/capi/cef_download_handler_capi.h \
src/cef/windows/include/capi/cef_download_item_capi.h \
src/cef/windows/include/capi/cef_drag_data_capi.h \
src/cef/windows/include/capi/cef_drag_handler_capi.h \
src/cef/windows/include/capi/cef_find_handler_capi.h \
src/cef/windows/include/capi/cef_focus_handler_capi.h \
src/cef/windows/include/capi/cef_frame_capi.h \
src/cef/windows/include/capi/cef_geolocation_capi.h \
src/cef/windows/include/capi/cef_geolocation_handler_capi.h \
src/cef/windows/include/capi/cef_jsdialog_handler_capi.h \
src/cef/windows/include/capi/cef_keyboard_handler_capi.h \
src/cef/windows/include/capi/cef_life_span_handler_capi.h \
src/cef/windows/include/capi/cef_load_handler_capi.h \
src/cef/windows/include/capi/cef_menu_model_capi.h \
src/cef/windows/include/capi/cef_navigation_entry_capi.h \
src/cef/windows/include/capi/cef_origin_whitelist_capi.h \
src/cef/windows/include/capi/cef_parser_capi.h \
src/cef/windows/include/capi/cef_path_util_capi.h \
src/cef/windows/include/capi/cef_print_handler_capi.h \
src/cef/windows/include/capi/cef_print_settings_capi.h \
src/cef/windows/include/capi/cef_process_message_capi.h \
src/cef/windows/include/capi/cef_process_util_capi.h \
src/cef/windows/include/capi/cef_render_handler_capi.h \
src/cef/windows/include/capi/cef_render_process_handler_capi.h \
src/cef/windows/include/capi/cef_request_capi.h \
src/cef/windows/include/capi/cef_request_context_capi.h \
src/cef/windows/include/capi/cef_request_context_handler_capi.h \
src/cef/windows/include/capi/cef_request_handler_capi.h \
src/cef/windows/include/capi/cef_resource_bundle_handler_capi.h \
src/cef/windows/include/capi/cef_resource_handler_capi.h \
src/cef/windows/include/capi/cef_response_capi.h \
src/cef/windows/include/capi/cef_scheme_capi.h \
src/cef/windows/include/capi/cef_ssl_info_capi.h \
src/cef/windows/include/capi/cef_stream_capi.h \
src/cef/windows/include/capi/cef_string_visitor_capi.h \
src/cef/windows/include/capi/cef_task_capi.h \
src/cef/windows/include/capi/cef_trace_capi.h \
src/cef/windows/include/capi/cef_urlrequest_capi.h \
src/cef/windows/include/capi/cef_v8_capi.h \
src/cef/windows/include/capi/cef_values_capi.h \
src/cef/windows/include/capi/cef_web_plugin_capi.h \
src/cef/windows/include/capi/cef_xml_reader_capi.h \
src/cef/windows/include/capi/cef_zip_reader_capi.h \
src/cef/windows/include/internal/cef_export.h \
src/cef/windows/include/internal/cef_logging_internal.h \
src/cef/windows/include/internal/cef_ptr.h \
src/cef/windows/include/internal/cef_string.h \
src/cef/windows/include/internal/cef_string_list.h \
src/cef/windows/include/internal/cef_string_map.h \
src/cef/windows/include/internal/cef_string_multimap.h \
src/cef/windows/include/internal/cef_string_types.h \
src/cef/windows/include/internal/cef_string_wrappers.h \
src/cef/windows/include/internal/cef_thread_internal.h \
src/cef/windows/include/internal/cef_time.h \
src/cef/windows/include/internal/cef_trace_event_internal.h \
src/cef/windows/include/internal/cef_types.h \
src/cef/windows/include/internal/cef_types_win.h \
src/cef/windows/include/internal/cef_types_wrappers.h \
src/cef/windows/include/internal/cef_win.h \
src/cef/windows/include/wrapper/cef_byte_read_handler.h \
src/cef/windows/include/wrapper/cef_closure_task.h \
src/cef/windows/include/wrapper/cef_helpers.h \
src/cef/windows/include/wrapper/cef_message_router.h \
src/cef/windows/include/wrapper/cef_resource_manager.h \
src/cef/windows/include/wrapper/cef_stream_resource_handler.h \
src/cef/windows/include/wrapper/cef_xml_object.h \
src/cef/windows/include/wrapper/cef_zip_archive.h \
src/cef/windows/include/cef_app.h \
src/cef/windows/include/cef_auth_callback.h \
src/cef/windows/include/cef_base.h \
src/cef/windows/include/cef_browser.h \
src/cef/windows/include/cef_browser_process_handler.h \
src/cef/windows/include/cef_callback.h \
src/cef/windows/include/cef_client.h \
src/cef/windows/include/cef_command_line.h \
src/cef/windows/include/cef_context_menu_handler.h \
src/cef/windows/include/cef_cookie.h \
src/cef/windows/include/cef_dialog_handler.h \
src/cef/windows/include/cef_display_handler.h \
src/cef/windows/include/cef_dom.h \
src/cef/windows/include/cef_download_handler.h \
src/cef/windows/include/cef_download_item.h \
src/cef/windows/include/cef_drag_data.h \
src/cef/windows/include/cef_drag_handler.h \
src/cef/windows/include/cef_find_handler.h \
src/cef/windows/include/cef_focus_handler.h \
src/cef/windows/include/cef_frame.h \
src/cef/windows/include/cef_geolocation.h \
src/cef/windows/include/cef_geolocation_handler.h \
src/cef/windows/include/cef_jsdialog_handler.h \
src/cef/windows/include/cef_keyboard_handler.h \
src/cef/windows/include/cef_life_span_handler.h \
src/cef/windows/include/cef_load_handler.h \
src/cef/windows/include/cef_menu_model.h \
src/cef/windows/include/cef_navigation_entry.h \
src/cef/windows/include/cef_origin_whitelist.h \
src/cef/windows/include/cef_pack_resources.h \
src/cef/windows/include/cef_pack_strings.h \
src/cef/windows/include/cef_parser.h \
src/cef/windows/include/cef_path_util.h \
src/cef/windows/include/cef_print_handler.h \
src/cef/windows/include/cef_print_settings.h \
src/cef/windows/include/cef_process_message.h \
src/cef/windows/include/cef_process_util.h \
src/cef/windows/include/cef_render_handler.h \
src/cef/windows/include/cef_render_process_handler.h \
src/cef/windows/include/cef_request.h \
src/cef/windows/include/cef_request_context.h \
src/cef/windows/include/cef_request_context_handler.h \
src/cef/windows/include/cef_request_handler.h \
src/cef/windows/include/cef_resource_bundle_handler.h \
src/cef/windows/include/cef_resource_handler.h \
src/cef/windows/include/cef_response.h \
src/cef/windows/include/cef_runnable.h \
src/cef/windows/include/cef_sandbox_win.h \
src/cef/windows/include/cef_scheme.h \
src/cef/windows/include/cef_ssl_info.h \
src/cef/windows/include/cef_stream.h \
src/cef/windows/include/cef_string_visitor.h \
src/cef/windows/include/cef_task.h \
src/cef/windows/include/cef_trace.h \
src/cef/windows/include/cef_urlrequest.h \
src/cef/windows/include/cef_v8.h \
src/cef/windows/include/cef_values.h \
src/cef/windows/include/cef_version.h \
src/cef/windows/include/cef_web_plugin.h \
src/cef/windows/include/cef_xml_reader.h \
src/cef/windows/include/cef_zip_reader.h \
src/cef/windows/libcef_dll/transfer_util.h \
src/cef/windows/libcef_dll/wrapper_types.h \
src/cef/windows/libcef_dll/cpptoc/app_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/base_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/browser_process_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/client_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/completion_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/context_menu_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/cookie_visitor_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/delete_cookies_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/dialog_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/display_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/domvisitor_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/download_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/drag_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/end_tracing_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/find_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/focus_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/geolocation_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/jsdialog_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/keyboard_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/life_span_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/load_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/pdf_print_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/print_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/read_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/render_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/render_process_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/request_context_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/request_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/resource_handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/set_cookie_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/string_visitor_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/task_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/urlrequest_client_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/v8accessor_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/v8handler_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.h \
src/cef/windows/libcef_dll/cpptoc/write_handler_cpptoc.h \
src/cef/windows/libcef_dll/ctocpp/auth_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/before_download_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/binary_value_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/browser_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/browser_host_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/command_line_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/context_menu_params_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/cookie_manager_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/dictionary_value_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/domdocument_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/domnode_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/download_item_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/download_item_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/drag_data_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/file_dialog_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/frame_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/geolocation_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/jsdialog_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/list_value_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/menu_model_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/navigation_entry_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/post_data_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/post_data_element_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/print_dialog_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/print_job_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/print_settings_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/process_message_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/request_callback_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/request_context_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/request_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/response_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/scheme_registrar_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/sslcert_principal_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/sslinfo_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/stream_reader_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/stream_writer_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/task_runner_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/urlrequest_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/v8context_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/v8exception_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/v8stack_frame_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/v8stack_trace_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/v8value_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/value_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/web_plugin_info_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/xml_reader_ctocpp.h \
src/cef/windows/libcef_dll/ctocpp/zip_reader_ctocpp.h \
src/cef/windows/libcef_dll/wrapper/cef_browser_info_map.h \
src/cef/windows/cefclient/browser/binding_test.h \
src/cef/windows/cefclient/browser/browser_window.h \
src/cef/windows/cefclient/browser/browser_window_osr_win.h \
src/cef/windows/cefclient/browser/browser_window_std_win.h \
src/cef/windows/cefclient/browser/bytes_write_handler.h \
src/cef/windows/cefclient/browser/client_app_browser.h \
src/cef/windows/cefclient/browser/client_handler.h \
src/cef/windows/cefclient/browser/client_handler_osr.h \
src/cef/windows/cefclient/browser/client_handler_std.h \
src/cef/windows/cefclient/browser/client_types.h \
src/cef/windows/cefclient/browser/dialog_test.h \
src/cef/windows/cefclient/browser/main_context.h \
src/cef/windows/cefclient/browser/main_context_impl.h \
src/cef/windows/cefclient/browser/main_message_loop.h \
src/cef/windows/cefclient/browser/main_message_loop_multithreaded_win.h \
src/cef/windows/cefclient/browser/main_message_loop_std.h \
src/cef/windows/cefclient/browser/osr_dragdrop_events.h \
src/cef/windows/cefclient/browser/osr_dragdrop_win.h \
src/cef/windows/cefclient/browser/osr_renderer.h \
src/cef/windows/cefclient/browser/osr_window_win.h \
src/cef/windows/cefclient/browser/resource.h \
src/cef/windows/cefclient/browser/resource_util.h \
src/cef/windows/cefclient/browser/root_window.h \
src/cef/windows/cefclient/browser/root_window_manager.h \
src/cef/windows/cefclient/browser/root_window_win.h \
src/cef/windows/cefclient/browser/scheme_test.h \
src/cef/windows/cefclient/browser/temp_window.h \
src/cef/windows/cefclient/browser/temp_window_win.h \
src/cef/windows/cefclient/browser/test_runner.h \
src/cef/windows/cefclient/browser/urlrequest_test.h \
src/cef/windows/cefclient/browser/util_win.h \
src/cef/windows/cefclient/browser/window_test.h \
src/cef/windows/cefclient/common/client_app.h \
src/cef/windows/cefclient/common/client_app_other.h \
src/cef/windows/cefclient/common/client_switches.h \
src/cef/windows/cefclient/common/scheme_test_common.h \
src/cef/windows/cefclient/renderer/client_app_renderer.h \
src/cef/windows/cefclient/renderer/client_renderer.h \
src/cef/windows/cefclient/renderer/performance_test.h \
src/cef/windows/cefclient/renderer/performance_test_setup.h
SOURCES += \
src/cef/windows/libcef_dll/transfer_util.cc \
src/cef/windows/libcef_dll/base/cef_atomicops_x86_gcc.cc \
src/cef/windows/libcef_dll/base/cef_bind_helpers.cc \
src/cef/windows/libcef_dll/base/cef_callback_helpers.cc \
src/cef/windows/libcef_dll/base/cef_callback_internal.cc \
src/cef/windows/libcef_dll/base/cef_lock.cc \
src/cef/windows/libcef_dll/base/cef_lock_impl.cc \
src/cef/windows/libcef_dll/base/cef_logging.cc \
src/cef/windows/libcef_dll/base/cef_ref_counted.cc \
src/cef/windows/libcef_dll/base/cef_string16.cc \
src/cef/windows/libcef_dll/base/cef_thread_checker_impl.cc \
src/cef/windows/libcef_dll/base/cef_thread_collision_warner.cc \
src/cef/windows/libcef_dll/base/cef_weak_ptr.cc \
src/cef/windows/libcef_dll/cpptoc/app_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/base_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/client_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/completion_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/context_menu_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/cookie_visitor_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/dialog_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/display_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/domvisitor_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/download_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/drag_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/end_tracing_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/find_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/focus_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/life_span_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/load_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/pdf_print_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/print_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/read_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/render_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/render_process_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/request_context_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/request_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/resource_handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/string_visitor_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/task_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/urlrequest_client_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/v8accessor_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/v8handler_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/web_plugin_unstable_callback_cpptoc.cc \
src/cef/windows/libcef_dll/cpptoc/write_handler_cpptoc.cc \
src/cef/windows/libcef_dll/ctocpp/auth_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/before_download_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/binary_value_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/browser_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/browser_host_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/command_line_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/context_menu_params_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/cookie_manager_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/dictionary_value_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/domdocument_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/domnode_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/download_item_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/download_item_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/drag_data_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/file_dialog_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/frame_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/list_value_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/menu_model_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/navigation_entry_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/post_data_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/post_data_element_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/print_dialog_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/print_job_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/print_settings_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/process_message_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/request_callback_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/request_context_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/request_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/response_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/sslcert_principal_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/sslinfo_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/stream_reader_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/stream_writer_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/task_runner_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/urlrequest_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/v8context_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/v8exception_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/v8stack_frame_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/v8stack_trace_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/v8value_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/value_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/web_plugin_info_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/xml_reader_ctocpp.cc \
src/cef/windows/libcef_dll/ctocpp/zip_reader_ctocpp.cc \
src/cef/windows/libcef_dll/wrapper/cef_byte_read_handler.cc \
src/cef/windows/libcef_dll/wrapper/cef_closure_task.cc \
src/cef/windows/libcef_dll/wrapper/cef_message_router.cc \
src/cef/windows/libcef_dll/wrapper/cef_resource_manager.cc \
src/cef/windows/libcef_dll/wrapper/cef_stream_resource_handler.cc \
src/cef/windows/libcef_dll/wrapper/cef_xml_object.cc \
src/cef/windows/libcef_dll/wrapper/cef_zip_archive.cc \
src/cef/windows/libcef_dll/wrapper/libcef_dll_wrapper.cc \
src/cef/windows/libcef_dll/wrapper/libcef_dll_wrapper2.cc \
src/cef/windows/cefclient/cefclient_win.cc \
src/cef/windows/cefclient/browser/binding_test.cc \
src/cef/windows/cefclient/browser/browser_window.cc \
src/cef/windows/cefclient/browser/browser_window_osr_win.cc \
src/cef/windows/cefclient/browser/browser_window_std_win.cc \
src/cef/windows/cefclient/browser/bytes_write_handler.cc \
src/cef/windows/cefclient/browser/client_app_browser.cc \
src/cef/windows/cefclient/browser/client_app_delegates_browser.cc \
src/cef/windows/cefclient/browser/client_handler.cc \
src/cef/windows/cefclient/browser/client_handler_osr.cc \
src/cef/windows/cefclient/browser/client_handler_std.cc \
src/cef/windows/cefclient/browser/dialog_test.cc \
src/cef/windows/cefclient/browser/main_context.cc \
src/cef/windows/cefclient/browser/main_context_impl.cc \
src/cef/windows/cefclient/browser/main_context_impl_win.cc \
src/cef/windows/cefclient/browser/main_message_loop.cc \
src/cef/windows/cefclient/browser/main_message_loop_multithreaded_win.cc \
src/cef/windows/cefclient/browser/main_message_loop_std.cc \
src/cef/windows/cefclient/browser/osr_dragdrop_win.cc \
src/cef/windows/cefclient/browser/osr_renderer.cc \
src/cef/windows/cefclient/browser/osr_window_win.cc \
src/cef/windows/cefclient/browser/resource_util_win.cc \
src/cef/windows/cefclient/browser/root_window.cc \
src/cef/windows/cefclient/browser/root_window_manager.cc \
src/cef/windows/cefclient/browser/root_window_win.cc \
src/cef/windows/cefclient/browser/scheme_test.cc \
src/cef/windows/cefclient/browser/temp_window_win.cc \
src/cef/windows/cefclient/browser/test_runner.cc \
src/cef/windows/cefclient/browser/urlrequest_test.cc \
src/cef/windows/cefclient/browser/util_win.cc \
src/cef/windows/cefclient/browser/window_test.cc \
src/cef/windows/cefclient/browser/window_test_win.cc \
src/cef/windows/cefclient/common/client_app.cc \
src/cef/windows/cefclient/common/client_app_delegates_common.cc \
src/cef/windows/cefclient/common/client_app_other.cc \
src/cef/windows/cefclient/common/client_switches.cc \
src/cef/windows/cefclient/common/scheme_test_common.cc \
src/cef/windows/cefclient/renderer/client_app_delegates_renderer.cc \
src/cef/windows/cefclient/renderer/client_app_renderer.cc \
src/cef/windows/cefclient/renderer/client_renderer.cc \
src/cef/windows/cefclient/renderer/performance_test.cc \
src/cef/windows/cefclient/renderer/performance_test_tests.cc
CONFIG(debug, debug|release) {
LIBS += -L../../../../Qt_build/graphics/Debug/debug -lgraphics
LIBS += -L../../../../hunspell-1.3.3/src/qt/Debug/debug -lhunspell
} else {
LIBS += -L../../../../Qt_build/graphics/Release/release -lgraphics
LIBS += -L../../../../hunspell-1.3.3/src/qt/Release/release -lhunspell
}
win32:contains(QMAKE_TARGET.arch, x86_64):{
CONFIG(debug, debug|release) {
LIBS += -L../../../app/cefbuilds/win64 -llibcef
LIBS += -L../../../../../ASCOfficeUtils/ASCOfficeUtilsLib/Win/x64/Debug -lASCOfficeUtilsLib
message(debug)
} else {
LIBS += -L../../../app/cefbuilds/win64 -llibcef
LIBS += -L../../../../../ASCOfficeUtils/ASCOfficeUtilsLib/Win/x64/Release -lASCOfficeUtilsLib
message(release)
}
message(windows64)
}
win32:!contains(QMAKE_TARGET.arch, x86_64):{
}
INCLUDEPATH += \
../../agg-2.4/include \
../../freetype-2.5.2/include
HEADERS += \
./src/cookiesworker.h \
./src/cefwrapper/client_app.h \
./src/cefwrapper/client_renderer.h \
./src/cefwrapper/client_scheme.h
SOURCES += \
./src/cefwrapper/client_scheme_wrapper.cpp \
./src/cefwrapper/client_renderer_wrapper.cpp
HEADERS += \
./include/base.h \
./include/applicationmanager.h \
./include/keyboardchecker.h \
./include/spellchecker.h \
./include/cefapplication.h \
./include/cefview.h \
./include/applicationmanager_events.h
SOURCES += \
./src/applicationmanager.cpp \
./src/keyboardchecker.cpp \
./src/spellchecker.cpp \
./src/cefapplication.cpp \
./src/cefview.cpp

View File

@ -0,0 +1,163 @@
#ifndef APPLICATION_MANAGER_H
#define APPLICATION_MANAGER_H
#include <string>
#include <vector>
#include "../../../common/File.h"
#include "./applicationmanager_events.h"
#include "./keyboardchecker.h"
#include "./spellchecker.h"
#include "./cefview.h"
#include "./cefapplication.h"
namespace NSCommon
{
static void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo)
{
size_t posn = 0;
while (std::wstring::npos != (posn = text.find(replaceFrom, posn)))
{
text.replace(posn, replaceFrom.length(), replaceTo);
posn += replaceTo.length();
}
}
}
class CAscApplicationSettings
{
public:
std::wstring spell_dictionaries_path;
std::wstring cache_path;
std::wstring cookie_path;
bool use_system_fonts;
std::vector<std::wstring> additional_fonts_folder;
std::wstring fonts_cache_info_path;
std::wstring app_data_path;
public:
CAscApplicationSettings()
{
std::wstring sApplicationPath = NSFile::GetProcessDirectory();
NSCommon::string_replace(sApplicationPath, L"\\", L"/");
app_data_path = sApplicationPath;
spell_dictionaries_path = sApplicationPath + L"/Dictionaries";
cache_path = sApplicationPath + L"/data/cache";
cookie_path = sApplicationPath + L"/data";
use_system_fonts = true;
fonts_cache_info_path = app_data_path + L"/webdata/cloud/fonts";
}
void SetUserDataPath(std::wstring sPath)
{
app_data_path = sPath;
NSCommon::string_replace(app_data_path, L"\\", L"/");
cache_path = app_data_path + L"/data/cache";
cookie_path = app_data_path + L"/data";
use_system_fonts = true;
fonts_cache_info_path = app_data_path + L"/webdata/cloud/fonts";
}
};
class CAscPrintSettings
{
public:
enum PrintMode
{
pmFit = 0, // вписывать по аспекту
pmStretch = 1, // растягивать
pm100 = 2 // печатать как есть
};
public:
PrintMode Mode;
int WidthPix;
int HeightPix;
bool ZoomEnable;
bool RotateEnable;
bool PrintableArea;
public:
CAscPrintSettings()
{
Mode = pm100;
WidthPix = -1;
HeightPix = -1;
ZoomEnable = false;
RotateEnable = true;
PrintableArea = false;
}
};
class CAscApplicationManager_Private;
class CApplicationFonts;
class Q_DECL_EXPORT CAscApplicationManager
{
public:
CAscApplicationManager();
~CAscApplicationManager();
public:
CAscApplicationSettings m_oSettings;
CAscPrintSettings m_oPrintSettings;
public:
void StartSpellChecker();
void StopSpellChecker();
void SpellCheck(const int& nEditorId, const std::string& sTask, int nId);
void CheckKeyboard();
void SendKeyboardAttack();
void CheckFonts(bool bAsync = true);
void SetEventListener(NSEditorApi::CAscMenuEventListener* );
NSEditorApi::CAscMenuEventListener* GetEventListener();
void Apply(NSEditorApi::CAscMenuEvent* );
NSEditorApi::CAscMenuEvent* ApplySync(NSEditorApi::CAscMenuEvent* );
CCefView* CreateCefView(CCefViewWidgetImpl* parent);
CCefViewEditor* CreateCefEditor(CCefViewWidgetImpl* parent);
CCefView* GetViewById(int nId);
CCefView* GetViewByUrl(const std::wstring& url);
void Logout(std::wstring strUrl);
void CancelDownload(int nId);
void DestroyCefView(int nId);
void LockCS(int nId);
void UnlockCS(int nId);
bool IsInitFonts();
CApplicationCEF* GetApplication();
void SetApplication(CApplicationCEF* );
void SetDebugInfoSupport(bool bIsSupport);
bool GetDebugInfoSupport();
void CloseApplication();
CApplicationFonts* GetApplicationFonts();
virtual void StartSaveDialog(const std::wstring& sName);
virtual void EndSaveDialog(const std::wstring& sPath);
virtual int GetPlatformKeyboardLayout();
protected:
CAscApplicationManager_Private* m_pInternal;
};
#endif // APPLICATION_MANAGER_H

View File

@ -0,0 +1,415 @@
#ifndef APPLICATION_MANAGER_EVENTS_H
#define APPLICATION_MANAGER_EVENTS_H
#include "../../../Word_Api/Editor_Api.h"
#include "base.h"
#define ASC_MENU_EVENT_TYPE_CEF_CREATETAB 1001
#define ASC_MENU_EVENT_TYPE_CEF_TABEDITORTYPE 1002
#define ASC_MENU_EVENT_TYPE_CEF_SPELLCHECK 1003
#define ASC_MENU_EVENT_TYPE_CEF_KEYBOARDLAYOUT 1004
#define ASC_MENU_EVENT_TYPE_CEF_CONTROL_ID 1005
#define ASC_MENU_EVENT_TYPE_CEF_SYNC_COMMAND 1006
#define ASC_MENU_EVENT_TYPE_CEF_CLOSE 1007
#define ASC_MENU_EVENT_TYPE_CEF_DESTROY 1008
#define ASC_MENU_EVENT_TYPE_CEF_DOWNLOAD 1009
#define ASC_MENU_EVENT_TYPE_CEF_DOWNLOAD_START 1010
#define ASC_MENU_EVENT_TYPE_CEF_DOWNLOAD_END 1011
#define ASC_MENU_EVENT_TYPE_CEF_MODIFY_CHANGED 1012
#define ASC_MENU_EVENT_TYPE_CEF_DOCUMENT_NAME 1013
#define ASC_MENU_EVENT_TYPE_CEF_ONLOGOUT 1014
#define ASC_MENU_EVENT_TYPE_CEF_ONOPENLINK 1015
#define ASC_MENU_EVENT_TYPE_CEF_ONCLOSE 2001
#define ASC_MENU_EVENT_TYPE_CEF_ONBEFORECLOSE 2002
#define ASC_MENU_EVENT_TYPE_CEF_SAVE 3001
#define ASC_MENU_EVENT_TYPE_CEF_ONSAVE 3002
#define ASC_MENU_EVENT_TYPE_CEF_ONKEYBOARDDOWN 3100
#define ASC_MENU_EVENT_TYPE_CEF_ONFULLSCREENENTER 3101
#define ASC_MENU_EVENT_TYPE_CEF_ONFULLSCREENLEAVE 3102
#define ASC_MENU_EVENT_TYPE_CEF_JS_MESSAGE 4001
#define ASC_MENU_EVENT_TYPE_CEF_ONBEFORE_PRINT_START 5001
#define ASC_MENU_EVENT_TYPE_CEF_ONBEFORE_PRINT_PROGRESS 5002
#define ASC_MENU_EVENT_TYPE_CEF_ONBEFORE_PRINT_END 5003
#define ASC_MENU_EVENT_TYPE_CEF_PRINT_START 5011
#define ASC_MENU_EVENT_TYPE_CEF_PRINT_PAGE 5012
#define ASC_MENU_EVENT_TYPE_CEF_PRINT_END 5013
#define ASC_MENU_EVENT_TYPE_CEF_SCRIPT_EDITOR_VERSION 6001
#define ASC_MENU_EVENT_TYPE_CEF_SAVEFILEDIALOG 7001
#define ASC_MENU_EVENT_TYPE_WINDOWS_MESSAGE_USER_COUNT 10
namespace NSEditorApi
{
class CAscCreateTab : public IMenuEventDataBase
{
private:
std::wstring m_sUrl;
bool m_bActive;
int m_nIdEqual;
public:
CAscCreateTab()
{
m_bActive = true;
m_nIdEqual = -1;
}
virtual ~CAscCreateTab()
{
}
LINK_PROPERTY_STRING(Url)
LINK_PROPERTY_BOOL(Active)
LINK_PROPERTY_INT(IdEqual)
};
class CAscDownloadFileInfo : public IMenuEventDataBase
{
private:
std::wstring m_sUrl;
std::wstring m_sFilePath;
int m_nId;
double m_dSpeed; // Kb/sec
int m_nPercent;
bool m_bIsComplete;
bool m_bIsCanceled;
public:
CAscDownloadFileInfo()
{
m_nId = -1;
m_dSpeed = 0;
m_nPercent = 0;
m_bIsComplete = false;
m_bIsCanceled = false;
}
virtual ~CAscDownloadFileInfo()
{
}
LINK_PROPERTY_STRING(Url)
LINK_PROPERTY_STRING(FilePath)
LINK_PROPERTY_INT(Percent)
LINK_PROPERTY_BOOL(IsComplete)
LINK_PROPERTY_BOOL(IsCanceled)
LINK_PROPERTY_INT(Id)
LINK_PROPERTY_DOUBLE(Speed)
};
class CAscOnOpenExternalLink : public IMenuEventDataBase
{
private:
std::wstring m_sUrl;
int m_nId;
public:
CAscOnOpenExternalLink()
{
m_nId = -1;
}
virtual ~CAscOnOpenExternalLink()
{
}
LINK_PROPERTY_STRING(Url)
LINK_PROPERTY_INT(Id)
};
class CAscTabEditorType : public IMenuEventDataBase
{
private:
int m_nId;
int m_nType;
public:
CAscTabEditorType()
{
}
virtual ~CAscTabEditorType()
{
}
LINK_PROPERTY_INT(Id)
LINK_PROPERTY_INT(Type)
};
class CAscSpellCheckType : public IMenuEventDataBase
{
private:
std::string m_sResult;
int m_nEditorId;
int m_nFrameId;
public:
CAscSpellCheckType()
{
m_nEditorId = 0;
m_nFrameId = 0;
}
virtual ~CAscSpellCheckType()
{
}
LINK_PROPERTY_STRINGA(Result)
LINK_PROPERTY_INT(EditorId)
LINK_PROPERTY_INT(FrameId)
};
class CAscKeyboardLayout : public IMenuEventDataBase
{
private:
int m_nLanguage;
public:
CAscKeyboardLayout()
{
}
virtual ~CAscKeyboardLayout()
{
}
LINK_PROPERTY_INT(Language)
};
class CAscTypeId : public IMenuEventDataBase
{
private:
int m_nId;
public:
CAscTypeId()
{
}
virtual ~CAscTypeId()
{
}
LINK_PROPERTY_INT(Id)
};
class CAscDocumentModifyChanged : public IMenuEventDataBase
{
private:
int m_nId;
bool m_bChanged;
public:
CAscDocumentModifyChanged()
{
}
virtual ~CAscDocumentModifyChanged()
{
}
LINK_PROPERTY_INT(Id)
LINK_PROPERTY_BOOL(Changed)
};
class CAscDocumentName : public IMenuEventDataBase
{
private:
std::wstring m_sName;
int m_nId;
public:
CAscDocumentName()
{
}
virtual ~CAscDocumentName()
{
}
LINK_PROPERTY_STRING(Name)
LINK_PROPERTY_INT(Id)
};
class CAscJSMessage : public IMenuEventDataBase
{
private:
std::wstring m_sName;
std::wstring m_sValue;
int m_nId;
public:
CAscJSMessage()
{
}
virtual ~CAscJSMessage()
{
}
LINK_PROPERTY_STRING(Name)
LINK_PROPERTY_STRING(Value)
LINK_PROPERTY_INT(Id)
};
class CAscPrintProgress : public IMenuEventDataBase
{
private:
int m_nId;
int m_nProgress;
public:
CAscPrintProgress()
{
}
virtual ~CAscPrintProgress()
{
}
LINK_PROPERTY_INT(Id)
LINK_PROPERTY_INT(Progress)
};
class CAscPrintEnd : public IMenuEventDataBase
{
private:
int m_nId;
int m_nPagesCount;
int m_nCurrentPage;
public:
CAscPrintEnd()
{
}
virtual ~CAscPrintEnd()
{
}
LINK_PROPERTY_INT(Id)
LINK_PROPERTY_INT(PagesCount)
LINK_PROPERTY_INT(CurrentPage)
};
class CAscPrinterContextBase : public IMenuEventDataBase
{
public:
CAscPrinterContextBase() : IMenuEventDataBase() {}
virtual ~CAscPrinterContextBase() {}
virtual void GetLogicalDPI(int& nDpiX, int& nDpiY) = 0;
virtual void GetPhysicalRect(int& nX, int& nY, int& nW, int& nH) = 0;
virtual void GetPrintAreaSize(int& nW, int& nH) = 0;
virtual void BitBlt(BYTE* pBGRA, const int& nRasterX, const int& nRasterY, const int& nRasterW, const int& nRasterH,
const double& x, const double& y, const double& w, const double& h, const double& dAngle) = 0;
};
class CAscPrintPage : public IMenuEventDataBase
{
private:
CAscPrinterContextBase* m_pContext;
int m_nPage;
public:
CAscPrintPage()
{
m_pContext = NULL;
m_nPage = 0;
}
virtual ~CAscPrintPage()
{
if (NULL != m_pContext)
m_pContext->Release();
}
LINK_PROPERTY_INT(Page)
inline CAscPrinterContextBase* get_Context()
{
return m_pContext;
}
inline void put_Context(CAscPrinterContextBase* pContext)
{
m_pContext = pContext;
}
};
class CAscEditorScript : public IMenuEventDataBase
{
private:
std::wstring m_sUrl;
std::wstring m_sDestination;
int m_nId;
int m_nFrameId;
public:
CAscEditorScript()
{
m_nId = -1;
m_nFrameId = -1;
}
virtual ~CAscEditorScript()
{
}
LINK_PROPERTY_INT(Id)
LINK_PROPERTY_STRING(Url)
LINK_PROPERTY_STRING(Destination)
LINK_PROPERTY_INT(FrameId)
};
}
namespace NSEditorApi
{
class CAscSaveDialog : public IMenuEventDataBase
{
private:
std::wstring m_sFilePath;
int m_nId;
public:
CAscSaveDialog()
{
m_nId = -1;
}
virtual ~CAscSaveDialog()
{
}
LINK_PROPERTY_STRING(FilePath)
LINK_PROPERTY_INT(Id)
};
}
namespace NSEditorApi
{
class CAscKeyboardDown : public IMenuEventDataBase
{
private:
int m_nKeyCode;
bool m_bIsCtrl;
bool m_bIsShift;
bool m_bIsAlt;
public:
CAscKeyboardDown()
{
m_nKeyCode = -1;
m_bIsCtrl = false;
m_bIsShift = false;
m_bIsAlt = false;
}
virtual ~CAscKeyboardDown()
{
}
LINK_PROPERTY_INT(KeyCode)
LINK_PROPERTY_BOOL(IsCtrl)
LINK_PROPERTY_BOOL(IsShift)
LINK_PROPERTY_BOOL(IsAlt)
};
}
#endif // APPLICATION_MANAGER_EVENTS_H

View File

@ -0,0 +1,18 @@
#ifndef APPLICATION_BASE_H
#define APPLICATION_BASE_H
#ifdef WIN32
#ifndef Q_DECL_EXPORT
#define Q_DECL_EXPORT __declspec(dllexport)
#include "windows.h"
#endif
#define WindowHandleId HWND
#include <wchar.h>
#endif
#endif // APPLICATION_BASE_H

View File

@ -0,0 +1,22 @@
#ifndef APPLICATION_CEF_H
#define APPLICATION_CEF_H
#include "base.h"
class CApplicationCEF_Private;
class CAscApplicationManager;
class Q_DECL_EXPORT CApplicationCEF
{
protected:
CApplicationCEF_Private* m_pInternal;
public:
CApplicationCEF();
void Init_CEF(CAscApplicationManager* );
virtual ~CApplicationCEF();
void Close();
};
#endif // APPLICATION_CEF_H

View File

@ -0,0 +1,97 @@
#ifndef CEFCLIENT_CEFWEBVIEW_H
#define CEFCLIENT_CEFWEBVIEW_H
#include "base.h"
#include "./applicationmanager_events.h"
enum CefViewWrapperType
{
cvwtSimple = 0,
cvwtEditor = 1
};
enum AscEditorType
{
etDocument = 0,
etPresentation = 1,
etSpreadsheet = 2,
etUndefined = 255
};
class CCefView_Private;
class CAscApplicationManager;
class CCefViewWidgetImpl
{
public:
virtual bool parent_window_is_empty() { return false; }
virtual int parent_x() { return 0; }
virtual int parent_y() { return 0; }
virtual int parent_width() { return 0; }
virtual int parent_height() { return 0; }
virtual WindowHandleId parent_wid() { return 0; }
virtual void child_loaded() { }
};
class Q_DECL_EXPORT CCefView
{
public:
CCefView(CCefViewWidgetImpl* parent, int nId);
virtual ~CCefView();
void load(const std::wstring& url);
std::wstring GetUrl();
void focus(bool value = true);
void resizeEvent(int width = 0, int height = 0);
bool nativeEvent(const char* data, const int& datalen, void *message, long *result);
void Apply(NSEditorApi::CAscMenuEvent* );
NSEditorApi::CAscMenuEvent* ApplySync(NSEditorApi::CAscMenuEvent* );
#if 0
virtual void dragEnterEvent(QDragEnterEvent *);
virtual void dragMoveEvent(QDragMoveEvent *);
virtual void dragLeaveEvent(QDragLeaveEvent *);
virtual void dropEvent(QDropEvent *);
#endif
CAscApplicationManager* GetAppManager();
void SetAppManager(CAscApplicationManager* );
CCefViewWidgetImpl* GetWidgetImpl();
int GetId();
CefViewWrapperType GetType();
void SetParentCef(int nId);
int GetParentCef();
void SetModified(bool bIsModified);
bool GetModified();
protected:
int m_nId;
CefViewWrapperType m_eWrapperType;
CCefView_Private* m_pInternal;
friend class CAscClientHandler;
friend class CAscApplicationManager;
};
class Q_DECL_EXPORT CCefViewEditor : public CCefView
{
protected:
AscEditorType m_eType;
public:
CCefViewEditor(CCefViewWidgetImpl* parent, int nId);
virtual ~CCefViewEditor();
void SetEditorType(AscEditorType eType);
AscEditorType GetEditorType();
};
#endif // CEFCLIENT_CEFWEBVIEW_H

View File

@ -0,0 +1,21 @@
#ifndef APPLICATION_KEYBOARD_CHECKER_H
#define APPLICATION_KEYBOARD_CHECKER_H
#include "base.h"
class CAscApplicationManager;
class Q_DECL_EXPORT CAscKeyboardChecker
{
public:
CAscKeyboardChecker();
~CAscKeyboardChecker();
public:
void Check(CAscApplicationManager* pManager, int nLangInput = -1);
void Send(CAscApplicationManager* pManager);
protected:
int m_nLanguage;
};
#endif // APPLICATION_KEYBOARD_CHECKER_H

View File

@ -0,0 +1,181 @@
#ifndef QASCPRINTER_H
#define QASCPRINTER_H
#include <QtPrintSupport/QPrinter>
#include <QtPrintSupport/QPrintDialog>
#include <QPainter>
#include <QPaintEngine>
#include "./applicationmanager_events.h"
#include <qmath.h>
class QAscPrinterContext : public NSEditorApi::CAscPrinterContextBase
{
private:
QPrinter m_oPrinter;
QPainter m_oPainter;
bool m_bIsUsePainter;
public:
QAscPrinterContext() : NSEditorApi::CAscPrinterContextBase(), m_oPrinter(QPrinter::HighResolution)
{
m_bIsUsePainter = false;
}
QAscPrinterContext(const QPrinterInfo& pi) : NSEditorApi::CAscPrinterContextBase(),
m_oPrinter(pi, QPrinter::HighResolution), m_bIsUsePainter(false)
{
}
void BeginPaint()
{
m_bIsUsePainter = true;
//m_oPrinter.setFullPage(true);
m_oPainter.begin(&m_oPrinter);
}
void EndPaint()
{
if (m_bIsUsePainter)
m_oPainter.end();
m_bIsUsePainter = false;
}
QPrinter* getPrinter()
{
return &m_oPrinter;
}
virtual ~QAscPrinterContext()
{
}
virtual void GetLogicalDPI(int& nDpiX, int& nDpiY)
{
nDpiX = m_oPrinter.logicalDpiX();
nDpiY = m_oPrinter.logicalDpiY();
}
virtual void GetPhysicalRect(int& nX, int& nY, int& nW, int& nH)
{
QRect rect1 = m_oPrinter.pageRect();
QRect rect2 = m_oPrinter.paperRect();
nX = rect1.x();
nY = rect1.y();
nW = rect2.width();
nH = rect2.height();
}
virtual void GetPrintAreaSize(int& nW, int& nH)
{
QRect rect = m_oPrinter.pageRect();
nW = rect.width();
nH = rect.height();
}
virtual void BitBlt(BYTE* pBGRA, const int& nRasterX, const int& nRasterY, const int& nRasterW, const int& nRasterH,
const double& x, const double& y, const double& w, const double& h, const double& dAngle)
{
int nPhysicalX = 0;
int nPhysicalY = 0;
int nPhysicalW = 0;
int nPhysicalH = 0;
this->GetPhysicalRect(nPhysicalX, nPhysicalY, nPhysicalW, nPhysicalH);
//m_oPrinter.setFullPage(true);
// TODO: must be faster!!! (create CBgraFrame as QPixmap???)
//QPainter painter(&m_oPrinter);
QPainter* painter = NULL;
if (m_bIsUsePainter)
painter = &m_oPainter;
else
{
painter = new QPainter();
painter->begin(&m_oPrinter);
}
painter->save();
bool bIsPrintToFile = (m_oPrinter.outputFileName().length() != 0);
bool bIsClip = painter->hasClipping();
painter->setClipping(false);
//QImage oImage(pBGRA + 4 * ((nRasterH - 1) * nRasterW), nRasterW, nRasterH, -4 * nRasterW, QImage::Format_ARGB32);
QImage oImage(pBGRA, nRasterW, nRasterH, 4 * nRasterW, QImage::Format_ARGB32);
double dAngleDeg = dAngle * 180.0 / M_PI;
if ((std::abs(dAngleDeg - 90) < 1.0) || (std::abs(dAngleDeg - 270) < 1.0))
{
//painter->translate(-nPhysicalX, -nPhysicalY);
float fCenterX = (float)(x + w / 2.0);
float fCenterY = (float)(y + h / 2.0);
painter->translate(fCenterX, fCenterY);
painter->rotate(90);
painter->translate(-fCenterX, -fCenterY);
int nWDst = nRasterW;
int nHDst = nRasterH;
int nAreaW = 0;
int nAreaH = 0;
this->GetPrintAreaSize(nAreaW, nAreaH);
int nOldX = nPhysicalX;
nPhysicalX = nPhysicalY;
nPhysicalY = nPhysicalW - nAreaW - nOldX;
if (bIsPrintToFile)
{
// обнуляем сдвиги, напечатается и в отрицательных местах
nPhysicalX = 0;
nPhysicalY = 0;
}
nWDst -= nPhysicalX;
nHDst -= nPhysicalY;
QRect rect((int)x + nPhysicalX, (int)y + nPhysicalY, nWDst, nHDst);
QRect rectSrc(nPhysicalX, nPhysicalY, nWDst, nHDst);
//QRectF rectF((float)x + nPhysicalX, (float)y, (float)w, (float)h);
//painter->drawImage(rectF, oImage);
painter->drawImage(rect, oImage, rectSrc);
}
else
{
int nWDst = nRasterW;
int nHDst = nRasterH;
if (bIsPrintToFile)
{
// обнуляем сдвиги, напечатается и в отрицательных местах
nPhysicalX = 0;
nPhysicalY = 0;
}
nWDst -= nPhysicalX;
nHDst -= nPhysicalY;
QRect rect((int)x + nPhysicalX, (int)y + nPhysicalY, nWDst, nHDst);
QRect rectSrc(nPhysicalX, nPhysicalY, nWDst, nHDst);
painter->drawImage(rect, oImage, rectSrc);
}
painter->restore();
if (!m_bIsUsePainter)
{
painter->end();
delete painter;
}
//m_oPrinter.setFullPage(false);
}
};
#endif // QASCPRINTER_H

View File

@ -0,0 +1,28 @@
#ifndef APPLICATION_SPELL_CHECKER_H
#define APPLICATION_SPELL_CHECKER_H
#include <string>
#include "base.h"
class CAscApplicationManager;
class CAscSpellChecker_Private;
class Q_DECL_EXPORT CAscSpellChecker
{
protected:
CAscSpellChecker_Private* m_pInternal;
public:
CAscSpellChecker();
~CAscSpellChecker();
public:
void SetApplicationManager(CAscApplicationManager* );
void AddTask(const int& nEditorId, const std::string& sTask, int nId); // utf8
void Init(std::wstring sDirectory);
void Start();
void End();
};
#endif // APPLICATION_SPELL_CHECKER_H

View File

@ -0,0 +1,132 @@
#include "./qcefview.h"
#include <QPainter>
QCefView::QCefView(QWidget* parent) : QWidget(parent)
{
m_pCefView = NULL;
m_pLoader = new QWidget(this);
m_pLoader->setGeometry(0, 0, width(), height());
SetBackgroundCefColor(255, 255, 255);
m_pLoader->setHidden(false);
QObject::connect(this, SIGNAL( _loaded() ) , this, SLOT( _loadedSlot() ), Qt::QueuedConnection );
}
QCefView::~QCefView()
{
// release from CApplicationManager
}
void QCefView::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void QCefView::SetBackgroundCefColor(unsigned char r, unsigned char g, unsigned char b)
{
QString sColor = QString::number((int)r, 16) + QString::number((int)g, 16) + QString::number((int)b, 16);
QString sStyle = "background-color:#" + sColor + ";";
this->setStyleSheet(sStyle);
m_pLoader->setStyleSheet(sStyle);
}
void QCefView::focusInEvent(QFocusEvent* e)
{
if (NULL != m_pCefView)
m_pCefView->focus();
}
void QCefView::resizeEvent(QResizeEvent* e)
{
if (NULL != e)
QWidget::resizeEvent(e);
m_pLoader->setGeometry(0, 0, width(), height());
if (NULL != m_pCefView)
m_pCefView->resizeEvent();
}
bool QCefView::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
if (m_pCefView)
{
if (m_pCefView->nativeEvent(NULL, 0, message, result))
return true;
}
return QWidget::nativeEvent(eventType, message, result);
}
#if 0
void QCefView::dragEnterEvent(QDragEnterEvent *e)
{
m_pCefView->dragEnterEvent(e);
}
void QCefView::dragMoveEvent(QDragMoveEvent *e)
{
m_pCefView->dragMoveEvent(e);
}
void QCefView::dragLeaveEvent(QDragLeaveEvent *e)
{
m_pCefView->dragLeaveEvent(e);
}
void QCefView::dropEvent(QDropEvent *e)
{
m_pCefView->dropEvent(e);
}
#endif
CCefView* QCefView::GetCefView()
{
return m_pCefView;
}
void QCefView::Create(CAscApplicationManager* pManager, CefViewWrapperType eType)
{
switch (eType)
{
case cvwtSimple:
{
m_pCefView = pManager->CreateCefView(this);
break;
}
case cvwtEditor:
{
m_pCefView = pManager->CreateCefEditor(this);
break;
}
default:
break;
}
}
// CCefViewWidgetImpl
int QCefView::parent_x() { return this->pos().x(); }
int QCefView::parent_y() { return this->pos().y(); }
int QCefView::parent_width() { return this->width(); }
int QCefView::parent_height() { return this->height(); }
WindowHandleId QCefView::parent_wid()
{
#if 1
return (WindowHandleId)this->winId();
#else
return (WindowHandleId)m_pLoader->winId();
#endif
}
bool QCefView::parent_window_is_empty() { return true; }
void QCefView::child_loaded()
{
emit _loaded();
}
void QCefView::_loadedSlot()
{
if (!m_pLoader->isHidden())
m_pLoader->setHidden(true);
}

View File

@ -0,0 +1,59 @@
#ifndef CEFCLIENT_QCEFWEBVIEW_H
#define CEFCLIENT_QCEFWEBVIEW_H
#include "./../include/cefview.h"
#include "./../include/applicationmanager.h"
#include <QWidget>
#include <QStyleOption>
class QCefView : public QWidget, public CCefViewWidgetImpl
{
Q_OBJECT
signals:
void _loaded();
public:
QCefView(QWidget* parent);
virtual ~QCefView();
virtual void paintEvent(QPaintEvent *);
void SetBackgroundCefColor(unsigned char r, unsigned char g, unsigned char b);
virtual void focusInEvent(QFocusEvent* e);
virtual void resizeEvent(QResizeEvent* e);
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result);
#if 0
virtual void dragEnterEvent(QDragEnterEvent *e);
virtual void dragMoveEvent(QDragMoveEvent *e);
virtual void dragLeaveEvent(QDragLeaveEvent *e);
virtual void dropEvent(QDropEvent *e);
#endif
CCefView* GetCefView();
void Create(CAscApplicationManager* pManager, CefViewWrapperType eType);
protected:
CCefView* m_pCefView;
QWidget* m_pLoader;
public:
// CCefViewWidgetImpl
virtual int parent_x();
virtual int parent_y();
virtual int parent_width();
virtual int parent_height();
virtual WindowHandleId parent_wid();
virtual bool parent_window_is_empty();
virtual void child_loaded();
protected slots:
void _loadedSlot();
};
#endif // CEFCLIENT_QCEFWEBVIEW_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,419 @@
# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
#
# Source files.
#
# cefclient browser sources.
set(CEFCLIENT_BROWSER_BROWSER_SRCS
browser/binding_test.cc
browser/binding_test.h
browser/browser_window.cc
browser/browser_window.h
browser/bytes_write_handler.cc
browser/bytes_write_handler.h
browser/client_app_browser.cc
browser/client_app_browser.h
browser/client_app_delegates_browser.cc
browser/client_handler.cc
browser/client_handler.h
browser/client_handler_osr.cc
browser/client_handler_osr.h
browser/client_handler_std.cc
browser/client_handler_std.h
browser/client_types.h
browser/dialog_test.cc
browser/dialog_test.h
browser/main_context.cc
browser/main_context.h
browser/main_context_impl.cc
browser/main_context_impl.h
browser/main_message_loop.cc
browser/main_message_loop.h
browser/main_message_loop_std.cc
browser/main_message_loop_std.h
browser/osr_dragdrop_events.h
browser/osr_renderer.cc
browser/osr_renderer.h
browser/resource.h
browser/resource_util.h
browser/root_window.cc
browser/root_window.h
browser/root_window_manager.cc
browser/root_window_manager.h
browser/scheme_test.cc
browser/scheme_test.h
browser/temp_window.h
browser/test_runner.cc
browser/test_runner.h
browser/urlrequest_test.cc
browser/urlrequest_test.h
browser/window_test.cc
browser/window_test.h
)
source_group(cefclient\\\\browser FILES ${CEFCLIENT_BROWSER_BROWSER_SRCS})
set(CEFCLIENT_BROWSER_SRCS
${CEFCLIENT_BROWSER_BROWSER_SRCS}
)
# cefclient common sources.
set(CEFCLIENT_COMMON_COMMON_SRCS
common/client_app.cc
common/client_app.h
common/client_app_delegates_common.cc
common/client_app_other.cc
common/client_app_other.h
common/client_switches.cc
common/client_switches.h
common/scheme_test_common.cc
common/scheme_test_common.h
)
source_group(cefclient\\\\common FILES ${CEFCLIENT_COMMON_COMMON_SRCS})
set(CEFCLIENT_COMMON_SRCS
${CEFCLIENT_COMMON_COMMON_SRCS}
)
# cefclient renderer sources.
set(CEFCLIENT_RENDERER_RENDERER_SRCS
renderer/client_app_delegates_renderer.cc
renderer/client_app_renderer.cc
renderer/client_app_renderer.h
renderer/client_renderer.cc
renderer/client_renderer.h
renderer/performance_test.cc
renderer/performance_test.h
renderer/performance_test_setup.h
renderer/performance_test_tests.cc
)
source_group(cefclient\\\\renderer FILES ${CEFCLIENT_RENDERER_RENDERER_SRCS})
set(CEFCLIENT_RENDERER_SRCS
${CEFCLIENT_RENDERER_RENDERER_SRCS}
)
#cefclient Linux sources
set(CEFCLIENT_LINUX_SRCS
cefclient_gtk.cc
)
source_group(cefclient FILES ${CEFCLIENT_LINUX_SRCS})
set(CEFCLIENT_LINUX_BROWSER_SRCS
browser/browser_window_osr_gtk.cc
browser/browser_window_osr_gtk.h
browser/browser_window_std_gtk.cc
browser/browser_window_std_gtk.h
browser/dialog_handler_gtk.cc
browser/dialog_handler_gtk.h
browser/main_context_impl_posix.cc
browser/print_handler_gtk.cc
browser/print_handler_gtk.h
browser/resource_util_linux.cc
browser/resource_util_posix.cc
browser/root_window_gtk.cc
browser/root_window_gtk.h
browser/temp_window_x11.cc
browser/temp_window_x11.h
browser/window_test_gtk.cc
)
source_group(cefclient\\\\browser FILES ${CEFCLIENT_LINUX_BROWSER_SRCS})
set(CEFCLIENT_LINUX_SRCS
${CEFCLIENT_LINUX_SRCS}
${CEFCLIENT_LINUX_BROWSER_SRCS}
)
#cefclient Mac OS X sources
set(CEFCLIENT_MACOSX_SRCS
cefclient_mac.mm
)
source_group(cefclient FILES ${CEFCLIENT_MACOSX_SRCS})
set(CEFCLIENT_MACOSX_BROWSER_SRCS
browser/browser_window_osr_mac.h
browser/browser_window_osr_mac.mm
browser/browser_window_std_mac.h
browser/browser_window_std_mac.mm
browser/main_context_impl_posix.cc
browser/resource_util_mac.mm
browser/resource_util_posix.cc
browser/root_window_mac.h
browser/root_window_mac.mm
browser/temp_window_mac.h
browser/temp_window_mac.mm
browser/window_test_mac.mm
)
source_group(cefclient\\\\browser FILES ${CEFCLIENT_MACOSX_BROWSER_SRCS})
set(CEFCLIENT_MACOSX_SRCS
${CEFCLIENT_MACOSX_SRCS}
${CEFCLIENT_MACOSX_BROWSER_SRCS}
)
# cefclient Mac OS X helper sources.
set(CEFCLIENT_HELPER_SRCS
process_helper_mac.cc
)
source_group(cefclient FILES ${CEFCLIENT_HELPER_SRCS})
set(CEFCLIENT_MACOSX_HELPER_SRCS
${CEFCLIENT_HELPER_SRCS}
)
#cefclient Windows sources
set(CEFCLIENT_WINDOWS_SRCS
cefclient_win.cc
)
source_group(cefclient FILES ${CEFCLIENT_WINDOWS_SRCS})
set(CEFCLIENT_WINDOWS_BROWSER_SRCS
browser/browser_window_osr_win.cc
browser/browser_window_osr_win.h
browser/browser_window_std_win.cc
browser/browser_window_std_win.h
browser/main_context_impl_win.cc
browser/main_message_loop_multithreaded_win.cc
browser/main_message_loop_multithreaded_win.h
browser/osr_dragdrop_win.cc
browser/osr_dragdrop_win.h
browser/osr_window_win.cc
browser/osr_window_win.h
browser/resource_util_win.cc
browser/root_window_win.cc
browser/root_window_win.h
browser/temp_window_win.cc
browser/temp_window_win.h
browser/util_win.cc
browser/util_win.h
browser/window_test_win.cc
)
source_group(cefclient\\\\browser FILES ${CEFCLIENT_WINDOWS_BROWSER_SRCS})
set(CEFCLIENT_WINDOWS_RESOURCES_WIN_SRCS
resources/win/cefclient.exe.manifest
resources/win/cefclient.ico
resources/win/cefclient.rc
resources/win/small.ico
)
source_group(cefclient\\\\resources\\\\win FILES ${CEFCLIENT_WINDOWS_RESOURCES_WIN_SRCS})
set(CEFCLIENT_WINDOWS_SRCS
${CEFCLIENT_WINDOWS_SRCS}
${CEFCLIENT_WINDOWS_BROWSER_SRCS}
${CEFCLIENT_WINDOWS_RESOURCES_WIN_SRCS}
)
# cefclient resources.
set(CEFCLIENT_RESOURCES_RESOURCES_SRCS
resources/binding.html
resources/dialogs.html
resources/localstorage.html
resources/logo.png
resources/osr_test.html
resources/other_tests.html
resources/pdf.html
resources/pdf.pdf
resources/performance.html
resources/performance2.html
resources/transparency.html
resources/urlrequest.html
resources/window.html
resources/xmlhttprequest.html
)
source_group(cefclient\\\\resources FILES ${CEFCLIENT_RESOURCES_RESOURCES_SRCS})
set(CEFCLIENT_RESOURCES_RESOURCES_MAC_SRCS_MACOSX
resources/mac/Info.plist
resources/mac/cefclient.icns
)
APPEND_PLATFORM_SOURCES(CEFCLIENT_RESOURCES_RESOURCES_MAC_SRCS)
source_group(cefclient\\\\resources\\\\mac FILES ${CEFCLIENT_RESOURCES_RESOURCES_MAC_SRCS})
set(CEFCLIENT_RESOURCES_RESOURCES_MAC_ENGLISH_LPROJ_SRCS_MACOSX
resources/mac/English.lproj/InfoPlist.strings
resources/mac/English.lproj/MainMenu.xib
)
APPEND_PLATFORM_SOURCES(CEFCLIENT_RESOURCES_RESOURCES_MAC_ENGLISH_LPROJ_SRCS)
source_group(cefclient\\\\resources\\\\mac\\\\English.lproj FILES ${CEFCLIENT_RESOURCES_RESOURCES_MAC_ENGLISH_LPROJ_SRCS})
set(CEFCLIENT_RESOURCES_SRCS
${CEFCLIENT_RESOURCES_RESOURCES_SRCS}
${CEFCLIENT_RESOURCES_RESOURCES_MAC_SRCS}
${CEFCLIENT_RESOURCES_RESOURCES_MAC_ENGLISH_LPROJ_SRCS}
)
#
# Shared configuration.
#
# Target executable names.
set(CEF_TARGET "cefclient")
if(OS_MACOSX)
set(CEF_HELPER_TARGET "cefclient Helper")
endif()
# Logical target used to link the libcef library.
ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
# Determine the target output directory.
SET_CEF_TARGET_OUT_DIR()
#
# Linux configuration.
#
if(OS_LINUX)
# All sources required by the "cefclient" target. Generates an executable that
# is used for all processes.
set(CEFCLIENT_SRCS
${CEFCLIENT_BROWSER_SRCS}
${CEFCLIENT_COMMON_SRCS}
${CEFCLIENT_RENDERER_SRCS}
${CEFCLIENT_RESOURCES_SRCS}
${CEFCLIENT_LINUX_SRCS}
)
# Find required libraries and update compiler/linker variables.
FIND_LINUX_LIBRARIES("gmodule-2.0 gtk+-2.0 gthread-2.0 gtk+-unix-print-2.0 gtkglext-1.0")
# Executable target.
add_executable(${CEF_TARGET} ${CEFCLIENT_SRCS})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
# Set rpath so that libraries can be placed next to the executable.
set_target_properties(${CEF_TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN")
set_target_properties(${CEF_TARGET} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
set_target_properties(${CEF_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
# Copy CEF binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
# Copy cefclient resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEFCLIENT_RESOURCES_SRCS}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
# Rename the "res" directory to "files".
RENAME_DIRECTORY("${CEF_TARGET}" "${CEF_TARGET_OUT_DIR}/resources" "${CEF_TARGET_OUT_DIR}/files")
# Set SUID permissions on the chrome-sandbox target.
SET_LINUX_SUID_PERMISSIONS("${CEF_TARGET}" "${CEF_TARGET_OUT_DIR}/chrome-sandbox")
endif()
#
# Mac OS X configuration.
#
if(OS_MACOSX)
# All sources required by the "cefclient" target. Generates an app bundle that
# is used only for the browser process.
set(CEFCLIENT_SRCS
${CEFCLIENT_BROWSER_SRCS}
${CEFCLIENT_COMMON_SRCS}
${CEFCLIENT_RESOURCES_SRCS}
${CEFCLIENT_MACOSX_SRCS}
)
# All sources required by the "cefclient Helper" target. Generates an app
# bundle that is used only for non-browser processes.
set(CEFCLIENT_HELPER_SRCS
${CEFCLIENT_COMMON_SRCS}
${CEFCLIENT_RENDERER_SRCS}
${CEFCLIENT_MACOSX_HELPER_SRCS}
)
# Output paths for the app bundles.
set(CEF_APP "${CEF_TARGET_OUT_DIR}/${CEF_TARGET}.app")
set(CEF_HELPER_APP "${CEF_TARGET_OUT_DIR}/${CEF_HELPER_TARGET}.app")
# Variable referenced from Info.plist files.
set(PRODUCT_NAME "${CEF_TARGET}")
# Helper executable target.
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${CEFCLIENT_HELPER_SRCS})
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/helper-Info.plist
)
# Fix the framework link in the helper executable.
FIX_MACOSX_HELPER_FRAMEWORK_LINK(${CEF_HELPER_TARGET} ${CEF_HELPER_APP})
# Main executable target.
add_executable(${CEF_TARGET} MACOSX_BUNDLE ${CEFCLIENT_RESOURCES_SRCS} ${CEFCLIENT_SRCS})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} "-framework OpenGL")
set_target_properties(${CEF_TARGET} PROPERTIES
RESOURCE "${CEFCLIENT_RESOURCES_SRCS}"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/mac/Info.plist
)
# Copy files into the main app bundle.
add_custom_command(
TARGET ${CEF_TARGET}
POST_BUILD
# Copy the helper app bundle into the Frameworks directory.
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CEF_HELPER_APP}"
"${CEF_APP}/Contents/Frameworks/${CEF_HELPER_TARGET}.app"
# Copy the CEF framework into the Frameworks directory.
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
VERBATIM
)
# Fix the framework link in the main executable.
FIX_MACOSX_MAIN_FRAMEWORK_LINK(${CEF_TARGET} ${CEF_APP})
# Make the other helper app bundles.
MAKE_MACOSX_HELPERS(${CEF_TARGET} ${CEF_APP})
if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode")
# Manually process and copy over resource files.
# The Xcode generator handles this via the set_target_properties RESOURCE directive.
set(PREFIXES "resources/mac/" "resources/") # Remove these prefixes from input file paths.
COPY_MACOSX_RESOURCES("${CEFCLIENT_RESOURCES_SRCS}" "${PREFIXES}" "${CEF_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_APP}")
endif()
endif()
#
# Windows configuration.
#
if(OS_WINDOWS)
# All sources required by the "cefclient" target. Generates an executable that
# is used for all processes.
set(CEFCLIENT_SRCS
${CEFCLIENT_BROWSER_SRCS}
${CEFCLIENT_COMMON_SRCS}
${CEFCLIENT_RENDERER_SRCS}
${CEFCLIENT_RESOURCES_SRCS}
${CEFCLIENT_WINDOWS_SRCS}
)
# Executable target.
add_executable(${CEF_TARGET} WIN32 ${CEFCLIENT_SRCS})
add_dependencies(${CEF_TARGET} libcef_dll_wrapper)
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS} "glu32.lib" "opengl32.lib")
if(USE_SANDBOX)
# Logical target used to link the cef_sandbox library.
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
target_link_libraries(${CEF_TARGET} cef_sandbox_lib ${CEF_SANDBOX_STANDARD_LIBS})
endif()
# Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}")
# Copy CEF binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
endif()

View File

@ -0,0 +1,57 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/binding_test.h"
#include <algorithm>
#include <string>
#include "include/wrapper/cef_stream_resource_handler.h"
namespace client {
namespace binding_test {
namespace {
const char kTestUrl[] = "http://tests/binding";
const char kTestMessageName[] = "BindingTest";
// Handle messages in the browser process.
class Handler : public CefMessageRouterBrowserSide::Handler {
public:
Handler() {}
// Called due to cefQuery execution in binding.html.
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int64 query_id,
const CefString& request,
bool persistent,
CefRefPtr<Callback> callback) OVERRIDE {
// Only handle messages from the test URL.
const std::string& url = frame->GetURL();
if (url.find(kTestUrl) != 0)
return false;
const std::string& message_name = request;
if (message_name.find(kTestMessageName) == 0) {
// Reverse the string and return.
std::string result = message_name.substr(sizeof(kTestMessageName));
std::reverse(result.begin(), result.end());
callback->Success(result);
return true;
}
return false;
}
};
} // namespace
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
handlers.insert(new Handler());
}
} // namespace binding_test
} // namespace client

View File

@ -0,0 +1,20 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_BINDING_TEST_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_BINDING_TEST_H_
#pragma once
#include "cefclient/browser/test_runner.h"
namespace client {
namespace binding_test {
// Create message handlers. Called from test_runner.cc.
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
} // namespace binding_test
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_BINDING_TEST_H_

View File

@ -0,0 +1,82 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/browser_window.h"
#include "include/base/cef_bind.h"
#include "cefclient/browser/main_message_loop.h"
namespace client {
BrowserWindow::BrowserWindow(Delegate* delegate)
: delegate_(delegate),
is_closing_(false) {
DCHECK(delegate_);
}
CefRefPtr<CefBrowser> BrowserWindow::GetBrowser() const {
REQUIRE_MAIN_THREAD();
return browser_;
}
bool BrowserWindow::IsClosing() const {
REQUIRE_MAIN_THREAD();
return is_closing_;
}
void BrowserWindow::OnBrowserCreated(CefRefPtr<CefBrowser> browser) {
REQUIRE_MAIN_THREAD();
DCHECK(!browser_);
browser_ = browser;
delegate_->OnBrowserCreated(browser);
}
void BrowserWindow::OnBrowserClosing(CefRefPtr<CefBrowser> browser) {
REQUIRE_MAIN_THREAD();
DCHECK_EQ(browser->GetIdentifier(), browser_->GetIdentifier());
is_closing_ = true;
}
void BrowserWindow::OnBrowserClosed(CefRefPtr<CefBrowser> browser) {
REQUIRE_MAIN_THREAD();
DCHECK_EQ(browser->GetIdentifier(), browser_->GetIdentifier());
browser_ = NULL;
client_handler_->DetachDelegate();
client_handler_ = NULL;
// |this| may be deleted.
delegate_->OnBrowserWindowDestroyed();
}
void BrowserWindow::OnSetAddress(const std::string& url) {
REQUIRE_MAIN_THREAD();
delegate_->OnSetAddress(url);
}
void BrowserWindow::OnSetTitle(const std::string& title) {
REQUIRE_MAIN_THREAD();
delegate_->OnSetTitle(title);
}
void BrowserWindow::OnSetFullscreen(bool fullscreen) {
REQUIRE_MAIN_THREAD();
delegate_->OnSetFullscreen(fullscreen);
}
void BrowserWindow::OnSetLoadingState(bool isLoading,
bool canGoBack,
bool canGoForward) {
REQUIRE_MAIN_THREAD();
delegate_->OnSetLoadingState(isLoading, canGoBack, canGoForward);
}
void BrowserWindow::OnSetDraggableRegions(
const std::vector<CefDraggableRegion>& regions) {
REQUIRE_MAIN_THREAD();
delegate_->OnSetDraggableRegions(regions);
}
} // namespace client

View File

@ -0,0 +1,126 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_H_
#pragma once
#include "include/base/cef_scoped_ptr.h"
#include "include/cef_browser.h"
#include "cefclient/browser/client_handler.h"
#include "cefclient/browser/client_types.h"
namespace client {
// Represents a native child window hosting a single browser instance. The
// methods of this class must be called on the main thread unless otherwise
// indicated.
class BrowserWindow : public ClientHandler::Delegate {
public:
// This interface is implemented by the owner of the BrowserWindow. The
// methods of this class will be called on the main thread.
class Delegate {
public:
// Called when the browser has been created.
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser) = 0;
// Called when the BrowserWindow has been destroyed.
virtual void OnBrowserWindowDestroyed() = 0;
// Set the window URL address.
virtual void OnSetAddress(const std::string& url) = 0;
// Set the window title.
virtual void OnSetTitle(const std::string& title) = 0;
// Set fullscreen mode.
virtual void OnSetFullscreen(bool fullscreen) = 0;
// Set the loading state.
virtual void OnSetLoadingState(bool isLoading,
bool canGoBack,
bool canGoForward) = 0;
// Set the draggable regions.
virtual void OnSetDraggableRegions(
const std::vector<CefDraggableRegion>& regions) = 0;
protected:
virtual ~Delegate() {}
};
// Create a new browser and native window.
virtual void CreateBrowser(ClientWindowHandle parent_handle,
const CefRect& rect,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) = 0;
// Retrieve the configuration that will be used when creating a popup window.
// The popup browser will initially be parented to |temp_handle| which should
// be a pre-existing hidden window. The native window will be created later
// after the browser has been created. This method may be called on any
// thread.
virtual void GetPopupConfig(CefWindowHandle temp_handle,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) = 0;
// Show the popup window with correct parent and bounds in parent coordinates.
virtual void ShowPopup(ClientWindowHandle parent_handle,
int x, int y, size_t width, size_t height) = 0;
// Show the window.
virtual void Show() = 0;
// Hide the window.
virtual void Hide() = 0;
// Set the window bounds in parent coordinates.
virtual void SetBounds(int x, int y, size_t width, size_t height) = 0;
// Set focus to the window.
virtual void SetFocus(bool focus) = 0;
// Returns the window handle.
virtual ClientWindowHandle GetWindowHandle() const = 0;
// Returns the browser owned by the window.
CefRefPtr<CefBrowser> GetBrowser() const;
// Returns true if the browser is closing.
bool IsClosing() const;
protected:
// Allow deletion via scoped_ptr only.
friend struct base::DefaultDeleter<BrowserWindow>;
// Constructor may be called on any thread.
// |delegate| must outlive this object.
explicit BrowserWindow(Delegate* delegate);
// ClientHandler::Delegate methods.
void OnBrowserCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
void OnBrowserClosing(CefRefPtr<CefBrowser> browser) OVERRIDE;
void OnBrowserClosed(CefRefPtr<CefBrowser> browser) OVERRIDE;
void OnSetAddress(const std::string& url) OVERRIDE;
void OnSetTitle(const std::string& title) OVERRIDE;
void OnSetFullscreen(bool fullscreen) OVERRIDE;
void OnSetLoadingState(bool isLoading,
bool canGoBack,
bool canGoForward) OVERRIDE;
void OnSetDraggableRegions(
const std::vector<CefDraggableRegion>& regions) OVERRIDE;
Delegate* delegate_;
CefRefPtr<CefBrowser> browser_;
CefRefPtr<ClientHandler> client_handler_;
bool is_closing_;
private:
DISALLOW_COPY_AND_ASSIGN(BrowserWindow);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_H_

View File

@ -0,0 +1,94 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/browser_window_osr_win.h"
#include "cefclient/browser/main_message_loop.h"
namespace client {
BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
const std::string& startup_url,
const OsrRenderer::Settings& settings)
: BrowserWindow(delegate),
transparent_(settings.transparent),
osr_hwnd_(NULL) {
osr_window_ = new OsrWindowWin(this, settings);
client_handler_ = new ClientHandlerOsr(this, osr_window_.get(), startup_url);
}
void BrowserWindowOsrWin::CreateBrowser(
ClientWindowHandle parent_handle,
const CefRect& rect,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) {
REQUIRE_MAIN_THREAD();
// Create the new browser and native window on the UI thread.
RECT wnd_rect = {rect.x, rect.y, rect.x + rect.width, rect.y + rect.height};
osr_window_->CreateBrowser(parent_handle, wnd_rect, client_handler_, settings,
request_context, client_handler_->startup_url());
}
void BrowserWindowOsrWin::GetPopupConfig(CefWindowHandle temp_handle,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) {
// Note: This method may be called on any thread.
windowInfo.SetAsWindowless(temp_handle, transparent_);
client = client_handler_;
}
void BrowserWindowOsrWin::ShowPopup(ClientWindowHandle parent_handle,
int x, int y, size_t width, size_t height) {
REQUIRE_MAIN_THREAD();
if (osr_window_)
osr_window_->ShowPopup(parent_handle, x, y, width, height);
}
void BrowserWindowOsrWin::Show() {
REQUIRE_MAIN_THREAD();
if (osr_window_)
osr_window_->Show();
}
void BrowserWindowOsrWin::Hide() {
REQUIRE_MAIN_THREAD();
if (osr_window_)
osr_window_->Hide();
}
void BrowserWindowOsrWin::SetBounds(int x, int y, size_t width, size_t height) {
REQUIRE_MAIN_THREAD();
if (osr_window_)
osr_window_->SetBounds(x, y, width, height);
}
void BrowserWindowOsrWin::SetFocus(bool focus) {
REQUIRE_MAIN_THREAD();
if (osr_window_ && focus)
osr_window_->SetFocus();
}
ClientWindowHandle BrowserWindowOsrWin::GetWindowHandle() const {
REQUIRE_MAIN_THREAD();
return osr_hwnd_;
}
void BrowserWindowOsrWin::OnBrowserClosed(CefRefPtr<CefBrowser> browser) {
REQUIRE_MAIN_THREAD();
// Release the OSR window reference. It will be deleted on the UI thread.
osr_window_ = NULL;
BrowserWindow::OnBrowserClosed(browser);
}
void BrowserWindowOsrWin::OnOsrNativeWindowCreated(HWND hwnd) {
REQUIRE_MAIN_THREAD();
DCHECK(!osr_hwnd_);
osr_hwnd_ = hwnd;
}
} // namespace client

View File

@ -0,0 +1,61 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_WIN_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_WIN_H_
#pragma once
#include "cefclient/browser/browser_window.h"
#include "cefclient/browser/osr_window_win.h"
namespace client {
// Represents a native child window hosting a single off-screen browser
// instance. The methods of this class must be called on the main thread unless
// otherwise indicated.
class BrowserWindowOsrWin : public BrowserWindow,
public OsrWindowWin::Delegate {
public:
// Constructor may be called on any thread.
// |delegate| must outlive this object.
BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
const std::string& startup_url,
const OsrRenderer::Settings& settings);
// BrowserWindow methods.
void CreateBrowser(ClientWindowHandle parent_handle,
const CefRect& rect,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) OVERRIDE;
void GetPopupConfig(CefWindowHandle temp_handle,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) OVERRIDE;
void ShowPopup(ClientWindowHandle parent_handle,
int x, int y, size_t width, size_t height) OVERRIDE;
void Show() OVERRIDE;
void Hide() OVERRIDE;
void SetBounds(int x, int y, size_t width, size_t height) OVERRIDE;
void SetFocus(bool focus) OVERRIDE;
ClientWindowHandle GetWindowHandle() const OVERRIDE;
private:
// ClienHandler::Delegate methods.
void OnBrowserClosed(CefRefPtr<CefBrowser> browser) OVERRIDE;
// OsrWindowWin::Delegate methods.
void OnOsrNativeWindowCreated(HWND hwnd) OVERRIDE;
const bool transparent_;
// The below members are only accessed on the main thread.
scoped_refptr<OsrWindowWin> osr_window_;
HWND osr_hwnd_;
DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrWin);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_OSR_WIN_H_

View File

@ -0,0 +1,106 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/browser_window_std_win.h"
#include "cefclient/browser/client_handler_std.h"
#include "cefclient/browser/main_message_loop.h"
namespace client {
BrowserWindowStdWin::BrowserWindowStdWin(Delegate* delegate,
const std::string& startup_url)
: BrowserWindow(delegate) {
client_handler_ = new ClientHandlerStd(this, startup_url);
}
void BrowserWindowStdWin::CreateBrowser(
ClientWindowHandle parent_handle,
const CefRect& rect,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) {
REQUIRE_MAIN_THREAD();
CefWindowInfo window_info;
RECT wnd_rect = {rect.x, rect.y, rect.x + rect.width, rect.y + rect.height};
window_info.SetAsChild(parent_handle, wnd_rect);
CefBrowserHost::CreateBrowser(window_info, client_handler_,
client_handler_->startup_url(),
settings, request_context);
}
void BrowserWindowStdWin::GetPopupConfig(CefWindowHandle temp_handle,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) {
// Note: This method may be called on any thread.
// The window will be properly sized after the browser is created.
windowInfo.SetAsChild(temp_handle, RECT());
client = client_handler_;
}
void BrowserWindowStdWin::ShowPopup(ClientWindowHandle parent_handle,
int x, int y, size_t width, size_t height) {
REQUIRE_MAIN_THREAD();
HWND hwnd = GetWindowHandle();
if (hwnd) {
SetParent(hwnd, parent_handle);
SetWindowPos(hwnd, NULL, x, y,
static_cast<int>(width), static_cast<int>(height),
SWP_NOZORDER);
ShowWindow(hwnd, SW_SHOW);
}
}
void BrowserWindowStdWin::Show() {
REQUIRE_MAIN_THREAD();
HWND hwnd = GetWindowHandle();
if (hwnd && !::IsWindowVisible(hwnd))
ShowWindow(hwnd, SW_SHOW);
}
void BrowserWindowStdWin::Hide() {
REQUIRE_MAIN_THREAD();
HWND hwnd = GetWindowHandle();
if (hwnd) {
// When the frame window is minimized set the browser window size to 0x0 to
// reduce resource usage.
SetWindowPos(hwnd, NULL,
0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
}
void BrowserWindowStdWin::SetBounds(int x, int y, size_t width, size_t height) {
REQUIRE_MAIN_THREAD();
HWND hwnd = GetWindowHandle();
if (hwnd) {
// Set the browser window bounds.
SetWindowPos(hwnd, NULL, x, y,
static_cast<int>(width), static_cast<int>(height),
SWP_NOZORDER);
}
}
void BrowserWindowStdWin::SetFocus(bool focus) {
REQUIRE_MAIN_THREAD();
if (browser_)
browser_->GetHost()->SetFocus(focus);
}
ClientWindowHandle BrowserWindowStdWin::GetWindowHandle() const {
REQUIRE_MAIN_THREAD();
if (browser_)
return browser_->GetHost()->GetWindowHandle();
return NULL;
}
} // namespace client

View File

@ -0,0 +1,46 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_STD_WIN_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_STD_WIN_H_
#pragma once
#include "cefclient/browser/browser_window.h"
namespace client {
// Represents a native child window hosting a single windowed browser instance.
// The methods of this class must be called on the main thread unless otherwise
// indicated.
class BrowserWindowStdWin : public BrowserWindow {
public:
// Constructor may be called on any thread.
// |delegate| must outlive this object.
BrowserWindowStdWin(Delegate* delegate,
const std::string& startup_url);
// BrowserWindow methods.
void CreateBrowser(ClientWindowHandle parent_handle,
const CefRect& rect,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) OVERRIDE;
void GetPopupConfig(CefWindowHandle temp_handle,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) OVERRIDE;
void ShowPopup(ClientWindowHandle parent_handle,
int x, int y, size_t width, size_t height) OVERRIDE;
void Show() OVERRIDE;
void Hide() OVERRIDE;
void SetBounds(int x, int y, size_t width, size_t height) OVERRIDE;
void SetFocus(bool focus) OVERRIDE;
ClientWindowHandle GetWindowHandle() const OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(BrowserWindowStdWin);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_BROWSER_WINDOW_STD_WIN_H_

View File

@ -0,0 +1,98 @@
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/bytes_write_handler.h"
#include <cstdio>
#include <cstdlib>
#include "include/wrapper/cef_helpers.h"
namespace client {
BytesWriteHandler::BytesWriteHandler(size_t grow)
: grow_(grow),
datasize_(grow),
offset_(0) {
DCHECK_GT(grow, 0U);
data_ = malloc(grow);
DCHECK(data_ != NULL);
}
BytesWriteHandler::~BytesWriteHandler() {
if (data_)
free(data_);
}
size_t BytesWriteHandler::Write(const void* ptr, size_t size, size_t n) {
base::AutoLock lock_scope(lock_);
size_t rv;
if (offset_ + static_cast<int64>(size * n) >= datasize_ &&
Grow(size * n) == 0) {
rv = 0;
} else {
memcpy(reinterpret_cast<char*>(data_) + offset_, ptr, size * n);
offset_ += size * n;
rv = n;
}
return rv;
}
int BytesWriteHandler::Seek(int64 offset, int whence) {
int rv = -1L;
base::AutoLock lock_scope(lock_);
switch (whence) {
case SEEK_CUR:
if (offset_ + offset > datasize_ || offset_ + offset < 0)
break;
offset_ += offset;
rv = 0;
break;
case SEEK_END: {
int64 offset_abs = std::abs(offset);
if (offset_abs > datasize_)
break;
offset_ = datasize_ - offset_abs;
rv = 0;
break;
}
case SEEK_SET:
if (offset > datasize_ || offset < 0)
break;
offset_ = offset;
rv = 0;
break;
}
return rv;
}
int64 BytesWriteHandler::Tell() {
base::AutoLock lock_scope(lock_);
return offset_;
}
int BytesWriteHandler::Flush() {
return 0;
}
size_t BytesWriteHandler::Grow(size_t size) {
base::AutoLock lock_scope(lock_);
size_t rv;
size_t s = (size > grow_ ? size : grow_);
void* tmp = realloc(data_, datasize_ + s);
DCHECK(tmp != NULL);
if (tmp) {
data_ = tmp;
datasize_ += s;
rv = datasize_;
} else {
rv = 0;
}
return rv;
}
} // namespace client

View File

@ -0,0 +1,44 @@
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_BYTES_WRITE_HANDLER_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_BYTES_WRITE_HANDLER_H_
#pragma once
#include "include/base/cef_lock.h"
#include "include/cef_stream.h"
namespace client {
class BytesWriteHandler : public CefWriteHandler {
public:
explicit BytesWriteHandler(size_t grow);
~BytesWriteHandler();
size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE;
int Seek(int64 offset, int whence) OVERRIDE;
int64 Tell() OVERRIDE;
int Flush() OVERRIDE;
bool MayBlock() OVERRIDE { return false; }
void* GetData() { return data_; }
int64 GetDataSize() { return offset_; }
private:
size_t Grow(size_t size);
size_t grow_;
void* data_;
int64 datasize_;
int64 offset_;
base::Lock lock_;
IMPLEMENT_REFCOUNTING(BytesWriteHandler);
DISALLOW_COPY_AND_ASSIGN(BytesWriteHandler);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_BYTES_WRITE_HANDLER_H_

View File

@ -0,0 +1,45 @@
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/client_app_browser.h"
#include "include/base/cef_logging.h"
#include "include/cef_cookie.h"
namespace client {
ClientAppBrowser::ClientAppBrowser() {
}
void ClientAppBrowser::OnContextInitialized() {
CreateDelegates(delegates_);
// Register cookieable schemes with the global cookie manager.
CefRefPtr<CefCookieManager> manager =
CefCookieManager::GetGlobalManager(NULL);
DCHECK(manager.get());
manager->SetSupportedSchemes(cookieable_schemes_, NULL);
print_handler_ = CreatePrintHandler();
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it)
(*it)->OnContextInitialized(this);
}
void ClientAppBrowser::OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it)
(*it)->OnBeforeChildProcessLaunch(this, command_line);
}
void ClientAppBrowser::OnRenderProcessThreadCreated(
CefRefPtr<CefListValue> extra_info) {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it)
(*it)->OnRenderProcessThreadCreated(this, extra_info);
}
} // namespace client

View File

@ -0,0 +1,74 @@
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_APP_BROWSER_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_APP_BROWSER_H_
#pragma once
#include <set>
#include "cefclient/common/client_app.h"
namespace client {
// Client app implementation for the browser process.
class ClientAppBrowser : public ClientApp,
public CefBrowserProcessHandler {
public:
// Interface for browser delegates. All Delegates must be returned via
// CreateDelegates. Do not perform work in the Delegate
// constructor. See CefBrowserProcessHandler for documentation.
class Delegate : public virtual CefBase {
public:
virtual void OnContextInitialized(CefRefPtr<ClientApp> app) {}
virtual void OnBeforeChildProcessLaunch(
CefRefPtr<ClientAppBrowser> app,
CefRefPtr<CefCommandLine> command_line) {}
virtual void OnRenderProcessThreadCreated(
CefRefPtr<ClientAppBrowser> app,
CefRefPtr<CefListValue> extra_info) {}
};
typedef std::set<CefRefPtr<Delegate> > DelegateSet;
ClientAppBrowser();
private:
// Creates all of the Delegate objects. Implemented by cefclient in
// client_app_delegates_browser.cc
static void CreateDelegates(DelegateSet& delegates);
// Create the Linux print handler. Implemented by cefclient in
// client_app_delegates_browser.cc
static CefRefPtr<CefPrintHandler> CreatePrintHandler();
// CefApp methods.
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() OVERRIDE {
return this;
}
// CefBrowserProcessHandler methods.
void OnContextInitialized() OVERRIDE;
void OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
void OnRenderProcessThreadCreated(
CefRefPtr<CefListValue> extra_info) OVERRIDE;
CefRefPtr<CefPrintHandler> GetPrintHandler() OVERRIDE {
return print_handler_;
}
// Set of supported Delegates.
DelegateSet delegates_;
CefRefPtr<CefPrintHandler> print_handler_;
IMPLEMENT_REFCOUNTING(ClientAppBrowser);
DISALLOW_COPY_AND_ASSIGN(ClientAppBrowser);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_APP_BROWSER_H_

View File

@ -0,0 +1,26 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/client_app_browser.h"
#if defined(OS_LINUX)
#include "cefclient/browser/print_handler_gtk.h"
#endif
namespace client {
// static
void ClientAppBrowser::CreateDelegates(DelegateSet& delegates) {
}
// static
CefRefPtr<CefPrintHandler> ClientAppBrowser::CreatePrintHandler() {
#if defined(OS_LINUX)
return new ClientPrintHandlerGtk();
#else
return NULL;
#endif
}
} // namespace client

View File

@ -0,0 +1,770 @@
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/client_handler.h"
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <string>
#include "include/base/cef_bind.h"
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_parser.h"
#include "include/wrapper/cef_closure_task.h"
#include "cefclient/browser/main_context.h"
#include "cefclient/browser/resource_util.h"
#include "cefclient/browser/root_window_manager.h"
#include "cefclient/browser/test_runner.h"
#include "cefclient/common/client_switches.h"
namespace client {
#if defined(OS_WIN)
#define NEWLINE "\r\n"
#else
#define NEWLINE "\n"
#endif
namespace {
// Custom menu command Ids.
enum client_menu_ids {
CLIENT_ID_SHOW_DEVTOOLS = MENU_ID_USER_FIRST,
CLIENT_ID_CLOSE_DEVTOOLS,
CLIENT_ID_INSPECT_ELEMENT,
CLIENT_ID_TESTMENU_SUBMENU,
CLIENT_ID_TESTMENU_CHECKITEM,
CLIENT_ID_TESTMENU_RADIOITEM1,
CLIENT_ID_TESTMENU_RADIOITEM2,
CLIENT_ID_TESTMENU_RADIOITEM3,
};
// Musr match the value in client_renderer.cc.
const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged";
std::string GetTimeString(const CefTime& value) {
if (value.GetTimeT() == 0)
return "Unspecified";
static const char* kMonths[] = {
"January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December"
};
std::string month;
if (value.month >= 1 && value.month <= 12)
month = kMonths[value.month - 1];
else
month = "Invalid";
std::stringstream ss;
ss << month << " " << value.day_of_month << ", " << value.year << " " <<
std::setfill('0') << std::setw(2) << value.hour << ":" <<
std::setfill('0') << std::setw(2) << value.minute << ":" <<
std::setfill('0') << std::setw(2) << value.second;
return ss.str();
}
std::string GetBinaryString(CefRefPtr<CefBinaryValue> value) {
if (!value.get())
return "&nbsp;";
// Retrieve the value.
const size_t size = value->GetSize();
std::string src;
src.resize(size);
value->GetData(const_cast<char*>(src.data()), size, 0);
// Encode the value.
return CefBase64Encode(src.data(), src.size());
}
// Load a data: URI containing the error message.
void LoadErrorPage(CefRefPtr<CefFrame> frame,
const std::string& failed_url,
cef_errorcode_t error_code,
const std::string& other_info) {
std::stringstream ss;
ss << "<html><head><title>Page failed to load</title></head>"
"<body bgcolor=\"white\">"
"<h3>Page failed to load.</h3>"
"URL: <a href=\"" << failed_url << "\">"<< failed_url << "</a>"
"<br/>Error: " << test_runner::GetErrorString(error_code) <<
" (" << error_code << ")";
if (!other_info.empty())
ss << "<br/>" << other_info;
ss << "</body></html>";
frame->LoadURL(test_runner::GetDataURI(ss.str(), "text/html"));
}
} // namespace
ClientHandler::ClientHandler(Delegate* delegate,
bool is_osr,
const std::string& startup_url)
: is_osr_(is_osr),
startup_url_(startup_url),
delegate_(delegate),
browser_count_(0),
console_log_file_(MainContext::Get()->GetConsoleLogPath()),
first_console_message_(true),
focus_on_editable_field_(false) {
DCHECK(!console_log_file_.empty());
#if defined(OS_LINUX)
// Provide the GTK-based dialog implementation on Linux.
dialog_handler_ = new ClientDialogHandlerGtk();
#endif
resource_manager_ = new CefResourceManager();
test_runner::SetupResourceManager(resource_manager_);
// Read command line settings.
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
mouse_cursor_change_disabled_ =
command_line->HasSwitch(switches::kMouseCursorChangeDisabled);
}
void ClientHandler::DetachDelegate() {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(base::Bind(&ClientHandler::DetachDelegate, this));
return;
}
DCHECK(delegate_);
delegate_ = NULL;
}
bool ClientHandler::OnProcessMessageReceived(
CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) {
CEF_REQUIRE_UI_THREAD();
if (message_router_->OnProcessMessageReceived(browser, source_process,
message)) {
return true;
}
// Check for messages from the client renderer.
std::string message_name = message->GetName();
if (message_name == kFocusedNodeChangedMessage) {
// A message is sent from ClientRenderDelegate to tell us whether the
// currently focused DOM node is editable. Use of |focus_on_editable_field_|
// is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent
// but is useful for demonstration purposes.
focus_on_editable_field_ = message->GetArgumentList()->GetBool(0);
return true;
}
return false;
}
void ClientHandler::OnBeforeContextMenu(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) {
CEF_REQUIRE_UI_THREAD();
if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) {
// Add a separator if the menu already has items.
if (model->GetCount() > 0)
model->AddSeparator();
// Add DevTools items to all context menus.
model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools");
model->AddItem(CLIENT_ID_CLOSE_DEVTOOLS, "Close DevTools");
model->AddSeparator();
model->AddItem(CLIENT_ID_INSPECT_ELEMENT, "Inspect Element");
// Test context menu features.
BuildTestMenu(model);
}
}
bool ClientHandler::OnContextMenuCommand(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
int command_id,
EventFlags event_flags) {
CEF_REQUIRE_UI_THREAD();
switch (command_id) {
case CLIENT_ID_SHOW_DEVTOOLS:
ShowDevTools(browser, CefPoint());
return true;
case CLIENT_ID_CLOSE_DEVTOOLS:
CloseDevTools(browser);
return true;
case CLIENT_ID_INSPECT_ELEMENT:
ShowDevTools(browser, CefPoint(params->GetXCoord(), params->GetYCoord()));
return true;
default: // Allow default handling, if any.
return ExecuteTestMenu(command_id);
}
}
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& url) {
CEF_REQUIRE_UI_THREAD();
// Only update the address for the main (top-level) frame.
if (frame->IsMain())
NotifyAddress(url);
}
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) {
CEF_REQUIRE_UI_THREAD();
NotifyTitle(title);
}
void ClientHandler::OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
bool fullscreen) {
CEF_REQUIRE_UI_THREAD();
NotifyFullscreen(fullscreen);
}
bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
const CefString& message,
const CefString& source,
int line) {
CEF_REQUIRE_UI_THREAD();
FILE* file = fopen(console_log_file_.c_str(), "a");
if (file) {
std::stringstream ss;
ss << "Message: " << message.ToString() << NEWLINE <<
"Source: " << source.ToString() << NEWLINE <<
"Line: " << line << NEWLINE <<
"-----------------------" << NEWLINE;
fputs(ss.str().c_str(), file);
fclose(file);
if (first_console_message_) {
test_runner::Alert(
browser, "Console messages written to \"" + console_log_file_ + "\"");
first_console_message_ = false;
}
}
return false;
}
void ClientHandler::OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) {
CEF_REQUIRE_UI_THREAD();
// Continue the download and show the "Save As" dialog.
callback->Continue(MainContext::Get()->GetDownloadPath(suggested_name), true);
}
void ClientHandler::OnDownloadUpdated(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
CefRefPtr<CefDownloadItemCallback> callback) {
CEF_REQUIRE_UI_THREAD();
if (download_item->IsComplete()) {
test_runner::Alert(
browser,
"File \"" + download_item->GetFullPath().ToString() +
"\" downloaded successfully.");
}
}
bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
CefDragHandler::DragOperationsMask mask) {
CEF_REQUIRE_UI_THREAD();
// Forbid dragging of link URLs.
if (mask & DRAG_OPERATION_LINK)
return true;
return false;
}
void ClientHandler::OnDraggableRegionsChanged(
CefRefPtr<CefBrowser> browser,
const std::vector<CefDraggableRegion>& regions) {
CEF_REQUIRE_UI_THREAD();
NotifyDraggableRegions(regions);
}
bool ClientHandler::OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,
const CefString& requesting_url,
int request_id,
CefRefPtr<CefGeolocationCallback> callback) {
CEF_REQUIRE_UI_THREAD();
// Allow geolocation access from all websites.
callback->Continue(true);
return true;
}
bool ClientHandler::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
const CefKeyEvent& event,
CefEventHandle os_event,
bool* is_keyboard_shortcut) {
CEF_REQUIRE_UI_THREAD();
if (!event.focus_on_editable_field && event.windows_key_code == 0x20) {
// Special handling for the space character when an input element does not
// have focus. Handling the event in OnPreKeyEvent() keeps the event from
// being processed in the renderer. If we instead handled the event in the
// OnKeyEvent() method the space key would cause the window to scroll in
// addition to showing the alert box.
if (event.type == KEYEVENT_RAWKEYDOWN)
test_runner::Alert(browser, "You pressed the space bar!");
return true;
}
return false;
}
bool ClientHandler::OnBeforePopup(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
CefLifeSpanHandler::WindowOpenDisposition target_disposition,
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access) {
CEF_REQUIRE_IO_THREAD();
// Return true to cancel the popup window.
return !CreatePopupWindow(browser, false, popupFeatures, windowInfo, client,
settings);
}
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
browser_count_++;
if (!message_router_) {
// Create the browser-side router for query handling.
CefMessageRouterConfig config;
message_router_ = CefMessageRouterBrowserSide::Create(config);
// Register handlers with the router.
test_runner::CreateMessageHandlers(message_handler_set_);
MessageHandlerSet::const_iterator it = message_handler_set_.begin();
for (; it != message_handler_set_.end(); ++it)
message_router_->AddHandler(*(it), false);
}
// Disable mouse cursor change if requested via the command-line flag.
if (mouse_cursor_change_disabled_)
browser->GetHost()->SetMouseCursorChangeDisabled(true);
NotifyBrowserCreated(browser);
}
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
NotifyBrowserClosing(browser);
// Allow the close. For windowed browsers this will result in the OS close
// event being sent.
return false;
}
void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
if (--browser_count_ == 0) {
// Remove and delete message router handlers.
MessageHandlerSet::const_iterator it =
message_handler_set_.begin();
for (; it != message_handler_set_.end(); ++it) {
message_router_->RemoveHandler(*(it));
delete *(it);
}
message_handler_set_.clear();
message_router_ = NULL;
}
NotifyBrowserClosed(browser);
}
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
bool isLoading,
bool canGoBack,
bool canGoForward) {
CEF_REQUIRE_UI_THREAD();
NotifyLoadingState(isLoading, canGoBack, canGoForward);
}
void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const CefString& errorText,
const CefString& failedUrl) {
CEF_REQUIRE_UI_THREAD();
// Don't display an error for downloaded files.
if (errorCode == ERR_ABORTED)
return;
// Don't display an error for external protocols that we allow the OS to
// handle. See OnProtocolExecution().
if (errorCode == ERR_UNKNOWN_URL_SCHEME) {
std::string urlStr = frame->GetURL();
if (urlStr.find("spotify:") == 0)
return;
}
// Load the error page.
LoadErrorPage(frame, failedUrl, errorCode, errorText);
}
bool ClientHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect) {
CEF_REQUIRE_UI_THREAD();
message_router_->OnBeforeBrowse(browser, frame);
return false;
}
bool ClientHandler::OnOpenURLFromTab(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
CefRequestHandler::WindowOpenDisposition target_disposition,
bool user_gesture) {
if (user_gesture && target_disposition == WOD_NEW_BACKGROUND_TAB) {
// Handle middle-click and ctrl + left-click by opening the URL in a new
// browser window.
MainContext::Get()->GetRootWindowManager()->CreateRootWindow(
true, is_osr(), CefRect(), target_url);
return true;
}
// Open the URL in the current browser window.
return false;
}
cef_return_value_t ClientHandler::OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefRequestCallback> callback) {
CEF_REQUIRE_IO_THREAD();
return resource_manager_->OnBeforeResourceLoad(browser, frame, request,
callback);
}
CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) {
CEF_REQUIRE_IO_THREAD();
return resource_manager_->GetResourceHandler(browser, frame, request);
}
bool ClientHandler::OnQuotaRequest(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
int64 new_size,
CefRefPtr<CefRequestCallback> callback) {
CEF_REQUIRE_IO_THREAD();
static const int64 max_size = 1024 * 1024 * 20; // 20mb.
// Grant the quota request if the size is reasonable.
callback->Continue(new_size <= max_size);
return true;
}
void ClientHandler::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
const CefString& url,
bool& allow_os_execution) {
CEF_REQUIRE_UI_THREAD();
std::string urlStr = url;
// Allow OS execution of Spotify URIs.
if (urlStr.find("spotify:") == 0)
allow_os_execution = true;
}
bool ClientHandler::OnCertificateError(
CefRefPtr<CefBrowser> browser,
ErrorCode cert_error,
const CefString& request_url,
CefRefPtr<CefSSLInfo> ssl_info,
CefRefPtr<CefRequestCallback> callback) {
CEF_REQUIRE_UI_THREAD();
CefRefPtr<CefSSLCertPrincipal> subject = ssl_info->GetSubject();
CefRefPtr<CefSSLCertPrincipal> issuer = ssl_info->GetIssuer();
// Build a table showing certificate information.
std::stringstream ss;
ss << "X.509 Certificate Information:"
"<table border=1><tr><th>Field</th><th>Value</th></tr>" <<
"<tr><td>Subject</td><td>" <<
(subject.get() ? subject->GetDisplayName().ToString() : "&nbsp;") <<
"</td></tr>"
"<tr><td>Issuer</td><td>" <<
(issuer.get() ? issuer->GetDisplayName().ToString() : "&nbsp;") <<
"</td></tr>"
"<tr><td>Serial #*</td><td>" <<
GetBinaryString(ssl_info->GetSerialNumber()) << "</td></tr>"
"<tr><td>Valid Start</td><td>" <<
GetTimeString(ssl_info->GetValidStart()) << "</td></tr>"
"<tr><td>Valid Expiry</td><td>" <<
GetTimeString(ssl_info->GetValidExpiry()) << "</td></tr>"
"<tr><td>DER Encoded*</td>"
"<td style=\"max-width:800px;overflow:scroll;\">" <<
GetBinaryString(ssl_info->GetDEREncoded()) << "</td></tr>"
"<tr><td>PEM Encoded*</td>"
"<td style=\"max-width:800px;overflow:scroll;\">" <<
GetBinaryString(ssl_info->GetPEMEncoded()) << "</td></tr>"
"</table> * Displayed value is base64 encoded.";
// Load the error page.
LoadErrorPage(browser->GetMainFrame(), request_url, cert_error, ss.str());
return false; // Cancel the request.
}
void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TerminationStatus status) {
CEF_REQUIRE_UI_THREAD();
message_router_->OnRenderProcessTerminated(browser);
// Don't reload if there's no start URL, or if the crash URL was specified.
if (startup_url_.empty() || startup_url_ == "chrome://crash")
return;
CefRefPtr<CefFrame> frame = browser->GetMainFrame();
std::string url = frame->GetURL();
// Don't reload if the termination occurred before any URL had successfully
// loaded.
if (url.empty())
return;
std::string start_url = startup_url_;
// Convert URLs to lowercase for easier comparison.
std::transform(url.begin(), url.end(), url.begin(), tolower);
std::transform(start_url.begin(), start_url.end(), start_url.begin(),
tolower);
// Don't reload the URL that just resulted in termination.
if (url.find(start_url) == 0)
return;
frame->LoadURL(startup_url_);
}
int ClientHandler::GetBrowserCount() const {
CEF_REQUIRE_UI_THREAD();
return browser_count_;
}
void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser,
const CefPoint& inspect_element_at) {
CefWindowInfo windowInfo;
CefRefPtr<CefClient> client;
CefBrowserSettings settings;
if (CreatePopupWindow(browser, true, CefPopupFeatures(), windowInfo, client,
settings)) {
browser->GetHost()->ShowDevTools(windowInfo, client, settings,
inspect_element_at);
}
}
void ClientHandler::CloseDevTools(CefRefPtr<CefBrowser> browser) {
browser->GetHost()->CloseDevTools();
}
bool ClientHandler::CreatePopupWindow(
CefRefPtr<CefBrowser> browser,
bool is_devtools,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings) {
// Note: This method will be called on multiple threads.
// The popup browser will be parented to a new native window.
// Don't show URL bar and navigation buttons on DevTools windows.
MainContext::Get()->GetRootWindowManager()->CreateRootWindowAsPopup(
!is_devtools, is_osr(), popupFeatures, windowInfo, client, settings);
return true;
}
void ClientHandler::NotifyBrowserCreated(CefRefPtr<CefBrowser> browser) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyBrowserCreated, this, browser));
return;
}
if (delegate_)
delegate_->OnBrowserCreated(browser);
}
void ClientHandler::NotifyBrowserClosing(CefRefPtr<CefBrowser> browser) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyBrowserClosing, this, browser));
return;
}
if (delegate_)
delegate_->OnBrowserClosing(browser);
}
void ClientHandler::NotifyBrowserClosed(CefRefPtr<CefBrowser> browser) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyBrowserClosed, this, browser));
return;
}
if (delegate_)
delegate_->OnBrowserClosed(browser);
}
void ClientHandler::NotifyAddress(const CefString& url) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyAddress, this, url));
return;
}
if (delegate_)
delegate_->OnSetAddress(url);
}
void ClientHandler::NotifyTitle(const CefString& title) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyTitle, this, title));
return;
}
if (delegate_)
delegate_->OnSetTitle(title);
}
void ClientHandler::NotifyFullscreen(bool fullscreen) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyFullscreen, this, fullscreen));
return;
}
if (delegate_)
delegate_->OnSetFullscreen(fullscreen);
}
void ClientHandler::NotifyLoadingState(bool isLoading,
bool canGoBack,
bool canGoForward) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyLoadingState, this,
isLoading, canGoBack, canGoForward));
return;
}
if (delegate_)
delegate_->OnSetLoadingState(isLoading, canGoBack, canGoForward);
}
void ClientHandler::NotifyDraggableRegions(
const std::vector<CefDraggableRegion>& regions) {
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute this method on the main thread.
MAIN_POST_CLOSURE(
base::Bind(&ClientHandler::NotifyDraggableRegions, this, regions));
return;
}
if (delegate_)
delegate_->OnSetDraggableRegions(regions);
}
void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
if (model->GetCount() > 0)
model->AddSeparator();
// Build the sub menu.
CefRefPtr<CefMenuModel> submenu =
model->AddSubMenu(CLIENT_ID_TESTMENU_SUBMENU, "Context Menu Test");
submenu->AddCheckItem(CLIENT_ID_TESTMENU_CHECKITEM, "Check Item");
submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM1, "Radio Item 1", 0);
submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM2, "Radio Item 2", 0);
submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM3, "Radio Item 3", 0);
// Check the check item.
if (test_menu_state_.check_item)
submenu->SetChecked(CLIENT_ID_TESTMENU_CHECKITEM, true);
// Check the selected radio item.
submenu->SetChecked(
CLIENT_ID_TESTMENU_RADIOITEM1 + test_menu_state_.radio_item, true);
}
bool ClientHandler::ExecuteTestMenu(int command_id) {
if (command_id == CLIENT_ID_TESTMENU_CHECKITEM) {
// Toggle the check item.
test_menu_state_.check_item ^= 1;
return true;
} else if (command_id >= CLIENT_ID_TESTMENU_RADIOITEM1 &&
command_id <= CLIENT_ID_TESTMENU_RADIOITEM3) {
// Store the selected radio item.
test_menu_state_.radio_item = (command_id - CLIENT_ID_TESTMENU_RADIOITEM1);
return true;
}
// Allow default handling to proceed.
return false;
}
} // namespace client

View File

@ -0,0 +1,352 @@
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_H_
#pragma once
#include <set>
#include <string>
#include "include/cef_client.h"
#include "include/wrapper/cef_helpers.h"
#include "include/wrapper/cef_message_router.h"
#include "include/wrapper/cef_resource_manager.h"
#include "cefclient/browser/client_types.h"
#if defined(OS_LINUX)
#include "cefclient/browser/dialog_handler_gtk.h"
#endif
namespace client {
// Client handler abstract base class. Provides common functionality shared by
// all concrete client handler implementations.
class ClientHandler : public CefClient,
public CefContextMenuHandler,
public CefDisplayHandler,
public CefDownloadHandler,
public CefDragHandler,
public CefGeolocationHandler,
public CefKeyboardHandler,
public CefLifeSpanHandler,
public CefLoadHandler,
public CefRequestHandler {
public:
// Implement this interface to receive notification of ClientHandler
// events. The methods of this class will be called on the main thread.
class Delegate {
public:
// Called when the browser is created.
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser) = 0;
// Called when the browser is closing.
virtual void OnBrowserClosing(CefRefPtr<CefBrowser> browser) = 0;
// Called when the browser has been closed.
virtual void OnBrowserClosed(CefRefPtr<CefBrowser> browser) = 0;
// Set the window URL address.
virtual void OnSetAddress(const std::string& url) = 0;
// Set the window title.
virtual void OnSetTitle(const std::string& title) = 0;
// Set fullscreen mode.
virtual void OnSetFullscreen(bool fullscreen) = 0;
// Set the loading state.
virtual void OnSetLoadingState(bool isLoading,
bool canGoBack,
bool canGoForward) = 0;
// Set the draggable regions.
virtual void OnSetDraggableRegions(
const std::vector<CefDraggableRegion>& regions) = 0;
protected:
virtual ~Delegate() {}
};
typedef std::set<CefMessageRouterBrowserSide::Handler*> MessageHandlerSet;
// Constructor may be called on any thread.
// |delegate| must outlive this object or DetachDelegate() must be called.
ClientHandler(Delegate* delegate,
bool is_osr,
const std::string& startup_url);
// This object may outlive the Delegate object so it's necessary for the
// Delegate to detach itself before destruction.
void DetachDelegate();
// CefClient methods
CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE {
return this;
}
CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE {
return this;
}
CefRefPtr<CefDownloadHandler> GetDownloadHandler() OVERRIDE {
return this;
}
CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE {
return this;
}
CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE {
return this;
}
CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE {
return this;
}
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE {
return this;
}
CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE {
return this;
}
CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE {
return this;
}
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE;
#if defined(OS_LINUX)
CefRefPtr<CefDialogHandler> GetDialogHandler() OVERRIDE {
return dialog_handler_;
}
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE {
return dialog_handler_;
}
#endif
// CefContextMenuHandler methods
void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) OVERRIDE;
bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
int command_id,
EventFlags event_flags) OVERRIDE;
// CefDisplayHandler methods
void OnAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& url) OVERRIDE;
void OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) OVERRIDE;
void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
bool fullscreen) OVERRIDE;
bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
const CefString& message,
const CefString& source,
int line) OVERRIDE;
// CefDownloadHandler methods
void OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) OVERRIDE;
void OnDownloadUpdated(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
CefRefPtr<CefDownloadItemCallback> callback) OVERRIDE;
// CefDragHandler methods
bool OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
CefDragHandler::DragOperationsMask mask) OVERRIDE;
void OnDraggableRegionsChanged(
CefRefPtr<CefBrowser> browser,
const std::vector<CefDraggableRegion>& regions) OVERRIDE;
// CefGeolocationHandler methods
bool OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,
const CefString& requesting_url,
int request_id,
CefRefPtr<CefGeolocationCallback> callback) OVERRIDE;
// CefKeyboardHandler methods
bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
const CefKeyEvent& event,
CefEventHandle os_event,
bool* is_keyboard_shortcut) OVERRIDE;
// CefLifeSpanHandler methods
bool OnBeforePopup(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
CefLifeSpanHandler::WindowOpenDisposition target_disposition,
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access) OVERRIDE;
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
bool DoClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
// CefLoadHandler methods
void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
bool isLoading,
bool canGoBack,
bool canGoForward) OVERRIDE;
void OnLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const CefString& errorText,
const CefString& failedUrl) OVERRIDE;
// CefRequestHandler methods
bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_redirect) OVERRIDE;
bool OnOpenURLFromTab(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
CefRequestHandler::WindowOpenDisposition target_disposition,
bool user_gesture) OVERRIDE;
cef_return_value_t OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefRequestCallback> callback) OVERRIDE;
CefRefPtr<CefResourceHandler> GetResourceHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) OVERRIDE;
bool OnQuotaRequest(CefRefPtr<CefBrowser> browser,
const CefString& origin_url,
int64 new_size,
CefRefPtr<CefRequestCallback> callback) OVERRIDE;
void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
const CefString& url,
bool& allow_os_execution) OVERRIDE;
bool OnCertificateError(
CefRefPtr<CefBrowser> browser,
ErrorCode cert_error,
const CefString& request_url,
CefRefPtr<CefSSLInfo> ssl_info,
CefRefPtr<CefRequestCallback> callback) OVERRIDE;
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
TerminationStatus status) OVERRIDE;
// Returns the number of browsers currently using this handler. Can only be
// called on the CEF UI thread.
int GetBrowserCount() const;
// Show a new DevTools popup window.
void ShowDevTools(CefRefPtr<CefBrowser> browser,
const CefPoint& inspect_element_at);
// Close the existing DevTools popup window, if any.
void CloseDevTools(CefRefPtr<CefBrowser> browser);
// Returns the startup URL.
std::string startup_url() const { return startup_url_; }
// Returns true if this handler uses off-screen rendering.
bool is_osr() const { return is_osr_; }
protected:
// Create a new popup window using the specified information. |is_devtools|
// will be true if the window will be used for DevTools. Return true to
// proceed with popup browser creation or false to cancel the popup browser.
// May be called on any thead.
bool CreatePopupWindow(
CefRefPtr<CefBrowser> browser,
bool is_devtools,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings);
// Execute Delegate notifications on the main thread.
void NotifyBrowserCreated(CefRefPtr<CefBrowser> browser);
void NotifyBrowserClosing(CefRefPtr<CefBrowser> browser);
void NotifyBrowserClosed(CefRefPtr<CefBrowser> browser);
void NotifyAddress(const CefString& url);
void NotifyTitle(const CefString& title);
void NotifyFullscreen(bool fullscreen);
void NotifyLoadingState(bool isLoading,
bool canGoBack,
bool canGoForward);
void NotifyDraggableRegions(
const std::vector<CefDraggableRegion>& regions);
// Test context menu creation.
void BuildTestMenu(CefRefPtr<CefMenuModel> model);
bool ExecuteTestMenu(int command_id);
// THREAD SAFE MEMBERS
// The following members may be accessed from any thread.
// True if this handler uses off-screen rendering.
const bool is_osr_;
// The startup URL.
const std::string startup_url_;
// True if mouse cursor change is disabled.
bool mouse_cursor_change_disabled_;
#if defined(OS_LINUX)
// Custom dialog handler for GTK.
CefRefPtr<ClientDialogHandlerGtk> dialog_handler_;
#endif
// Handles the browser side of query routing. The renderer side is handled
// in client_renderer.cc.
CefRefPtr<CefMessageRouterBrowserSide> message_router_;
// Manages the registration and delivery of resources.
CefRefPtr<CefResourceManager> resource_manager_;
// MAIN THREAD MEMBERS
// The following members will only be accessed on the main thread. This will
// be the same as the CEF UI thread except when using multi-threaded message
// loop mode on Windows.
Delegate* delegate_;
// UI THREAD MEMBERS
// The following members will only be accessed on the CEF UI thread.
// Track state information for the text context menu.
struct TestMenuState {
TestMenuState() : check_item(true), radio_item(0) {}
bool check_item;
int radio_item;
} test_menu_state_;
// The current number of browsers using this handler.
int browser_count_;
// Console logging state.
const std::string console_log_file_;
bool first_console_message_;
// True if an editable field currently has focus.
bool focus_on_editable_field_;
// Set of Handlers registered with the message router.
MessageHandlerSet message_handler_set_;
DISALLOW_COPY_AND_ASSIGN(ClientHandler);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_H_

View File

@ -0,0 +1,138 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/client_handler_osr.h"
#include "include/base/cef_bind.h"
#include "include/wrapper/cef_closure_task.h"
#include "include/wrapper/cef_helpers.h"
namespace client {
ClientHandlerOsr::ClientHandlerOsr(Delegate* delegate,
OsrDelegate* osr_delegate,
const std::string& startup_url)
: ClientHandler(delegate, true, startup_url),
osr_delegate_(osr_delegate) {
DCHECK(osr_delegate_);
}
void ClientHandlerOsr::DetachOsrDelegate() {
if (!CefCurrentlyOn(TID_UI)) {
// Execute this method on the UI thread.
CefPostTask(TID_UI, base::Bind(&ClientHandlerOsr::DetachOsrDelegate, this));
return;
}
DCHECK(osr_delegate_);
osr_delegate_ = NULL;
}
void ClientHandlerOsr::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
if (osr_delegate_)
osr_delegate_->OnAfterCreated(browser);
ClientHandler::OnAfterCreated(browser);
}
void ClientHandlerOsr::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
CEF_REQUIRE_UI_THREAD();
if (osr_delegate_)
osr_delegate_->OnBeforeClose(browser);
ClientHandler::OnBeforeClose(browser);
}
bool ClientHandlerOsr::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return false;
return osr_delegate_->GetRootScreenRect(browser, rect);
}
bool ClientHandlerOsr::GetViewRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return false;
return osr_delegate_->GetViewRect(browser, rect);
}
bool ClientHandlerOsr::GetScreenPoint(CefRefPtr<CefBrowser> browser,
int viewX,
int viewY,
int& screenX,
int& screenY) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return false;
return osr_delegate_->GetScreenPoint(browser, viewX, viewY, screenX, screenY);
}
bool ClientHandlerOsr::GetScreenInfo(CefRefPtr<CefBrowser> browser,
CefScreenInfo& screen_info) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return false;
return osr_delegate_->GetScreenInfo(browser, screen_info);
}
void ClientHandlerOsr::OnPopupShow(CefRefPtr<CefBrowser> browser,
bool show) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return;
return osr_delegate_->OnPopupShow(browser, show);
}
void ClientHandlerOsr::OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return;
return osr_delegate_->OnPopupSize(browser, rect);
}
void ClientHandlerOsr::OnPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
const void* buffer,
int width,
int height) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return;
osr_delegate_->OnPaint(browser, type, dirtyRects, buffer, width, height);
}
void ClientHandlerOsr::OnCursorChange(
CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor,
CursorType type,
const CefCursorInfo& custom_cursor_info) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return;
osr_delegate_->OnCursorChange(browser, cursor, type, custom_cursor_info);
}
bool ClientHandlerOsr::StartDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
int x, int y) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return false;
return osr_delegate_->StartDragging(browser, drag_data, allowed_ops, x, y);
}
void ClientHandlerOsr::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
CefRenderHandler::DragOperation operation) {
CEF_REQUIRE_UI_THREAD();
if (!osr_delegate_)
return;
osr_delegate_->UpdateDragCursor(browser, operation);
}
} // namespace client

View File

@ -0,0 +1,124 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_OSR_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_OSR_H_
#pragma once
#include "cefclient/browser/client_handler.h"
namespace client {
// Client handler implementation for windowless browsers. There will only ever
// be one browser per handler instance.
class ClientHandlerOsr : public ClientHandler,
public CefRenderHandler {
public:
// Implement this interface to receive notification of ClientHandlerOsr
// events. The methods of this class will be called on the CEF UI thread.
class OsrDelegate {
public:
// These methods match the CefLifeSpanHandler interface.
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) = 0;
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) = 0;
// These methods match the CefRenderHandler interface.
virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) = 0;
virtual bool GetViewRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) = 0;
virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
int viewX,
int viewY,
int& screenX,
int& screenY) = 0;
virtual bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
CefScreenInfo& screen_info) = 0;
virtual void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) = 0;
virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) = 0;
virtual void OnPaint(CefRefPtr<CefBrowser> browser,
PaintElementType type,
const RectList& dirtyRects,
const void* buffer,
int width,
int height) = 0;
virtual void OnCursorChange(
CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor,
CefRenderHandler::CursorType type,
const CefCursorInfo& custom_cursor_info) = 0;
virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
int x, int y) = 0;
virtual void UpdateDragCursor(
CefRefPtr<CefBrowser> browser,
CefRenderHandler::DragOperation operation) = 0;
protected:
virtual ~OsrDelegate() {}
};
ClientHandlerOsr(Delegate* delegate,
OsrDelegate* osr_delegate,
const std::string& startup_url);
// This object may outlive the OsrDelegate object so it's necessary for the
// OsrDelegate to detach itself before destruction.
void DetachOsrDelegate();
// CefClient methods.
CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE {
return this;
}
// CefLifeSpanHandler methods.
void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
// CefRenderHandler methods.
bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) OVERRIDE;
bool GetViewRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) OVERRIDE;
bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
int viewX,
int viewY,
int& screenX,
int& screenY) OVERRIDE;
bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
CefScreenInfo& screen_info) OVERRIDE;
void OnPopupShow(CefRefPtr<CefBrowser> browser, bool show) OVERRIDE;
void OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) OVERRIDE;
void OnPaint(CefRefPtr<CefBrowser> browser,
CefRenderHandler::PaintElementType type,
const CefRenderHandler::RectList& dirtyRects,
const void* buffer,
int width,
int height) OVERRIDE;
void OnCursorChange(CefRefPtr<CefBrowser> browser,
CefCursorHandle cursor,
CursorType type,
const CefCursorInfo& custom_cursor_info) OVERRIDE;
bool StartDragging(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> drag_data,
CefRenderHandler::DragOperationsMask allowed_ops,
int x, int y) OVERRIDE;
void UpdateDragCursor(CefRefPtr<CefBrowser> browser,
CefRenderHandler::DragOperation operation) OVERRIDE;
private:
// Only accessed on the UI thread.
OsrDelegate* osr_delegate_;
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(ClientHandlerOsr);
DISALLOW_COPY_AND_ASSIGN(ClientHandlerOsr);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_OSR_H_

View File

@ -0,0 +1,14 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/client_handler_std.h"
namespace client {
ClientHandlerStd::ClientHandlerStd(Delegate* delegate,
const std::string& startup_url)
: ClientHandler(delegate, false, startup_url) {
}
} // namespace client

View File

@ -0,0 +1,28 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_STD_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_STD_H_
#pragma once
#include "cefclient/browser/client_handler.h"
namespace client {
// Client handler implementation for windowed browsers. There will only ever be
// one browser per handler instance.
class ClientHandlerStd : public ClientHandler {
public:
ClientHandlerStd(Delegate* delegate,
const std::string& startup_url);
private:
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(ClientHandlerStd);
DISALLOW_COPY_AND_ASSIGN(ClientHandlerStd);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_HANDLER_STD_H_

View File

@ -0,0 +1,33 @@
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_TYPES_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_TYPES_H_
#pragma once
#include "include/cef_base.h"
#if defined(OS_LINUX)
#include <gtk/gtk.h>
// The Linux client uses GTK instead of the underlying platform type (X11).
#define ClientWindowHandle GtkWidget*
#else
#define ClientWindowHandle CefWindowHandle
#endif
#if defined(OS_MACOSX)
// Forward declaration of ObjC types used by cefclient and not provided by
// include/internal/cef_types_mac.h.
#ifdef __cplusplus
#ifdef __OBJC__
@class NSWindow;
#else
class NSWindow;
#endif
#endif
#endif // defined OS_MACOSX
#endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_TYPES_H_

View File

@ -0,0 +1,187 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/dialog_test.h"
#include <string>
#include "include/cef_browser.h"
#include "include/wrapper/cef_helpers.h"
namespace client {
namespace dialog_test {
namespace {
const char kTestUrl[] = "http://tests/dialogs";
const char kFileOpenMessageName[] = "DialogTest.FileOpen";
const char kFileOpenMultipleMessageName[] = "DialogTest.FileOpenMultiple";
const char kFileOpenFolderMessageName[] = "DialogTest.FileOpenFolder";
const char kFileSaveMessageName[] = "DialogTest.FileSave";
#if defined(OS_WIN)
#define PATH_SEP '\\'
#else
#define PATH_SEP '/'
#endif
// Store persistent dialog state information.
class DialogState : public base::RefCountedThreadSafe<DialogState> {
public:
DialogState()
: mode_(FILE_DIALOG_OPEN),
last_selected_filter_(0),
pending_(false) {}
cef_file_dialog_mode_t mode_;
int last_selected_filter_;
CefString last_file_;
bool pending_;
DISALLOW_COPY_AND_ASSIGN(DialogState);
};
// Callback executed when the file dialog is dismissed.
class DialogCallback : public CefRunFileDialogCallback {
public:
DialogCallback(
CefRefPtr<CefMessageRouterBrowserSide::Callback> router_callback,
scoped_refptr<DialogState> dialog_state)
: router_callback_(router_callback),
dialog_state_(dialog_state) {
}
virtual void OnFileDialogDismissed(
int last_selected_filter,
const std::vector<CefString>& file_paths) OVERRIDE {
CEF_REQUIRE_UI_THREAD();
DCHECK(dialog_state_->pending_);
if (!file_paths.empty()) {
if (dialog_state_->mode_ != FILE_DIALOG_OPEN_FOLDER)
dialog_state_->last_selected_filter_ = last_selected_filter;
dialog_state_->last_file_ = file_paths[0];
if (dialog_state_->mode_ == FILE_DIALOG_OPEN_FOLDER) {
std::string last_file = dialog_state_->last_file_;
if (last_file[last_file.length() - 1] != PATH_SEP) {
// Add a trailing slash so we know it's a directory. Otherwise, file
// dialogs will think the last path component is a file name.
last_file += PATH_SEP;
dialog_state_->last_file_ = last_file;
}
}
}
// Send a message back to the render process with the list of file paths.
std::string response;
for (int i = 0; i < static_cast<int>(file_paths.size()); ++i) {
if (!response.empty())
response += "|"; // Use a delimiter disallowed in file paths.
response += file_paths[i];
}
router_callback_->Success(response);
router_callback_ = NULL;
dialog_state_->pending_ = false;
dialog_state_ = NULL;
}
private:
CefRefPtr<CefMessageRouterBrowserSide::Callback> router_callback_;
scoped_refptr<DialogState> dialog_state_;
IMPLEMENT_REFCOUNTING(DialogCallback);
DISALLOW_COPY_AND_ASSIGN(DialogCallback);
};
// Handle messages in the browser process.
class Handler : public CefMessageRouterBrowserSide::Handler {
public:
Handler() {}
// Called due to cefQuery execution in dialogs.html.
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int64 query_id,
const CefString& request,
bool persistent,
CefRefPtr<Callback> callback) OVERRIDE {
CEF_REQUIRE_UI_THREAD();
// Only handle messages from the test URL.
const std::string& url = frame->GetURL();
if (url.find(kTestUrl) != 0)
return false;
if (!dialog_state_.get())
dialog_state_ = new DialogState;
// Make sure we're only running one dialog at a time.
DCHECK(!dialog_state_->pending_);
std::vector<CefString> accept_filters;
std::string title;
const std::string& message_name = request;
if (message_name == kFileOpenMessageName) {
dialog_state_->mode_ = FILE_DIALOG_OPEN;
title = "My Open Dialog";
} else if (message_name == kFileOpenMultipleMessageName) {
dialog_state_->mode_ = FILE_DIALOG_OPEN_MULTIPLE;
title = "My Open Multiple Dialog";
} else if (message_name == kFileOpenFolderMessageName) {
dialog_state_->mode_ = FILE_DIALOG_OPEN_FOLDER;
title = "My Open Folder Dialog";
} else if (message_name == kFileSaveMessageName) {
dialog_state_->mode_ = static_cast<cef_file_dialog_mode_t>(
FILE_DIALOG_SAVE | FILE_DIALOG_OVERWRITEPROMPT_FLAG);
title = "My Save Dialog";
} else {
NOTREACHED();
return true;
}
if (dialog_state_->mode_ != FILE_DIALOG_OPEN_FOLDER) {
// Build filters based on mime time.
accept_filters.push_back("text/*");
// Build filters based on file extension.
accept_filters.push_back(".log");
accept_filters.push_back(".patch");
// Add specific filters as-is.
accept_filters.push_back("Document Files|.doc;.odt");
accept_filters.push_back("Image Files|.png;.jpg;.gif");
accept_filters.push_back("PDF Files|.pdf");
}
dialog_state_->pending_ = true;
browser->GetHost()->RunFileDialog(
dialog_state_->mode_,
title,
dialog_state_->last_file_,
accept_filters,
dialog_state_->last_selected_filter_,
new DialogCallback(callback, dialog_state_));
return true;
}
private:
scoped_refptr<DialogState> dialog_state_;
DISALLOW_COPY_AND_ASSIGN(Handler);
};
} // namespace
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) {
handlers.insert(new Handler());
}
} // namespace dialog_test
} // namespace client

View File

@ -0,0 +1,20 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_DIALOG_TEST_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_DIALOG_TEST_H_
#pragma once
#include "cefclient/browser/test_runner.h"
namespace client {
namespace dialog_test {
// Create message handlers. Called from test_runner.cc.
void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers);
} // namespace dialog_test
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_DIALOG_TEST_H_

Some files were not shown because too many files have changed in this diff Show More