├── LICENSE
├── README.md
├── build
└── Release
│ ├── cef.pak
│ ├── d3dcompiler_43.dll
│ ├── d3dcompiler_46.dll
│ ├── debug.log
│ ├── devtools_resources.pak
│ ├── doomtool.exe
│ ├── doomtool.pdb
│ ├── ffmpegsumo.dll
│ ├── icudt.dll
│ ├── libEGL.dll
│ ├── libGLESv2.dll
│ ├── libcef.dll
│ └── locales
│ ├── am.pak
│ ├── ar.pak
│ ├── bg.pak
│ ├── bn.pak
│ ├── ca.pak
│ ├── cs.pak
│ ├── da.pak
│ ├── de.pak
│ ├── el.pak
│ ├── en-GB.pak
│ ├── en-US.pak
│ ├── es-419.pak
│ ├── es.pak
│ ├── et.pak
│ ├── fa.pak
│ ├── fi.pak
│ ├── fil.pak
│ ├── fr.pak
│ ├── gu.pak
│ ├── he.pak
│ ├── hi.pak
│ ├── hr.pak
│ ├── hu.pak
│ ├── id.pak
│ ├── it.pak
│ ├── ja.pak
│ ├── kn.pak
│ ├── ko.pak
│ ├── lt.pak
│ ├── lv.pak
│ ├── ml.pak
│ ├── mr.pak
│ ├── ms.pak
│ ├── nb.pak
│ ├── nl.pak
│ ├── pl.pak
│ ├── pt-BR.pak
│ ├── pt-PT.pak
│ ├── ro.pak
│ ├── ru.pak
│ ├── sk.pak
│ ├── sl.pak
│ ├── sr.pak
│ ├── sv.pak
│ ├── sw.pak
│ ├── ta.pak
│ ├── te.pak
│ ├── th.pak
│ ├── tr.pak
│ ├── uk.pak
│ ├── vi.pak
│ ├── zh-CN.pak
│ └── zh-TW.pak
├── cef-based-ui.gif
├── doomtool.sln
├── doomtool.vcxproj
├── doomtool
├── README-TRANSFER.txt
├── cefclient.aps
├── cefclient.rc
├── cefclient_module.h
├── cefclient_osr_widget_win.cpp
├── cefclient_osr_widget_win.h
├── cefclient_win.cpp
├── client_app.cpp
├── client_app.h
├── client_app_delegates.cpp
├── client_handler.cpp
├── client_handler.h
├── client_handler_win.cpp
├── client_renderer.cpp
├── client_renderer.h
├── client_switches.cpp
├── client_switches.h
├── compatibility.manifest
├── doomtool.exe.manifest
├── extensions
│ ├── cefclient_extensions_require.cpp
│ ├── cefclient_extensions_require.h
│ ├── cefclient_extensions_require_win.cpp
│ ├── cefclient_extensions_window.cpp
│ ├── cefclient_extensions_window.h
│ └── cefclient_extensions_window_win.cpp
├── osrenderer.cpp
├── osrenderer.h
├── res
│ ├── doomtool.ico
│ ├── window.html
│ └── window.js
├── resource.h
├── resource_util.h
├── resource_util_win.cpp
├── scheme_test.cpp
├── scheme_test.h
├── string_util.cpp
├── string_util.h
├── util.h
├── window_test.cpp
├── window_test.h
└── window_test_win.cpp
└── index.html
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # cef3-window-sample
2 |
3 | [Chromium Embedded Framework 3](http://bitbucket.org/chromiumembedded/cef) offscreen rendering example on windows.
4 | GUI and animation build with html/css3.
5 |
6 | 
7 |
8 | ## Install
9 |
10 | ```sh
11 | $ git clone https://github.com/teaegg/cef3-windows-sample.git
12 | ```
13 |
14 | Or [download as ZIP](https://github.com/teaegg/cef3-windows-sample/archive/master.zip).
15 |
16 | 1. open doomtool.vcxproj with vs2010+.
17 | 2. build
18 |
19 | Or run the doomtool.exe in /cef3-windows-sample/build/Release/
20 |
21 | ## Contributing
22 |
23 | 1. Fork it!
24 | 2. Create your feature branch: `git checkout -b my-new-feature`
25 | 3. Commit your changes: `git commit -m 'Add some feature'`
26 | 4. Push to the branch: `git push origin my-new-feature`
27 | 5. Submit a pull request :D
28 |
29 | ## License
30 |
31 | [MIT License](https://github.com/teaegg/cef3-windows-sample/blob/master/README.md)
32 |
--------------------------------------------------------------------------------
/build/Release/cef.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/cef.pak
--------------------------------------------------------------------------------
/build/Release/d3dcompiler_43.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/d3dcompiler_43.dll
--------------------------------------------------------------------------------
/build/Release/d3dcompiler_46.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/d3dcompiler_46.dll
--------------------------------------------------------------------------------
/build/Release/debug.log:
--------------------------------------------------------------------------------
1 | [0129/163508:ERROR:child_process_launcher.cc(327)] Failed to launch child process
2 | [0129/163508:ERROR:child_process_launcher.cc(327)] Failed to launch child process
3 | [0129/170621:INFO:CONSOLE(0)] "Uncaught TypeError: Object 2 has no method 'addEventListener'", source: http://localhost/ (0)
4 | [0129/170642:INFO:CONSOLE(0)] "Uncaught TypeError: Object 2 has no method 'addEventListener'", source: http://localhost/ (0)
5 | [0129/170711:INFO:CONSOLE(0)] "Uncaught TypeError: Object 0 has no method 'addEventListener'", source: https://www.google.ca/?gfe_rd=cr&ei=PNnKVJC7BsermAK8i4DQCQ&gws_rd=ssl (0)
6 | [0129/170716:INFO:CONSOLE(0)] "Uncaught TypeError: Object 2 has no method 'addEventListener'", source: http://localhost/ (0)
7 |
--------------------------------------------------------------------------------
/build/Release/devtools_resources.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/devtools_resources.pak
--------------------------------------------------------------------------------
/build/Release/doomtool.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/doomtool.exe
--------------------------------------------------------------------------------
/build/Release/doomtool.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/doomtool.pdb
--------------------------------------------------------------------------------
/build/Release/ffmpegsumo.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/ffmpegsumo.dll
--------------------------------------------------------------------------------
/build/Release/icudt.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/icudt.dll
--------------------------------------------------------------------------------
/build/Release/libEGL.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/libEGL.dll
--------------------------------------------------------------------------------
/build/Release/libGLESv2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/libGLESv2.dll
--------------------------------------------------------------------------------
/build/Release/libcef.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/libcef.dll
--------------------------------------------------------------------------------
/build/Release/locales/am.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/am.pak
--------------------------------------------------------------------------------
/build/Release/locales/ar.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ar.pak
--------------------------------------------------------------------------------
/build/Release/locales/bg.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/bg.pak
--------------------------------------------------------------------------------
/build/Release/locales/bn.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/bn.pak
--------------------------------------------------------------------------------
/build/Release/locales/ca.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ca.pak
--------------------------------------------------------------------------------
/build/Release/locales/cs.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/cs.pak
--------------------------------------------------------------------------------
/build/Release/locales/da.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/da.pak
--------------------------------------------------------------------------------
/build/Release/locales/de.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/de.pak
--------------------------------------------------------------------------------
/build/Release/locales/el.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/el.pak
--------------------------------------------------------------------------------
/build/Release/locales/en-GB.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/en-GB.pak
--------------------------------------------------------------------------------
/build/Release/locales/en-US.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/en-US.pak
--------------------------------------------------------------------------------
/build/Release/locales/es-419.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/es-419.pak
--------------------------------------------------------------------------------
/build/Release/locales/es.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/es.pak
--------------------------------------------------------------------------------
/build/Release/locales/et.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/et.pak
--------------------------------------------------------------------------------
/build/Release/locales/fa.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/fa.pak
--------------------------------------------------------------------------------
/build/Release/locales/fi.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/fi.pak
--------------------------------------------------------------------------------
/build/Release/locales/fil.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/fil.pak
--------------------------------------------------------------------------------
/build/Release/locales/fr.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/fr.pak
--------------------------------------------------------------------------------
/build/Release/locales/gu.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/gu.pak
--------------------------------------------------------------------------------
/build/Release/locales/he.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/he.pak
--------------------------------------------------------------------------------
/build/Release/locales/hi.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/hi.pak
--------------------------------------------------------------------------------
/build/Release/locales/hr.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/hr.pak
--------------------------------------------------------------------------------
/build/Release/locales/hu.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/hu.pak
--------------------------------------------------------------------------------
/build/Release/locales/id.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/id.pak
--------------------------------------------------------------------------------
/build/Release/locales/it.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/it.pak
--------------------------------------------------------------------------------
/build/Release/locales/ja.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ja.pak
--------------------------------------------------------------------------------
/build/Release/locales/kn.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/kn.pak
--------------------------------------------------------------------------------
/build/Release/locales/ko.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ko.pak
--------------------------------------------------------------------------------
/build/Release/locales/lt.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/lt.pak
--------------------------------------------------------------------------------
/build/Release/locales/lv.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/lv.pak
--------------------------------------------------------------------------------
/build/Release/locales/ml.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ml.pak
--------------------------------------------------------------------------------
/build/Release/locales/mr.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/mr.pak
--------------------------------------------------------------------------------
/build/Release/locales/ms.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ms.pak
--------------------------------------------------------------------------------
/build/Release/locales/nb.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/nb.pak
--------------------------------------------------------------------------------
/build/Release/locales/nl.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/nl.pak
--------------------------------------------------------------------------------
/build/Release/locales/pl.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/pl.pak
--------------------------------------------------------------------------------
/build/Release/locales/pt-BR.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/pt-BR.pak
--------------------------------------------------------------------------------
/build/Release/locales/pt-PT.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/pt-PT.pak
--------------------------------------------------------------------------------
/build/Release/locales/ro.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ro.pak
--------------------------------------------------------------------------------
/build/Release/locales/ru.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ru.pak
--------------------------------------------------------------------------------
/build/Release/locales/sk.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/sk.pak
--------------------------------------------------------------------------------
/build/Release/locales/sl.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/sl.pak
--------------------------------------------------------------------------------
/build/Release/locales/sr.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/sr.pak
--------------------------------------------------------------------------------
/build/Release/locales/sv.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/sv.pak
--------------------------------------------------------------------------------
/build/Release/locales/sw.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/sw.pak
--------------------------------------------------------------------------------
/build/Release/locales/ta.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/ta.pak
--------------------------------------------------------------------------------
/build/Release/locales/te.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/te.pak
--------------------------------------------------------------------------------
/build/Release/locales/th.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/th.pak
--------------------------------------------------------------------------------
/build/Release/locales/tr.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/tr.pak
--------------------------------------------------------------------------------
/build/Release/locales/uk.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/uk.pak
--------------------------------------------------------------------------------
/build/Release/locales/vi.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/vi.pak
--------------------------------------------------------------------------------
/build/Release/locales/zh-CN.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/zh-CN.pak
--------------------------------------------------------------------------------
/build/Release/locales/zh-TW.pak:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/build/Release/locales/zh-TW.pak
--------------------------------------------------------------------------------
/cef-based-ui.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/cef-based-ui.gif
--------------------------------------------------------------------------------
/doomtool.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doomtool", "doomtool.vcxproj", "{3A113CDF-838F-4E6F-97EA-BCD6975656D9}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {3A113CDF-838F-4E6F-97EA-BCD6975656D9}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {3A113CDF-838F-4E6F-97EA-BCD6975656D9}.Debug|Win32.Build.0 = Debug|Win32
14 | {3A113CDF-838F-4E6F-97EA-BCD6975656D9}.Release|Win32.ActiveCfg = Release|Win32
15 | {3A113CDF-838F-4E6F-97EA-BCD6975656D9}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/doomtool.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | {3A113CDF-838F-4E6F-97EA-BCD6975656D9}
63 | Win32Proj
64 | doomtool
65 |
66 |
67 |
68 | Application
69 | true
70 | Unicode
71 | v100
72 |
73 |
74 | Application
75 | false
76 | true
77 | Unicode
78 | v100
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | true
92 | build\$(Configuration)\
93 | $(OutDir)obj\$(ProjectName)\
94 |
95 |
96 | false
97 | build\$(Configuration)\
98 | $(OutDir)obj\$(ProjectName)\
99 | $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;
100 | $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib
101 |
102 |
103 |
104 | NotUsing
105 | Level4
106 | Disabled
107 | _DEBUG;ANGLE_DX11;_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_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_INPUT_SPEECH;ENABLE_NOTIFICATIONS;ENABLE_GPU=1;ENABLE_EGLIMAGE=1;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06020000;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_AUTOMATION=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=1;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;USING_CEF_SHARED;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;DYNAMIC_ANNOTATIONS_ENABLED=1;WTF_USE_DYNAMIC_ANNOTATIONS=1;%(PreprocessorDefinitions)
108 | MultiThreadedDebug
109 | /MP /we4389 %(AdditionalOptions)
110 | 4351;4355;4396;4503;4819;4100;4121;4125;4127;4130;4131;4189;4201;4238;4244;4245;4310;4428;4481;4505;4510;4512;4530;4610;4611;4701;4702;4706;4099;%(DisableSpecificWarnings)
111 | true
112 | ProgramDatabase
113 | doomtool\;cef\;%(AdditionalIncludeDirectories)
114 |
115 |
116 | Windows
117 | true
118 | wininet.lib;dnsapi.lib;version.lib;msimg32.lib;ws2_32.lib;usp10.lib;psapi.lib;dbghelp.lib;winmm.lib;shlwapi.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;comctl32.lib;rpcrt4.lib;opengl32.lib;glu32.lib;cef\$(Configuration)\libcef_dll_wrapper.lib;cef\$(Configuration)\libcef.lib;%(AdditionalDependencies)
119 | %(DelayLoadDLLs)
120 | /safeseh /dynamicbase /ignore:4199 /ignore:4221 /nxcompat /largeaddressaware %(AdditionalOptions)
121 |
122 |
123 | call xcopy /defy cef\$(Configuration)\*.dll $(OutDir)
124 | call xcopy /defy cef\Resources\* $(OutDir)
125 |
126 |
127 |
128 | doomtool/doomtool.exe.manifest;doomtool/compatibility.manifest %(AdditionalManifestFiles)
129 |
130 |
131 |
132 |
133 | Level4
134 | NotUsing
135 | MaxSpeed
136 | true
137 | true
138 | ANGLE_DX11;_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_LIBJPEG_TURBO=1;ENABLE_ONE_CLICK_SIGNIN;ENABLE_REMOTING=1;ENABLE_WEBRTC=1;ENABLE_PEPPER_CDMS;ENABLE_CONFIGURATION_POLICY;ENABLE_INPUT_SPEECH;ENABLE_NOTIFICATIONS;ENABLE_GPU=1;ENABLE_EGLIMAGE=1;__STD_C;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;NTDDI_VERSION=0x06020000;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_AUTOMATION=1;ENABLE_GOOGLE_NOW=1;CLD_VERSION=1;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;USING_CEF_SHARED;__STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;NDEBUG;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;%(PreprocessorDefinitions)
139 | MultiThreaded
140 | /MP /we4389 /Oy- %(AdditionalOptions)
141 | 4351;4355;4396;4503;4819;4100;4121;4125;4127;4130;4131;4189;4201;4238;4244;4245;4310;4428;4481;4505;4510;4512;4530;4610;4611;4701;4702;4706;4099;%(DisableSpecificWarnings)
142 | true
143 | ProgramDatabase
144 | doomtool\;cef\;%(AdditionalIncludeDirectories)
145 |
146 |
147 | Windows
148 | true
149 | true
150 | true
151 | wininet.lib;dnsapi.lib;version.lib;msimg32.lib;ws2_32.lib;usp10.lib;psapi.lib;dbghelp.lib;winmm.lib;shlwapi.lib;kernel32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;user32.lib;uuid.lib;odbc32.lib;odbccp32.lib;delayimp.lib;comctl32.lib;rpcrt4.lib;opengl32.lib;glu32.lib;cef\$(Configuration)\libcef_dll_wrapper.lib;cef\$(Configuration)\libcef.lib;%(AdditionalDependencies)
152 | %(DelayLoadDLLs)
153 | /safeseh /dynamicbase /ignore:4199 /ignore:4221 /nxcompat /largeaddressaware %(AdditionalOptions)
154 |
155 |
156 | call xcopy /defy cef\$(Configuration)\*.dll $(OutDir)
157 | call xcopy /defy cef\Resources\* $(OutDir)
158 |
159 |
160 |
161 | doomtool/doomtool.exe.manifest;doomtool/compatibility.manifest %(AdditionalManifestFiles)
162 |
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/doomtool/README-TRANSFER.txt:
--------------------------------------------------------------------------------
1 | Files in this directory have been copied from other locations in the Chromium
2 | source tree. They have been modified only to the extent necessary to work in
3 | the CEF Binary Distribution directory structure. Below is a listing of the
4 | original file locations.
5 |
6 | ../build/win/compatibility.manifest
7 |
--------------------------------------------------------------------------------
/doomtool/cefclient.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teaegg/cef3-windows-sample/253e3f00cb3c82ca3ce4bcc5cb6cc56f026c40c0/doomtool/cefclient.aps
--------------------------------------------------------------------------------
/doomtool/cefclient.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #define APSTUDIO_HIDDEN_SYMBOLS
11 | #include "windows.h"
12 | #undef APSTUDIO_HIDDEN_SYMBOLS
13 |
14 | /////////////////////////////////////////////////////////////////////////////
15 | #undef APSTUDIO_READONLY_SYMBOLS
16 |
17 | /////////////////////////////////////////////////////////////////////////////
18 | // English (United States) resources
19 |
20 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
21 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
22 | #pragma code_page(1252)
23 |
24 | /////////////////////////////////////////////////////////////////////////////
25 | //
26 | // Icon
27 | //
28 |
29 | // Icon with lowest ID value placed first to ensure application icon
30 | // remains consistent on all systems.
31 | IDI_DOOMTOOL ICON "res\\doomtool.ico"
32 |
33 | #ifdef APSTUDIO_INVOKED
34 | /////////////////////////////////////////////////////////////////////////////
35 | //
36 | // TEXTINCLUDE
37 | //
38 |
39 | 1 TEXTINCLUDE
40 | BEGIN
41 | "resource.h\0"
42 | END
43 |
44 | 2 TEXTINCLUDE
45 | BEGIN
46 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
47 | "#include ""windows.h""\r\n"
48 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
49 | "\0"
50 | END
51 |
52 | 3 TEXTINCLUDE
53 | BEGIN
54 | "\r\n"
55 | "\0"
56 | END
57 |
58 | #endif // APSTUDIO_INVOKED
59 |
60 |
61 | /////////////////////////////////////////////////////////////////////////////
62 | //
63 | // 256
64 | //
65 |
66 | IDS_WINDOW 256 "res\\window.html"
67 | IDS_WINDOW_JS 256 "res\\window.js"
68 | #endif // English (United States) resources
69 | /////////////////////////////////////////////////////////////////////////////
70 |
71 |
72 |
73 | #ifndef APSTUDIO_INVOKED
74 | /////////////////////////////////////////////////////////////////////////////
75 | //
76 | // Generated from the TEXTINCLUDE 3 resource.
77 | //
78 |
79 |
80 | /////////////////////////////////////////////////////////////////////////////
81 | #endif // not APSTUDIO_INVOKED
82 |
83 |
--------------------------------------------------------------------------------
/doomtool/cefclient_module.h:
--------------------------------------------------------------------------------
1 | #ifndef CEF_TESTS_CEFCLIENT_MODULE_H_
2 | #define CEF_TESTS_CEFCLIENT_MODULE_H_
3 |
4 | #include "include/cef_base.h"
5 |
6 | class CefV8Module : public virtual CefBase {
7 | public:
8 | ///
9 | // Called to retrieve the module name.
10 | // Return true if the directory was provided.
11 | ///
12 | virtual bool GetModuleName(CefString& name) { return false; }
13 |
14 | ///
15 | // Called to retrieve the module version.
16 | // Return true if the directory was provided.
17 | ///
18 | virtual bool GetModuleVersion(CefString& version) { return false; }
19 |
20 | ///
21 | // Called to retrieve the module Dependents.
22 | // Return true if the directory was provided.
23 | ///
24 | //virtual bool GetModuleDependents(std::vector& deps) { return false; }
25 |
26 | ///
27 | // Called when the module manager wants to load the module.
28 | // Return true if the directory was provided.
29 | ///
30 | virtual bool OnExecute(/*const CefV8ValueList& deps, */CefRefPtr& obj) { return false; }
31 | };
32 |
33 | #endif // CEF_TESTS_CEFCLIENT_MODULE_H_
--------------------------------------------------------------------------------
/doomtool/cefclient_osr_widget_win.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
2 | // reserved. Use of this source code is governed by a BSD-style license that
3 | // can be found in the LICENSE file.
4 |
5 | #include "cefclient_osr_widget_win.h"
6 |
7 | #include
8 |
9 | #include "include/cef_runnable.h"
10 | #include "resource.h"
11 | #include "util.h"
12 |
13 | // static
14 | CefRefPtr OSRWindow::Create(HINSTANCE hInst,
15 | OSRBrowserProvider* browser_provider,
16 | bool transparent) {
17 | ASSERT(browser_provider);
18 | if (!browser_provider)
19 | return NULL;
20 |
21 | return new OSRWindow(hInst, browser_provider, transparent);
22 | }
23 |
24 | // static
25 | CefRefPtr OSRWindow::From(
26 | CefRefPtr renderHandler) {
27 | return static_cast(renderHandler.get());
28 | }
29 |
30 | HWND OSRWindow::CreateWidget(HWND hWndParent, const RECT& rect, LPCTSTR windowName, LPCTSTR className) {
31 | //ASSERT(hInst_ == NULL);
32 |
33 | RegisterOSRClass(hInst_, className);
34 | HWND hWnd = ::CreateWindowEx(WS_EX_LAYERED, className, windowName,
35 | WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MINIMIZEBOX | WS_VISIBLE,
36 | rect.left, rect.top, rect.right, rect.bottom,
37 | hWndParent, 0, hInst_, 0);
38 |
39 | if (!hWnd)
40 | return 0;
41 |
42 | SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast(this));
43 | // Reference released in OnDestroyed().
44 | AddRef();
45 |
46 | return hWnd;
47 | }
48 |
49 | void OSRWindow::DestroyWidget() {
50 | //if (IsWindow(hWnd_))
51 | //DestroyWindow(hWnd_);
52 | }
53 |
54 | void OSRWindow::OnBeforeClose(CefRefPtr browser) {
55 | PostMessage(browser->GetHost()->GetWindowHandle(), WM_CLOSE, 0, 0);
56 | }
57 |
58 | bool OSRWindow::GetRootScreenRect(CefRefPtr browser,
59 | CefRect& rect) {
60 | RECT window_rect = {0};
61 | HWND root_window = GetAncestor(browser->GetHost()->GetWindowHandle(), GA_ROOT);
62 | if (::GetWindowRect(root_window, &window_rect)) {
63 | rect = CefRect(window_rect.left,
64 | window_rect.top,
65 | window_rect.right - window_rect.left,
66 | window_rect.bottom - window_rect.top);
67 | return true;
68 | }
69 | return false;
70 | }
71 |
72 | bool OSRWindow::GetViewRect(CefRefPtr browser,
73 | CefRect& rect) {
74 | RECT clientRect;
75 | if (!::GetClientRect(browser->GetHost()->GetWindowHandle(), &clientRect))
76 | return false;
77 | rect.x = rect.y = 0;
78 | rect.width = clientRect.right;
79 | rect.height = clientRect.bottom;
80 | return true;
81 | }
82 |
83 | bool OSRWindow::GetScreenPoint(CefRefPtr browser,
84 | int viewX,
85 | int viewY,
86 | int& screenX,
87 | int& screenY) {
88 | if (!::IsWindow(browser->GetHost()->GetWindowHandle()))
89 | return false;
90 |
91 | // Convert the point from view coordinates to actual screen coordinates.
92 | POINT screen_pt = {viewX, viewY};
93 | ClientToScreen(browser->GetHost()->GetWindowHandle(), &screen_pt);
94 | screenX = screen_pt.x;
95 | screenY = screen_pt.y;
96 | return true;
97 | }
98 |
99 | void OSRWindow::OnPopupShow(CefRefPtr browser,
100 | bool show) {
101 | if (!show) {
102 | CefRect dirty_rect = renderer_.popup_rect();
103 | renderer_.ClearPopupRects();
104 | browser->GetHost()->Invalidate(dirty_rect, PET_VIEW);
105 | }
106 | renderer_.OnPopupShow(browser, show);
107 | }
108 |
109 | void OSRWindow::OnPopupSize(CefRefPtr browser,
110 | const CefRect& rect) {
111 | renderer_.OnPopupSize(browser, rect);
112 | }
113 |
114 | void OSRWindow::OnPaint(CefRefPtr browser,
115 | PaintElementType type,
116 | const RectList& dirtyRects,
117 | const void* buffer,
118 | int width, int height) {
119 | /*if (painting_popup_) {
120 | renderer_.OnPaint(browser, type, dirtyRects, buffer, width, height);
121 | return;
122 | }
123 | if (!hDC_)
124 | EnableGL();
125 |
126 | wglMakeCurrent(hDC_, hRC_);
127 | renderer_.OnPaint(browser, type, dirtyRects, buffer, width, height);
128 | if (type == PET_VIEW && !renderer_.popup_rect().IsEmpty()) {
129 | painting_popup_ = true;
130 | CefRect client_popup_rect(0, 0,
131 | renderer_.popup_rect().width,
132 | renderer_.popup_rect().height);
133 | browser->GetHost()->Invalidate(client_popup_rect, PET_POPUP);
134 | painting_popup_ = false;
135 | }
136 | renderer_.Render();
137 | SwapBuffers(hDC_);*/
138 | //::OutputDebugStringA("ON PAINT");
139 | SIZE sz = {width, height};
140 | HWND hWnd = browser->GetHost()->GetWindowHandle();
141 | HDC hdc = GetDC(hWnd);
142 | HDC hMemDc = CreateCompatibleDC(hdc);
143 | HBITMAP hBitmap = CreateBitmap(width, height, 1, 32, buffer);
144 | HGDIOBJ hOldBitmap = SelectObject(hMemDc, hBitmap);
145 |
146 | BLENDFUNCTION _Blend;
147 | _Blend.BlendOp=AC_SRC_OVER;
148 | _Blend.BlendFlags=0;
149 | _Blend.AlphaFormat= AC_SRC_ALPHA;
150 | _Blend.SourceConstantAlpha=255;
151 |
152 | POINT pt = {0, 0};
153 |
154 | ::UpdateLayeredWindow(hWnd, NULL, NULL, &sz, hMemDc, &pt, 0, &_Blend, ULW_ALPHA);
155 |
156 | SelectObject(hMemDc, hOldBitmap);
157 | DeleteObject(hBitmap);
158 | DeleteDC(hMemDc);
159 | }
160 |
161 | void OSRWindow::OnCursorChange(CefRefPtr browser,
162 | CefCursorHandle cursor) {
163 | HWND hWnd = browser->GetHost()->GetWindowHandle();
164 | if (!::IsWindow(hWnd))
165 | return;
166 |
167 | // Change the plugin window's cursor.
168 | SetClassLongPtr(hWnd, GCLP_HCURSOR,
169 | static_cast(reinterpret_cast(cursor)));
170 | SetCursor(cursor);
171 | }
172 |
173 | void OSRWindow::Invalidate() {
174 | if (!CefCurrentlyOn(TID_UI)) {
175 | CefPostTask(TID_UI, NewCefRunnableMethod(this, &OSRWindow::Invalidate));
176 | return;
177 | }
178 |
179 | // Don't post another task if the previous task is still pending.
180 | if (render_task_pending_)
181 | return;
182 |
183 | render_task_pending_ = true;
184 |
185 | // Render at 30fps.
186 | static const int kRenderDelay = 1000 / 30;
187 | CefPostDelayedTask(TID_UI, NewCefRunnableMethod(this, &OSRWindow::Render),
188 | kRenderDelay);
189 | }
190 |
191 | OSRWindow::OSRWindow(HINSTANCE hInst, OSRBrowserProvider* browser_provider, bool transparent)
192 | : renderer_(transparent),
193 | browser_provider_(browser_provider),
194 | //hWnd_(NULL),
195 | hDC_(NULL),
196 | hRC_(NULL),
197 | hInst_(hInst),
198 | painting_popup_(false),
199 | render_task_pending_(false) {
200 | }
201 |
202 | OSRWindow::~OSRWindow() {
203 | DestroyWidget();
204 | }
205 |
206 | void OSRWindow::Render() {
207 | ASSERT(CefCurrentlyOn(TID_UI));
208 | if (render_task_pending_)
209 | render_task_pending_ = false;
210 |
211 | if (!hDC_)
212 | EnableGL();
213 |
214 | wglMakeCurrent(hDC_, hRC_);
215 | renderer_.Render();
216 | SwapBuffers(hDC_);
217 | }
218 |
219 | void OSRWindow::EnableGL() {
220 | /*ASSERT(CefCurrentlyOn(TID_UI));
221 |
222 | PIXELFORMATDESCRIPTOR pfd;
223 | int format;
224 |
225 | // Get the device context.
226 | hDC_ = GetDC(hWnd_);
227 |
228 | // Set the pixel format for the DC.
229 | ZeroMemory(&pfd, sizeof(pfd));
230 | pfd.nSize = sizeof(pfd);
231 | pfd.nVersion = 1;
232 | pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
233 | pfd.iPixelType = PFD_TYPE_RGBA;
234 | pfd.cColorBits = 24;
235 | pfd.cDepthBits = 16;
236 | pfd.iLayerType = PFD_MAIN_PLANE;
237 | format = ChoosePixelFormat(hDC_, &pfd);
238 | SetPixelFormat(hDC_, format, &pfd);
239 |
240 | // Create and enable the render context.
241 | hRC_ = wglCreateContext(hDC_);
242 | wglMakeCurrent(hDC_, hRC_);
243 |
244 | renderer_.Initialize();*/
245 | }
246 |
247 | void OSRWindow::DisableGL() {
248 | /*ASSERT(CefCurrentlyOn(TID_UI));
249 |
250 | if (!hDC_)
251 | return;
252 |
253 | renderer_.Cleanup();
254 |
255 | if (IsWindow(hWnd_)) {
256 | wglMakeCurrent(NULL, NULL);
257 | wglDeleteContext(hRC_);
258 | ReleaseDC(hWnd_, hDC_);
259 | }
260 |
261 | hDC_ = NULL;
262 | hRC_ = NULL;*/
263 | }
264 |
265 | void OSRWindow::OnDestroyed(HWND hWnd) {
266 | SetWindowLongPtr(hWnd, GWLP_USERDATA, 0L);
267 | CefRefPtr browser = browser_provider_->GetBrowser(hWnd);
268 | if (browser.get()) {
269 | // Notify the browser window that we would like to close it. This
270 | // will result in a call to ClientHandler::DoClose() if the
271 | // JavaScript 'onbeforeunload' event handler allows it.
272 | browser->GetHost()->CloseBrowser(false);
273 | }
274 | Release();
275 | }
276 |
277 | ATOM OSRWindow::RegisterOSRClass(HINSTANCE hInstance, LPCTSTR className) {
278 | WNDCLASSEX wcex;
279 |
280 | wcex.cbSize = sizeof(WNDCLASSEX);
281 | wcex.style = CS_OWNDC;
282 | wcex.lpfnWndProc = &OSRWindow::WndProc;
283 | wcex.cbClsExtra = 0;
284 | wcex.cbWndExtra = 0;
285 | wcex.hInstance = hInstance;
286 | wcex.hIcon = NULL;
287 | wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
288 | wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
289 | wcex.lpszMenuName = NULL;
290 | wcex.lpszClassName = className;
291 | wcex.hIconSm = NULL;
292 | return RegisterClassEx(&wcex);
293 | }
294 |
295 | bool OSRWindow::isKeyDown(WPARAM wparam) {
296 | return (GetKeyState(wparam) & 0x8000) != 0;
297 | }
298 |
299 | int OSRWindow::GetCefMouseModifiers(WPARAM wparam) {
300 | int modifiers = 0;
301 | if (wparam & MK_CONTROL)
302 | modifiers |= EVENTFLAG_CONTROL_DOWN;
303 | if (wparam & MK_SHIFT)
304 | modifiers |= EVENTFLAG_SHIFT_DOWN;
305 | if (isKeyDown(VK_MENU))
306 | modifiers |= EVENTFLAG_ALT_DOWN;
307 | if (wparam & MK_LBUTTON)
308 | modifiers |= EVENTFLAG_LEFT_MOUSE_BUTTON;
309 | if (wparam & MK_MBUTTON)
310 | modifiers |= EVENTFLAG_MIDDLE_MOUSE_BUTTON;
311 | if (wparam & MK_RBUTTON)
312 | modifiers |= EVENTFLAG_RIGHT_MOUSE_BUTTON;
313 |
314 | // Low bit set from GetKeyState indicates "toggled".
315 | if (::GetKeyState(VK_NUMLOCK) & 1)
316 | modifiers |= EVENTFLAG_NUM_LOCK_ON;
317 | if (::GetKeyState(VK_CAPITAL) & 1)
318 | modifiers |= EVENTFLAG_CAPS_LOCK_ON;
319 | return modifiers;
320 | }
321 |
322 | int OSRWindow::GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam) {
323 | int modifiers = 0;
324 | if (isKeyDown(VK_SHIFT))
325 | modifiers |= EVENTFLAG_SHIFT_DOWN;
326 | if (isKeyDown(VK_CONTROL))
327 | modifiers |= EVENTFLAG_CONTROL_DOWN;
328 | if (isKeyDown(VK_MENU))
329 | modifiers |= EVENTFLAG_ALT_DOWN;
330 |
331 | // Low bit set from GetKeyState indicates "toggled".
332 | if (::GetKeyState(VK_NUMLOCK) & 1)
333 | modifiers |= EVENTFLAG_NUM_LOCK_ON;
334 | if (::GetKeyState(VK_CAPITAL) & 1)
335 | modifiers |= EVENTFLAG_CAPS_LOCK_ON;
336 |
337 | switch (wparam) {
338 | case VK_RETURN:
339 | if ((lparam >> 16) & KF_EXTENDED)
340 | modifiers |= EVENTFLAG_IS_KEY_PAD;
341 | break;
342 | case VK_INSERT:
343 | case VK_DELETE:
344 | case VK_HOME:
345 | case VK_END:
346 | case VK_PRIOR:
347 | case VK_NEXT:
348 | case VK_UP:
349 | case VK_DOWN:
350 | case VK_LEFT:
351 | case VK_RIGHT:
352 | if (!((lparam >> 16) & KF_EXTENDED))
353 | modifiers |= EVENTFLAG_IS_KEY_PAD;
354 | break;
355 | case VK_NUMLOCK:
356 | case VK_NUMPAD0:
357 | case VK_NUMPAD1:
358 | case VK_NUMPAD2:
359 | case VK_NUMPAD3:
360 | case VK_NUMPAD4:
361 | case VK_NUMPAD5:
362 | case VK_NUMPAD6:
363 | case VK_NUMPAD7:
364 | case VK_NUMPAD8:
365 | case VK_NUMPAD9:
366 | case VK_DIVIDE:
367 | case VK_MULTIPLY:
368 | case VK_SUBTRACT:
369 | case VK_ADD:
370 | case VK_DECIMAL:
371 | case VK_CLEAR:
372 | modifiers |= EVENTFLAG_IS_KEY_PAD;
373 | break;
374 | case VK_SHIFT:
375 | if (isKeyDown(VK_LSHIFT))
376 | modifiers |= EVENTFLAG_IS_LEFT;
377 | else if (isKeyDown(VK_RSHIFT))
378 | modifiers |= EVENTFLAG_IS_RIGHT;
379 | break;
380 | case VK_CONTROL:
381 | if (isKeyDown(VK_LCONTROL))
382 | modifiers |= EVENTFLAG_IS_LEFT;
383 | else if (isKeyDown(VK_RCONTROL))
384 | modifiers |= EVENTFLAG_IS_RIGHT;
385 | break;
386 | case VK_MENU:
387 | if (isKeyDown(VK_LMENU))
388 | modifiers |= EVENTFLAG_IS_LEFT;
389 | else if (isKeyDown(VK_RMENU))
390 | modifiers |= EVENTFLAG_IS_RIGHT;
391 | break;
392 | case VK_LWIN:
393 | modifiers |= EVENTFLAG_IS_LEFT;
394 | break;
395 | case VK_RWIN:
396 | modifiers |= EVENTFLAG_IS_RIGHT;
397 | break;
398 | }
399 | return modifiers;
400 | }
401 |
402 | bool OSRWindow::IsOverPopupWidget(int x, int y) const {
403 | const CefRect& rc = renderer_.popup_rect();
404 | int popup_right = rc.x + rc.width;
405 | int popup_bottom = rc.y + rc.height;
406 | return (x >= rc.x) && (x < popup_right) &&
407 | (y >= rc.y) && (y < popup_bottom);
408 | }
409 |
410 | int OSRWindow::GetPopupXOffset() const {
411 | return renderer_.original_popup_rect().x - renderer_.popup_rect().x;
412 | }
413 |
414 | int OSRWindow::GetPopupYOffset() const {
415 | return renderer_.original_popup_rect().y - renderer_.popup_rect().y;
416 | }
417 |
418 | void OSRWindow::ApplyPopupOffset(int& x, int& y) const {
419 | if (IsOverPopupWidget(x, y)) {
420 | x += GetPopupXOffset();
421 | y += GetPopupYOffset();
422 | }
423 | }
424 |
425 | // Plugin window procedure.
426 | // static
427 | LRESULT CALLBACK OSRWindow::WndProc(HWND hWnd, UINT message,
428 | WPARAM wParam, LPARAM lParam) {
429 | static POINT lastMousePos, curMousePos;
430 | static bool mouseRotation = false;
431 | static bool mouseTracking = false;
432 |
433 | static int lastClickX = 0;
434 | static int lastClickY = 0;
435 | static CefBrowserHost::MouseButtonType lastClickButton = MBT_LEFT;
436 | static int gLastClickCount = 0;
437 | static double gLastClickTime = 0;
438 |
439 | static bool gLastMouseDownOnView = false;
440 |
441 | OSRWindow* window =
442 | reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA));
443 |
444 | CefRefPtr browser;
445 | if (window && window->browser_provider_->GetBrowser(hWnd).get())
446 | browser = window->browser_provider_->GetBrowser(hWnd)->GetHost();
447 |
448 | LONG currentTime = 0;
449 | bool cancelPreviousClick = false;
450 |
451 | if (message == WM_LBUTTONDOWN || message == WM_RBUTTONDOWN ||
452 | message == WM_MBUTTONDOWN || message == WM_MOUSEMOVE ||
453 | message == WM_MOUSELEAVE) {
454 | currentTime = GetMessageTime();
455 | int x = GET_X_LPARAM(lParam);
456 | int y = GET_Y_LPARAM(lParam);
457 | cancelPreviousClick =
458 | (abs(lastClickX - x) > (GetSystemMetrics(SM_CXDOUBLECLK) / 2))
459 | || (abs(lastClickY - y) > (GetSystemMetrics(SM_CYDOUBLECLK) / 2))
460 | || ((currentTime - gLastClickTime) > GetDoubleClickTime());
461 | if (cancelPreviousClick &&
462 | (message == WM_MOUSEMOVE || message == WM_MOUSELEAVE)) {
463 | gLastClickCount = 0;
464 | lastClickX = 0;
465 | lastClickY = 0;
466 | gLastClickTime = 0;
467 | }
468 | }
469 |
470 | switch (message) {
471 | case WM_SYSCOMMAND: {
472 | switch(wParam) {
473 | case SC_MINIMIZE: {
474 | ::MessageBox(NULL, L"minimize", NULL, 0);
475 | return 0;
476 | }
477 | case SC_MAXIMIZE: {
478 | ::MessageBox(NULL, L"maximize", NULL, 0);
479 | }
480 | }
481 | }
482 | break;
483 | case WM_GETMINMAXINFO:
484 | {
485 | MINMAXINFO *lpMMI = (MINMAXINFO*)lParam;
486 | lpMMI->ptMaxSize.x = GetSystemMetrics(SM_CXFULLSCREEN);
487 | lpMMI->ptMaxSize.y = GetSystemMetrics(SM_CYFULLSCREEN) + GetSystemMetrics(SM_CYCAPTION);
488 | }
489 | break;
490 | case WM_DESTROY:
491 | if (window)
492 | window->OnDestroyed(hWnd);
493 | return 0;
494 |
495 | case WM_LBUTTONDOWN:
496 | case WM_RBUTTONDOWN:
497 | case WM_MBUTTONDOWN: {
498 | SetCapture(hWnd);
499 | SetFocus(hWnd);
500 | int x = GET_X_LPARAM(lParam);
501 | int y = GET_Y_LPARAM(lParam);
502 | if (wParam & MK_SHIFT) {
503 | // Start rotation effect.
504 | lastMousePos.x = curMousePos.x = x;
505 | lastMousePos.y = curMousePos.y = y;
506 | mouseRotation = true;
507 | } else {
508 | CefBrowserHost::MouseButtonType btnType =
509 | (message == WM_LBUTTONDOWN ? MBT_LEFT : (
510 | message == WM_RBUTTONDOWN ? MBT_RIGHT : MBT_MIDDLE));
511 | if (!cancelPreviousClick && (btnType == lastClickButton)) {
512 | ++gLastClickCount;
513 | } else {
514 | gLastClickCount = 1;
515 | lastClickX = x;
516 | lastClickY = y;
517 | }
518 | gLastClickTime = currentTime;
519 | lastClickButton = btnType;
520 |
521 | if (browser.get()) {
522 | CefMouseEvent mouse_event;
523 | mouse_event.x = x;
524 | mouse_event.y = y;
525 | gLastMouseDownOnView = !window->IsOverPopupWidget(x, y);
526 | window->ApplyPopupOffset(mouse_event.x, mouse_event.y);
527 | mouse_event.modifiers = GetCefMouseModifiers(wParam);
528 | browser->SendMouseClickEvent(mouse_event, btnType, false,
529 | gLastClickCount);
530 | }
531 | }
532 | break;
533 | }
534 |
535 | case WM_LBUTTONUP:
536 | case WM_RBUTTONUP:
537 | case WM_MBUTTONUP:
538 | if (GetCapture() == hWnd)
539 | ReleaseCapture();
540 | if (mouseRotation) {
541 | // End rotation effect.
542 | mouseRotation = false;
543 | window->renderer_.SetSpin(0, 0);
544 | window->Invalidate();
545 | } else {
546 | int x = GET_X_LPARAM(lParam);
547 | int y = GET_Y_LPARAM(lParam);
548 | CefBrowserHost::MouseButtonType btnType =
549 | (message == WM_LBUTTONUP ? MBT_LEFT : (
550 | message == WM_RBUTTONUP ? MBT_RIGHT : MBT_MIDDLE));
551 | if (browser.get()) {
552 | CefMouseEvent mouse_event;
553 | mouse_event.x = x;
554 | mouse_event.y = y;
555 | if (gLastMouseDownOnView &&
556 | window->IsOverPopupWidget(x, y) &&
557 | (window->GetPopupXOffset() || window->GetPopupYOffset())) {
558 | break;
559 | }
560 | window->ApplyPopupOffset(mouse_event.x, mouse_event.y);
561 | mouse_event.modifiers = GetCefMouseModifiers(wParam);
562 | browser->SendMouseClickEvent(mouse_event, btnType, true,
563 | gLastClickCount);
564 | }
565 | }
566 | break;
567 |
568 | case WM_MOUSEMOVE: {
569 | int x = GET_X_LPARAM(lParam);
570 | int y = GET_Y_LPARAM(lParam);
571 | if (mouseRotation) {
572 | // Apply rotation effect.
573 | curMousePos.x = x;
574 | curMousePos.y = y;
575 | window->renderer_.IncrementSpin((curMousePos.x - lastMousePos.x),
576 | (curMousePos.y - lastMousePos.y));
577 | lastMousePos.x = curMousePos.x;
578 | lastMousePos.y = curMousePos.y;
579 | window->Invalidate();
580 | } else {
581 | if (!mouseTracking) {
582 | // Start tracking mouse leave. Required for the WM_MOUSELEAVE event to
583 | // be generated.
584 | TRACKMOUSEEVENT tme;
585 | tme.cbSize = sizeof(TRACKMOUSEEVENT);
586 | tme.dwFlags = TME_LEAVE;
587 | tme.hwndTrack = hWnd;
588 | TrackMouseEvent(&tme);
589 | mouseTracking = true;
590 | }
591 | if (browser.get()) {
592 | CefMouseEvent mouse_event;
593 | mouse_event.x = x;
594 | mouse_event.y = y;
595 | window->ApplyPopupOffset(mouse_event.x, mouse_event.y);
596 | mouse_event.modifiers = GetCefMouseModifiers(wParam);
597 | browser->SendMouseMoveEvent(mouse_event, false);
598 | }
599 | }
600 | break;
601 | }
602 |
603 | case WM_MOUSELEAVE:
604 | if (mouseTracking) {
605 | // Stop tracking mouse leave.
606 | TRACKMOUSEEVENT tme;
607 | tme.cbSize = sizeof(TRACKMOUSEEVENT);
608 | tme.dwFlags = TME_LEAVE & TME_CANCEL;
609 | tme.hwndTrack = hWnd;
610 | TrackMouseEvent(&tme);
611 | mouseTracking = false;
612 | }
613 | if (browser.get()) {
614 | CefMouseEvent mouse_event;
615 | mouse_event.x = 0;
616 | mouse_event.y = 0;
617 | mouse_event.modifiers = GetCefMouseModifiers(wParam);
618 | browser->SendMouseMoveEvent(mouse_event, true);
619 | }
620 | break;
621 |
622 | case WM_MOUSEWHEEL:
623 | if (browser.get()) {
624 | POINT screen_point = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
625 | HWND scrolled_wnd = ::WindowFromPoint(screen_point);
626 | if (scrolled_wnd != hWnd) {
627 | break;
628 | }
629 | ScreenToClient(hWnd, &screen_point);
630 | int delta = GET_WHEEL_DELTA_WPARAM(wParam);
631 |
632 | CefMouseEvent mouse_event;
633 | mouse_event.x = screen_point.x;
634 | mouse_event.y = screen_point.y;
635 | window->ApplyPopupOffset(mouse_event.x, mouse_event.y);
636 | mouse_event.modifiers = GetCefMouseModifiers(wParam);
637 |
638 | browser->SendMouseWheelEvent(mouse_event,
639 | isKeyDown(VK_SHIFT) ? delta : 0,
640 | !isKeyDown(VK_SHIFT) ? delta : 0);
641 | }
642 | break;
643 |
644 | case WM_SIZE:
645 | if (browser.get())
646 | browser->WasResized();
647 | break;
648 |
649 | case WM_SETFOCUS:
650 | case WM_KILLFOCUS:
651 | if (browser.get())
652 | browser->SendFocusEvent(message == WM_SETFOCUS);
653 | break;
654 |
655 | case WM_CAPTURECHANGED:
656 | case WM_CANCELMODE:
657 | if (!mouseRotation) {
658 | if (browser.get())
659 | browser->SendCaptureLostEvent();
660 | }
661 | break;
662 | case WM_SYSCHAR:
663 | case WM_SYSKEYDOWN:
664 | case WM_SYSKEYUP:
665 | case WM_KEYDOWN:
666 | case WM_KEYUP:
667 | case WM_CHAR: {
668 | CefKeyEvent event;
669 | event.windows_key_code = wParam;
670 | event.native_key_code = lParam;
671 | event.is_system_key = message == WM_SYSCHAR ||
672 | message == WM_SYSKEYDOWN ||
673 | message == WM_SYSKEYUP;
674 |
675 | if (message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
676 | event.type = KEYEVENT_RAWKEYDOWN;
677 | else if (message == WM_KEYUP || message == WM_SYSKEYUP)
678 | event.type = KEYEVENT_KEYUP;
679 | else
680 | event.type = KEYEVENT_CHAR;
681 | event.modifiers = GetCefKeyboardModifiers(wParam, lParam);
682 | if (browser.get())
683 | browser->SendKeyEvent(event);
684 | break;
685 | }
686 |
687 | case WM_PAINT: {
688 | PAINTSTRUCT ps;
689 | RECT rc;
690 | BeginPaint(hWnd, &ps);
691 | rc = ps.rcPaint;
692 | EndPaint(hWnd, &ps);
693 | if (browser.get()) {
694 | browser->Invalidate(CefRect(rc.left,
695 | rc.top,
696 | rc.right - rc.left,
697 | rc.bottom - rc.top), PET_VIEW);
698 | }
699 | return 0;
700 | }
701 |
702 | case WM_ERASEBKGND:
703 | return 0;
704 |
705 | case ID_OPENMAINWINDOW: {
706 | RECT rect;
707 | rect.right = GetSystemMetrics(SM_CXFULLSCREEN);
708 | rect.bottom = GetSystemMetrics(SM_CYFULLSCREEN) + GetSystemMetrics(SM_CYCAPTION);
709 | rect.left = 0;
710 | rect.top = 0;
711 |
712 | HWND hWnd = window->CreateWidget(NULL, rect, L"DoomTool", L"DoomToolWnd");
713 | CefWindowInfo info;
714 | CefBrowserSettings browser_settings;
715 | info.SetAsOffScreen(hWnd);
716 | info.SetTransparentPainting(TRUE);
717 | CefBrowserHost::CreateBrowser(info, browser->GetClient().get(),
718 | L"http://localhost/", browser_settings, NULL);
719 | return 0;
720 | }
721 |
722 | }
723 |
724 | return DefWindowProc(hWnd, message, wParam, lParam);
725 | }
726 |
--------------------------------------------------------------------------------
/doomtool/cefclient_osr_widget_win.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
2 | // reserved. Use of this source code is governed by a BSD-style license that
3 | // can be found in the LICENSE file.
4 |
5 | #ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_WIN_H_
6 | #define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_WIN_H_
7 | #pragma once
8 |
9 | #include "include/cef_render_handler.h"
10 | #include "client_handler.h"
11 | #include "osrenderer.h"
12 |
13 | class OSRBrowserProvider {
14 | public:
15 | virtual CefRefPtr GetBrowser(HWND hWnd) =0;
16 |
17 | protected:
18 | virtual ~OSRBrowserProvider() {}
19 | };
20 |
21 | class OSRWindow : public ClientHandler::RenderHandler {
22 | public:
23 | // Create a new OSRWindow instance. |browser_provider| must outlive this
24 | // object.
25 | static CefRefPtr Create(HINSTANCE hInst,
26 | OSRBrowserProvider* browser_provider,
27 | bool transparent);
28 |
29 | static CefRefPtr From(
30 | CefRefPtr renderHandler);
31 |
32 | // Create the underlying window.
33 | HWND CreateWidget(HWND hWndParent, const RECT& rect, LPCTSTR windowName, LPCTSTR className);
34 |
35 | // Destroy the underlying window.
36 | void DestroyWidget();
37 |
38 | /*HWND hwnd() const {
39 | return hWnd_;
40 | }*/
41 |
42 | // ClientHandler::RenderHandler methods
43 | virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE;
44 |
45 | // CefRenderHandler methods
46 | virtual bool GetRootScreenRect(CefRefPtr browser,
47 | CefRect& rect) OVERRIDE;
48 | virtual bool GetViewRect(CefRefPtr browser,
49 | CefRect& rect) OVERRIDE;
50 | virtual bool GetScreenPoint(CefRefPtr browser,
51 | int viewX,
52 | int viewY,
53 | int& screenX,
54 | int& screenY) OVERRIDE;
55 | virtual void OnPopupShow(CefRefPtr browser,
56 | bool show) OVERRIDE;
57 | virtual void OnPopupSize(CefRefPtr browser,
58 | const CefRect& rect) OVERRIDE;
59 | virtual void OnPaint(CefRefPtr browser,
60 | PaintElementType type,
61 | const RectList& dirtyRects,
62 | const void* buffer,
63 | int width,
64 | int height) OVERRIDE;
65 | virtual void OnCursorChange(CefRefPtr browser,
66 | CefCursorHandle cursor) OVERRIDE;
67 |
68 | void Invalidate();
69 |
70 | private:
71 | OSRWindow(HINSTANCE hInst, OSRBrowserProvider* browser_provider, bool transparent);
72 | virtual ~OSRWindow();
73 |
74 | void Render();
75 | void EnableGL();
76 | void DisableGL();
77 | void OnDestroyed(HWND hWnd);
78 | static ATOM RegisterOSRClass(HINSTANCE hInstance, LPCTSTR className);
79 | static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
80 | LPARAM lParam);
81 | static int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
82 | static int GetCefMouseModifiers(WPARAM wparam);
83 | static bool isKeyDown(WPARAM wparam);
84 | bool IsOverPopupWidget(int x, int y) const;
85 | int GetPopupXOffset() const;
86 | int GetPopupYOffset() const;
87 | void ApplyPopupOffset(int& x, int& y) const;
88 |
89 | ClientOSRenderer renderer_;
90 | OSRBrowserProvider* browser_provider_;
91 | //HWND hWnd_;
92 | HDC hDC_;
93 | HGLRC hRC_;
94 | HINSTANCE hInst_;
95 |
96 | bool painting_popup_;
97 | bool render_task_pending_;
98 |
99 | IMPLEMENT_REFCOUNTING(OSRWindow);
100 | };
101 |
102 | #endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_WIDGET_WIN_H_
103 |
--------------------------------------------------------------------------------
/doomtool/cefclient_win.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
2 | // reserved. Use of this source code is governed by a BSD-style license that
3 | // can be found in the LICENSE file.
4 |
5 | #include
6 |
7 | #include "client_app.h"
8 | #include "cefclient_osr_widget_win.h"
9 | #include "resource.h"
10 |
11 | CefRefPtr g_handler;
12 |
13 | class MainBrowserProvider : public OSRBrowserProvider {
14 | virtual CefRefPtr GetBrowser(HWND hWnd) {
15 | if (g_handler.get())
16 | return g_handler->GetBrowser(hWnd);
17 |
18 | return NULL;
19 | }
20 | } g_main_browser_provider;
21 |
22 | // Entry point function for all processes.
23 | int APIENTRY wWinMain(HINSTANCE hInstance,
24 | HINSTANCE hPrevInstance,
25 | LPTSTR lpCmdLine,
26 | int nCmdShow) {
27 | UNREFERENCED_PARAMETER(hPrevInstance);
28 | UNREFERENCED_PARAMETER(lpCmdLine);
29 | //MessageBoxA(NULL, "main", NULL, 0);
30 | // Provide CEF with command-line arguments.
31 | CefMainArgs main_args(hInstance);
32 |
33 | // SimpleApp implements application-level callbacks. It will create the first
34 | // browser instance in OnContextInitialized() after CEF has initialized.
35 | CefRefPtr app(new ClientApp);
36 |
37 | // CEF applications have multiple sub-processes (render, plugin, GPU, etc)
38 | // that share the same executable. This function checks the command-line and,
39 | // if this is a sub-process, executes the appropriate logic.
40 | int exit_code = CefExecuteProcess(main_args, app.get());
41 | if (exit_code >= 0) {
42 | // The sub-process has completed so return here.
43 | return exit_code;
44 | }
45 |
46 | // Try to open the mutex.
47 | HANDLE hMutex = ::OpenMutex(MUTEX_ALL_ACCESS, 0, L"DoomToolInstance");
48 |
49 | // If hMutex is 0 then the mutex doesn't exist.
50 | if (!hMutex) {
51 | hMutex = ::CreateMutex(0, 0, L"DoomToolInstance");
52 | } else {
53 | // This is a second instance. Bring the
54 | // original instance to the top.
55 | HWND hWnd;
56 | hWnd = ::FindWindow(L"DoomToolWnd", NULL);
57 | if(hWnd) {
58 | ::SetForegroundWindow(hWnd);
59 | ::ShowWindow(hWnd, SW_RESTORE);
60 | } else {
61 | hWnd = ::FindWindow(L"DoomToolPopUpWnd", NULL);
62 | if(hWnd)
63 | ::PostMessage(hWnd ,ID_OPENMAINWINDOW, 0, 0);
64 | }
65 | return 0;
66 | }
67 |
68 | // Specify CEF global settings here.
69 | CefSettings settings;
70 | CefString(&settings.browser_subprocess_path).FromASCII("G:/project/doomtool/build/Release/doomtool.exe");
71 | // Initialize CEF.
72 | CefInitialize(main_args, settings, app.get());
73 |
74 | // Create the single static handler class instance
75 | g_handler = new ClientHandler();
76 |
77 | CefWindowInfo info;
78 | CefBrowserSettings browser_settings;
79 |
80 |
81 | CefRefPtr osr_window = OSRWindow::Create(hInstance, &g_main_browser_provider, TRUE);
82 |
83 | g_handler->SetOSRHandler(osr_window.get());
84 |
85 | RECT rect;
86 | rect.right = GetSystemMetrics(SM_CXFULLSCREEN);
87 | rect.bottom = GetSystemMetrics(SM_CYFULLSCREEN) + GetSystemMetrics(SM_CYCAPTION);
88 | rect.left = 0;
89 | rect.top = 0;
90 |
91 | HWND hWnd = osr_window->CreateWidget(NULL, rect, L"DoomTool", L"DoomToolWnd");
92 | CefWindowInfo info2;
93 | info2.SetAsOffScreen(hWnd);
94 | info2.SetTransparentPainting(TRUE);
95 | CefBrowserHost::CreateBrowser(info2, g_handler.get(),
96 | g_handler->GetStartupURL(), browser_settings, NULL);
97 |
98 | // Run the CEF message loop. This will block until CefQuitMessageLoop() is
99 | // called.
100 | CefRunMessageLoop();
101 |
102 | // Shut down CEF.
103 | CefShutdown();
104 |
105 | ReleaseMutex(hMutex);
106 |
107 | return 0;
108 | }
109 |
--------------------------------------------------------------------------------
/doomtool/client_app.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
2 | // reserved. Use of this source code is governed by a BSD-style license that
3 | // can be found in the LICENSE file.
4 |
5 | // This file is shared by cefclient and cef_unittests so don't include using
6 | // a qualified path.
7 | #include "client_app.h" // NOLINT(build/include)
8 | #include "client_handler.h"
9 |
10 | #include
11 |
12 | #include "include/cef_cookie.h"
13 | #include "include/cef_process_message.h"
14 | #include "include/cef_task.h"
15 | #include "include/cef_v8.h"
16 | #include "util.h" // NOLINT(build/include)
17 |
18 | ClientApp::ClientApp() {
19 | }
20 |
21 | void ClientApp::OnRegisterCustomSchemes(
22 | CefRefPtr registrar) {
23 | // Default schemes that support cookies.
24 | cookieable_schemes_.push_back("http");
25 | cookieable_schemes_.push_back("https");
26 |
27 | RegisterCustomSchemes(registrar, cookieable_schemes_);
28 | }
29 |
30 | void ClientApp::OnContextInitialized() {
31 | //REQUIRE_UI_THREAD();
32 |
33 | CreateBrowserDelegates(browser_delegates_);
34 |
35 | // Register cookieable schemes with the global cookie manager.
36 | CefRefPtr manager = CefCookieManager::GetGlobalManager();
37 | ASSERT(manager.get());
38 | manager->SetSupportedSchemes(cookieable_schemes_);
39 |
40 | BrowserDelegateSet::iterator it = browser_delegates_.begin();
41 | for (; it != browser_delegates_.end(); ++it)
42 | (*it)->OnContextInitialized(this);
43 | }
44 |
45 | void ClientApp::OnBeforeChildProcessLaunch(
46 | CefRefPtr command_line) {
47 | BrowserDelegateSet::iterator it = browser_delegates_.begin();
48 | for (; it != browser_delegates_.end(); ++it)
49 | (*it)->OnBeforeChildProcessLaunch(this, command_line);
50 | }
51 |
52 | void ClientApp::OnRenderProcessThreadCreated(
53 | CefRefPtr extra_info) {
54 | BrowserDelegateSet::iterator it = browser_delegates_.begin();
55 | for (; it != browser_delegates_.end(); ++it)
56 | (*it)->OnRenderProcessThreadCreated(this, extra_info);
57 | }
58 |
59 | void ClientApp::OnRenderThreadCreated(CefRefPtr extra_info) {
60 | CreateRenderDelegates(render_delegates_);
61 |
62 | RenderDelegateSet::iterator it = render_delegates_.begin();
63 | for (; it != render_delegates_.end(); ++it)
64 | (*it)->OnRenderThreadCreated(this, extra_info);
65 | }
66 |
67 | void ClientApp::OnWebKitInitialized() {
68 | RenderDelegateSet::iterator it = render_delegates_.begin();
69 | for (; it != render_delegates_.end(); ++it)
70 | (*it)->OnWebKitInitialized(this);
71 | }
72 |
73 | void ClientApp::OnBrowserCreated(CefRefPtr browser) {
74 | RenderDelegateSet::iterator it = render_delegates_.begin();
75 | for (; it != render_delegates_.end(); ++it)
76 | (*it)->OnBrowserCreated(this, browser);
77 | }
78 |
79 | void ClientApp::OnBrowserDestroyed(CefRefPtr browser) {
80 | RenderDelegateSet::iterator it = render_delegates_.begin();
81 | for (; it != render_delegates_.end(); ++it)
82 | (*it)->OnBrowserDestroyed(this, browser);
83 | }
84 |
85 | CefRefPtr ClientApp::GetLoadHandler() {
86 | CefRefPtr load_handler;
87 | RenderDelegateSet::iterator it = render_delegates_.begin();
88 | for (; it != render_delegates_.end() && !load_handler.get(); ++it)
89 | load_handler = (*it)->GetLoadHandler(this);
90 |
91 | return load_handler;
92 | }
93 |
94 | bool ClientApp::OnBeforeNavigation(CefRefPtr browser,
95 | CefRefPtr frame,
96 | CefRefPtr request,
97 | NavigationType navigation_type,
98 | bool is_redirect) {
99 | RenderDelegateSet::iterator it = render_delegates_.begin();
100 | for (; it != render_delegates_.end(); ++it) {
101 | if ((*it)->OnBeforeNavigation(this, browser, frame, request,
102 | navigation_type, is_redirect)) {
103 | return true;
104 | }
105 | }
106 |
107 | return false;
108 | }
109 |
110 | void ClientApp::OnContextCreated(CefRefPtr browser,
111 | CefRefPtr frame,
112 | CefRefPtr context) {
113 | RenderDelegateSet::iterator it = render_delegates_.begin();
114 | for (; it != render_delegates_.end(); ++it)
115 | (*it)->OnContextCreated(this, browser, frame, context);
116 | }
117 |
118 | void ClientApp::OnContextReleased(CefRefPtr browser,
119 | CefRefPtr frame,
120 | CefRefPtr context) {
121 | RenderDelegateSet::iterator it = render_delegates_.begin();
122 | for (; it != render_delegates_.end(); ++it)
123 | (*it)->OnContextReleased(this, browser, frame, context);
124 | }
125 |
126 | void ClientApp::OnUncaughtException(CefRefPtr browser,
127 | CefRefPtr frame,
128 | CefRefPtr context,
129 | CefRefPtr exception,
130 | CefRefPtr stackTrace) {
131 | RenderDelegateSet::iterator it = render_delegates_.begin();
132 | for (; it != render_delegates_.end(); ++it) {
133 | (*it)->OnUncaughtException(this, browser, frame, context, exception,
134 | stackTrace);
135 | }
136 | }
137 |
138 | void ClientApp::OnFocusedNodeChanged(CefRefPtr browser,
139 | CefRefPtr frame,
140 | CefRefPtr node) {
141 | RenderDelegateSet::iterator it = render_delegates_.begin();
142 | for (; it != render_delegates_.end(); ++it)
143 | (*it)->OnFocusedNodeChanged(this, browser, frame, node);
144 | }
145 |
146 | bool ClientApp::OnProcessMessageReceived(
147 | CefRefPtr browser,
148 | CefProcessId source_process,
149 | CefRefPtr message) {
150 | ASSERT(source_process == PID_BROWSER);
151 |
152 | bool handled = false;
153 |
154 | RenderDelegateSet::iterator it = render_delegates_.begin();
155 | for (; it != render_delegates_.end() && !handled; ++it) {
156 | handled = (*it)->OnProcessMessageReceived(this, browser, source_process,
157 | message);
158 | }
159 |
160 | return handled;
161 | }
162 |
--------------------------------------------------------------------------------
/doomtool/client_app.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
2 | // reserved. Use of this source code is governed by a BSD-style license that
3 | // can be found in the LICENSE file.
4 |
5 | #ifndef CEF_TESTS_CEFCLIENT_CLIENT_APP_H_
6 | #define CEF_TESTS_CEFCLIENT_CLIENT_APP_H_
7 | #pragma once
8 |
9 | #include