├── README.md
├── qcef3_1650.png
└── qcef3_1650
├── .gitattributes
├── .gitignore
├── cefclient.vcxproj
├── cefclient.vcxproj.filters
├── cefclient
├── cefclient.cpp
├── cefclient.h
├── cefclient_qt.cpp
├── client_app.cpp
├── client_app.h
├── client_app_delegates.cpp
├── client_app_js.h
├── client_binding.cpp
├── client_binding.h
├── client_handler.cpp
├── client_handler.h
├── client_handler_qt.cpp
├── client_renderer.cpp
├── client_renderer.h
├── client_transfer.cpp
├── client_transfer.h
├── message_event.cpp
├── message_event.h
├── qcefwebview.cpp
├── qcefwebview.h
└── util.h
├── cefclient_process.vcxproj
├── cefclient_process.vcxproj.filters
├── exclude.list
├── libcef_dll.vcxproj
├── libcef_dll.vcxproj.filters
├── main.cpp
├── main_process.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── move.bat
├── qcef3_1650.sln
└── www
└── SendMessage.html
/README.md:
--------------------------------------------------------------------------------
1 |
2 | A simple cef3 client with Qt.
3 |
4 | 
5 |
6 |
7 | Build
8 | -----
9 |
10 | * Qt 4.8.5
11 | * CEF 3.1650.1544
12 |
13 | You can download CEF3 here: [CEF3 Builds](http://cefbuilds.com/).
14 |
15 | * Extract the following and copy to `qcef3_1650/`.
16 |
17 | ```
18 | Debug/
19 | Release/
20 | include/
21 | Resources/
22 | libcef_dll/
23 | ```
24 |
25 | * Add environment variable: `QT_HOME`.
26 |
27 | * Open `qcef3_1650/qcef3_1650.sln`, then build. (VS 2010)
28 |
29 |
30 | Project
31 | -------
32 |
33 | * cefclient
34 | - the main cef3 client project
35 | * cefclient_process
36 | - a separate sub-process executable project
37 | - `SUB_PROCESS_DISABLED` option in `cefclient.cpp`
38 | * libcef_dll
39 | - cef3's c++ wrapper
40 |
--------------------------------------------------------------------------------
/qcef3_1650.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joinAero/qtcefclient/9164b5e658a23f580539b89d453c0f13b88b49ff/qcef3_1650.png
--------------------------------------------------------------------------------
/qcef3_1650/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/qcef3_1650/.gitignore:
--------------------------------------------------------------------------------
1 | out/
2 |
3 | # CEF
4 | Debug/
5 | Release/
6 | include/
7 | Resources/
8 | libcef_dll/
9 |
10 | # Qt
11 | GeneratedFiles/
12 |
13 | #################
14 | ## Eclipse
15 | #################
16 |
17 | *.pydevproject
18 | # .project
19 | .metadata
20 | bin/
21 | gen/
22 | tmp/
23 | *.tmp
24 | *.bak
25 | *.swp
26 | *~.nib
27 | # local.properties
28 | # .classpath
29 | .settings/
30 | .loadpath
31 |
32 | # External tool builders
33 | .externalToolBuilders/
34 |
35 | # Locally stored "Eclipse launch configurations"
36 | *.launch
37 |
38 | # CDT-specific
39 | .cproject
40 |
41 | # PDT-specific
42 | .buildpath
43 |
44 |
45 | #################
46 | ## Visual Studio
47 | #################
48 |
49 | ## Ignore Visual Studio temporary files, build results, and
50 | ## files generated by popular Visual Studio add-ons.
51 |
52 | # User-specific files
53 | *.suo
54 | *.user
55 | *.sln.docstates
56 |
57 | # Build results
58 | [Dd]ebug/
59 | [Rr]elease/
60 | *_i.c
61 | *_p.c
62 | *.ilk
63 | *.meta
64 | *.obj
65 | *.pch
66 | *.pdb
67 | *.pgc
68 | *.pgd
69 | *.rsp
70 | *.sbr
71 | *.tlb
72 | *.tli
73 | *.tlh
74 | *.tmp
75 | *.vspscc
76 | .builds
77 | *.dotCover
78 |
79 | ## TODO: If you have NuGet Package Restore enabled, uncomment this
80 | #packages/
81 |
82 | # Visual C++ cache files
83 | ipch/
84 | *.aps
85 | *.ncb
86 | *.opensdf
87 | *.sdf
88 |
89 | # Visual Studio profiler
90 | *.psess
91 | *.vsp
92 |
93 | # ReSharper is a .NET coding add-in
94 | _ReSharper*
95 |
96 | # Installshield output folder
97 | [Ee]xpress
98 |
99 | # DocProject is a documentation generator add-in
100 | DocProject/buildhelp/
101 | DocProject/Help/*.HxT
102 | DocProject/Help/*.HxC
103 | DocProject/Help/*.hhc
104 | DocProject/Help/*.hhk
105 | DocProject/Help/*.hhp
106 | DocProject/Help/Html2
107 | DocProject/Help/html
108 |
109 | # Click-Once directory
110 | publish
111 |
112 | # Others
113 | [Bb]in
114 | [Oo]bj
115 | sql
116 | TestResults
117 | *.Cache
118 | ClientBin
119 | stylecop.*
120 | ~$*
121 | *.dbmdl
122 | Generated_Code #added for RIA/Silverlight projects
123 |
124 | # Backup & report files from converting an old project file to a newer
125 | # Visual Studio version. Backup files are not needed, because we have git ;-)
126 | _UpgradeReport_Files/
127 | Backup*/
128 | UpgradeLog*.XML
129 |
130 |
131 |
132 | ############
133 | ## Windows
134 | ############
135 |
136 | # Windows image file caches
137 | Thumbs.db
138 |
139 | # Folder config file
140 | Desktop.ini
141 |
142 |
143 | #############
144 | ## Python
145 | #############
146 |
147 | *.py[co]
148 |
149 | # Packages
150 | *.egg
151 | *.egg-info
152 | dist
153 | build
154 | eggs
155 | parts
156 | bin
157 | var
158 | sdist
159 | develop-eggs
160 | .installed.cfg
161 |
162 | # Installer logs
163 | pip-log.txt
164 |
165 | # Unit test / coverage reports
166 | .coverage
167 | .tox
168 |
169 | #Translations
170 | *.mo
171 |
172 | #Mr Developer
173 | .mr.developer.cfg
174 |
175 | # Mac crap
176 | .DS_Store
177 |
--------------------------------------------------------------------------------
/qcef3_1650/cefclient.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {43CC1856-8F29-41E5-89ED-0CE19DFF8350}
15 | Qt4VSv1.0
16 |
17 |
18 |
19 | Application
20 | Unicode
21 |
22 |
23 | Application
24 | Unicode
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | <_ProjectFileVersion>10.0.40219.1
38 | AllRules.ruleset
39 |
40 |
41 | AllRules.ruleset
42 |
43 |
44 | $(SolutionDir)out\$(Configuration)\
45 | $(SolutionDir)out\$(Configuration)\
46 | $(SolutionDir)out\$(ProjectName)\$(Configuration)\
47 | $(SolutionDir)out\$(ProjectName)\$(Configuration)\
48 |
49 |
50 |
51 | UNICODE;WIN32;NOMINMAX;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions)
52 | .;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);$(SolutionDir);$(QT_HOME)\include;$(QT_HOME)\include\QtCore;$(QT_HOME)\include\QtGui;%(AdditionalIncludeDirectories)
53 | Disabled
54 | ProgramDatabase
55 | MultiThreadedDebugDLL
56 | false
57 |
58 |
59 | Windows
60 | $(OutDir)\$(ProjectName).exe
61 | $(QT_HOME)\lib
62 | true
63 | $(Configuration)\libcef.lib;out\$(Configuration)\lib\libcef_dll.lib;qtmaind.lib;QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies)
64 |
65 |
66 | call $(SolutionDir)move.bat $(SolutionDir) $(Configuration)
67 |
68 |
69 |
70 |
71 | UNICODE;WIN32;NOMINMAX;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions)
72 | .;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);$(SolutionDir);$(QT_HOME)\include;$(QT_HOME)\include\QtCore;$(QT_HOME)\include\QtGui;%(AdditionalIncludeDirectories)
73 |
74 |
75 | MultiThreadedDLL
76 | false
77 |
78 |
79 | Windows
80 | $(OutDir)\$(ProjectName).exe
81 | $(QT_HOME)\lib
82 | false
83 | $(Configuration)\libcef.lib;out\$(Configuration)\lib\libcef_dll.lib;qtmain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)
84 |
85 |
86 | call $(SolutionDir)move.bat $(SolutionDir) $(Configuration)
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | true
101 |
102 |
103 | true
104 |
105 |
106 | true
107 |
108 |
109 | true
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 | $(QT_HOME)\bin\moc.exe;%(FullPath)
119 | Moc%27ing mainwindow.h...
120 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp
121 | "$(QT_HOME)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DNOMINMAX -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -D_UNICODE "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(SolutionDir)\." "-I$(QT_HOME)\include" "-I$(QT_HOME)\include\QtCore" "-I$(QT_HOME)\include\QtGui"
122 | $(QT_HOME)\bin\moc.exe;%(FullPath)
123 | Moc%27ing mainwindow.h...
124 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp
125 | "$(QT_HOME)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DNOMINMAX -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DNDEBUG -DQT_NO_DEBUG -D_UNICODE "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(SolutionDir)\." "-I$(QT_HOME)\include" "-I$(QT_HOME)\include\QtCore" "-I$(QT_HOME)\include\QtGui"
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 | $(QT_HOME)\bin\moc.exe;%(FullPath)
267 | Moc%27ing qcefwebview.h...
268 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp
269 | "$(QT_HOME)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DNOMINMAX -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -D_UNICODE "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(SolutionDir)\." "-I$(QT_HOME)\include" "-I$(QT_HOME)\include\QtCore" "-I$(QT_HOME)\include\QtGui"
270 | $(QT_HOME)\bin\moc.exe;%(FullPath)
271 | Moc%27ing qcefwebview.h...
272 | .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp
273 | "$(QT_HOME)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DNOMINMAX -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DNDEBUG -DQT_NO_DEBUG -D_UNICODE "-I." "-I.\GeneratedFiles" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(SolutionDir)\." "-I$(QT_HOME)\include" "-I$(QT_HOME)\include\QtCore" "-I$(QT_HOME)\include\QtGui"
274 |
275 |
276 |
277 |
278 | Document
279 | $(QT_HOME)\bin\uic.exe;%(AdditionalInputs)
280 | Uic%27ing %(Identity)...
281 | .\GeneratedFiles\ui_%(Filename).h;%(Outputs)
282 | "$(QT_HOME)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"
283 | $(QT_HOME)\bin\uic.exe;%(AdditionalInputs)
284 | Uic%27ing %(Identity)...
285 | .\GeneratedFiles\ui_%(Filename).h;%(Outputs)
286 | "$(QT_HOME)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)"
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
--------------------------------------------------------------------------------
/qcef3_1650/cefclient.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
6 | moc;h;cpp
7 | False
8 |
9 |
10 | {90a77b77-8702-40e9-9389-b24fc3f26d05}
11 | cpp;moc
12 | False
13 |
14 |
15 | {b4d8472d-d242-4d1d-9071-c97fd34f396a}
16 | cpp;moc
17 | False
18 |
19 |
20 | {f5e6f9ad-2724-4cfd-bf33-fb6f59f48147}
21 |
22 |
23 | {33a8de12-5fc3-447c-b714-49abc50747e3}
24 |
25 |
26 | {b9f6cf57-bcad-4fcc-ba7e-7b24d552cfa3}
27 |
28 |
29 | {c108d178-097f-4eb0-a7f8-d3051bcd4e0f}
30 |
31 |
32 | {8078a669-fc91-4b7a-8164-1c959acf4deb}
33 |
34 |
35 |
36 |
37 |
38 |
39 | Generated Files\Debug
40 |
41 |
42 | Generated Files\Release
43 |
44 |
45 | cefclient
46 |
47 |
48 | cefclient
49 |
50 |
51 | cefclient
52 |
53 |
54 | cefclient
55 |
56 |
57 | cefclient
58 |
59 |
60 | cefclient
61 |
62 |
63 | cefclient
64 |
65 |
66 | Generated Files\Debug
67 |
68 |
69 | Generated Files\Release
70 |
71 |
72 | cefclient
73 |
74 |
75 | cefclient
76 |
77 |
78 | cefclient
79 |
80 |
81 | cefclient
82 |
83 |
84 |
85 |
86 |
87 | cefclient
88 |
89 |
90 |
91 |
92 |
93 | include\capi
94 |
95 |
96 | include\capi
97 |
98 |
99 | include\capi
100 |
101 |
102 | include\capi
103 |
104 |
105 | include\capi
106 |
107 |
108 | include\capi
109 |
110 |
111 | include\capi
112 |
113 |
114 | include\capi
115 |
116 |
117 | include\capi
118 |
119 |
120 | include\capi
121 |
122 |
123 | include\capi
124 |
125 |
126 | include\capi
127 |
128 |
129 | include\capi
130 |
131 |
132 | include\capi
133 |
134 |
135 | include\capi
136 |
137 |
138 | include\capi
139 |
140 |
141 | include\capi
142 |
143 |
144 | include\capi
145 |
146 |
147 | include\capi
148 |
149 |
150 | include\capi
151 |
152 |
153 | include\capi
154 |
155 |
156 | include\capi
157 |
158 |
159 | include\capi
160 |
161 |
162 | include\capi
163 |
164 |
165 | include\capi
166 |
167 |
168 | include\capi
169 |
170 |
171 | include\capi
172 |
173 |
174 | include\capi
175 |
176 |
177 | include\capi
178 |
179 |
180 | include\capi
181 |
182 |
183 | include\capi
184 |
185 |
186 | include\capi
187 |
188 |
189 | include\capi
190 |
191 |
192 | include\capi
193 |
194 |
195 | include\capi
196 |
197 |
198 | include\capi
199 |
200 |
201 | include\capi
202 |
203 |
204 | include\capi
205 |
206 |
207 | include\capi
208 |
209 |
210 | include\capi
211 |
212 |
213 | include\capi
214 |
215 |
216 | include\capi
217 |
218 |
219 | include\capi
220 |
221 |
222 | include\capi
223 |
224 |
225 | include\capi
226 |
227 |
228 | include\capi
229 |
230 |
231 | include\capi
232 |
233 |
234 | include\capi
235 |
236 |
237 | include\capi
238 |
239 |
240 | include\capi
241 |
242 |
243 | include\capi
244 |
245 |
246 | include\internal
247 |
248 |
249 | include\internal
250 |
251 |
252 | include\internal
253 |
254 |
255 | include\internal
256 |
257 |
258 | include\internal
259 |
260 |
261 | include\internal
262 |
263 |
264 | include\internal
265 |
266 |
267 | include\internal
268 |
269 |
270 | include\internal
271 |
272 |
273 | include\internal
274 |
275 |
276 | include\internal
277 |
278 |
279 | include\internal
280 |
281 |
282 | include\internal
283 |
284 |
285 | include\internal
286 |
287 |
288 | include\internal
289 |
290 |
291 | include\wrapper
292 |
293 |
294 | include\wrapper
295 |
296 |
297 | include\wrapper
298 |
299 |
300 | include\wrapper
301 |
302 |
303 | include
304 |
305 |
306 | include
307 |
308 |
309 | include
310 |
311 |
312 | include
313 |
314 |
315 | include
316 |
317 |
318 | include
319 |
320 |
321 | include
322 |
323 |
324 | include
325 |
326 |
327 | include
328 |
329 |
330 | include
331 |
332 |
333 | include
334 |
335 |
336 | include
337 |
338 |
339 | include
340 |
341 |
342 | include
343 |
344 |
345 | include
346 |
347 |
348 | include
349 |
350 |
351 | include
352 |
353 |
354 | include
355 |
356 |
357 | include
358 |
359 |
360 | include
361 |
362 |
363 | include
364 |
365 |
366 | include
367 |
368 |
369 | include
370 |
371 |
372 | include
373 |
374 |
375 | include
376 |
377 |
378 | include
379 |
380 |
381 | include
382 |
383 |
384 | include
385 |
386 |
387 | include
388 |
389 |
390 | include
391 |
392 |
393 | include
394 |
395 |
396 | include
397 |
398 |
399 | include
400 |
401 |
402 | include
403 |
404 |
405 | include
406 |
407 |
408 | include
409 |
410 |
411 | include
412 |
413 |
414 | include
415 |
416 |
417 | include
418 |
419 |
420 | include
421 |
422 |
423 | include
424 |
425 |
426 | include
427 |
428 |
429 | include
430 |
431 |
432 | include
433 |
434 |
435 | include
436 |
437 |
438 | include
439 |
440 |
441 | include
442 |
443 |
444 | include
445 |
446 |
447 | include
448 |
449 |
450 | include
451 |
452 |
453 | include
454 |
455 |
456 | include
457 |
458 |
459 | include
460 |
461 |
462 | include
463 |
464 |
465 | include
466 |
467 |
468 | include
469 |
470 |
471 | cefclient
472 |
473 |
474 | cefclient
475 |
476 |
477 | cefclient
478 |
479 |
480 | cefclient
481 |
482 |
483 | cefclient
484 |
485 |
486 | Generated Files
487 |
488 |
489 | cefclient
490 |
491 |
492 | cefclient
493 |
494 |
495 | cefclient
496 |
497 |
498 | cefclient
499 |
500 |
501 |
--------------------------------------------------------------------------------
/qcef3_1650/cefclient/cefclient.cpp:
--------------------------------------------------------------------------------
1 | #include "cefclient/cefclient.h"
2 | #include
3 | #include "include/cef_app.h"
4 | #include "include/cef_client.h"
5 | #include "cefclient/client_app.h"
6 |
7 | #include
8 |
9 | // Whether to use a separate sub-process executable? cefclient_process.exe
10 | //#define SUB_PROCESS_DISABLED
11 |
12 | namespace {
13 |
14 | // Initialize the CEF settings.
15 | void CefInitSettings(CefSettings& settings) {
16 | // Make browser process message loop run in a separate thread.
17 | settings.multi_threaded_message_loop = true;
18 | // Store cache data will on disk.
19 | std::string cache_path = AppGetWorkingDirectory().toStdString() + "/.cache";
20 | CefString(&settings.cache_path) = CefString(cache_path);
21 | // Completely disable logging.
22 | settings.log_severity = LOGSEVERITY_DISABLE;
23 | // The resources(cef.pak and/or devtools_resources.pak) directory.
24 | CefString(&settings.resources_dir_path) = CefString();
25 | // The locales directory.
26 | CefString(&settings.locales_dir_path) = CefString();
27 | // Enable remote debugging on the specified port.
28 | settings.remote_debugging_port = 8088;
29 | // Ignore errors related to invalid SSL certificates.
30 | //settings.ignore_certificate_errors = true;
31 | }
32 |
33 | } // namespace
34 |
35 | CefRefPtr g_handler;
36 |
37 | int CefInit(int &argc, char **argv) {
38 | qDebug() << __FUNCTION__;
39 | HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
40 |
41 | CefMainArgs main_args(hInstance);
42 | CefRefPtr app(new ClientApp);
43 |
44 | #ifdef SUB_PROCESS_DISABLED
45 | // Execute the secondary process, if any.
46 | int exit_code = CefExecuteProcess(main_args, app.get());
47 | if (exit_code >= 0)
48 | return exit_code;
49 | #endif
50 |
51 | CefSettings settings;
52 | CefInitSettings(settings);
53 |
54 | #ifndef SUB_PROCESS_DISABLED
55 | // Specify the path for the sub-process executable.
56 | CefString(&settings.browser_subprocess_path).FromASCII("cefclient_process.exe");
57 | #endif
58 |
59 | // Initialize CEF.
60 | CefInitialize(main_args, settings, app.get());
61 |
62 | g_handler = new ClientHandler();
63 |
64 | return -1;
65 | }
66 |
67 | void CefLoadPlugins(bool isWow64) {
68 | // Adobe Flash Player plug-in:
69 | // https://support.google.com/chrome/answer/108086
70 | // How to load chrome flash plugin:
71 | // https://code.google.com/p/chromiumembedded/issues/detail?id=130
72 |
73 | // Load flash system plug-in on Windows.
74 | CefString flash_plugin_dir = isWow64 ? "C:\\Windows\\SysWOW64\\Macromed\\Flash"
75 | : "C:\\Windows\\System32\\Macromed\\Flash";
76 | CefAddWebPluginDirectory(flash_plugin_dir);
77 |
78 | CefRefreshWebPlugins();
79 | }
80 |
81 | void CefQuit() {
82 | qDebug() << __FUNCTION__;
83 | // Shut down CEF.
84 | CefShutdown();
85 | }
86 |
--------------------------------------------------------------------------------
/qcef3_1650/cefclient/cefclient.h:
--------------------------------------------------------------------------------
1 | #ifndef CEFCLIENT_CEFCLIENT_H_
2 | #define CEFCLIENT_CEFCLIENT_H_
3 | #pragma once
4 |
5 | #include
6 | #include "include/cef_base.h"
7 | #include "cefclient/client_handler.h"
8 |
9 | // Initialize CEF.
10 | int CefInit(int &argc, char **argv);
11 |
12 | // Load web plugins.
13 | void CefLoadPlugins(bool isWow64);
14 |
15 | // Quit CEF.
16 | void CefQuit();
17 |
18 | // Quit CEF until all browser windows have closed.
19 | /*unavailable*/ void CefQuitUntilAllBrowserClosed();
20 |
21 | // Returns the application working directory.
22 | QString AppGetWorkingDirectory();
23 |
24 | // Notify all browser windows have closed.
25 | /*internal*/ void NotifyAllBrowserClosed();
26 |
27 | #endif // CEFCLIENT_CEFCLIENT_H_
28 |
--------------------------------------------------------------------------------
/qcef3_1650/cefclient/cefclient_qt.cpp:
--------------------------------------------------------------------------------
1 | #include "cefclient/cefclient.h"
2 | #include
3 |
4 | #include
5 |
6 | extern CefRefPtr g_handler;
7 |
8 | void CefQuitUntilAllBrowserClosed() {
9 | qDebug() << __FUNCTION__ << __LINE__;
10 | if (ClientHandler::m_BrowserCount > 0 && g_handler.get()) {
11 | g_handler->CloseAllBrowsers(false);
12 | // TODO Wait until all browser windows have closed.
13 | }
14 | qDebug() << __FUNCTION__ << __LINE__;
15 | CefQuit();
16 | }
17 |
18 | QString AppGetWorkingDirectory() {
19 | return qApp->applicationDirPath();
20 | }
21 |
22 | void NotifyAllBrowserClosed() {
23 | qDebug() << __FUNCTION__;
24 | // Notify all browser windows have closed.
25 | }
--------------------------------------------------------------------------------
/qcef3_1650/cefclient/client_app.cpp:
--------------------------------------------------------------------------------
1 | #include "client_app.h" // NOLINT(build/include)
2 |
3 | #include
4 |
5 | #include "include/cef_cookie.h"
6 | #include "include/cef_process_message.h"
7 | #include "include/cef_task.h"
8 | #include "include/cef_v8.h"
9 | #include "util.h" // NOLINT(build/include)
10 | #include "cefclient/client_transfer.h"
11 | #include "cefclient/client_app_js.h"
12 |
13 | namespace {
14 |
15 | // Handles the native implementation for the client_app extension.
16 | class ClientAppExtensionHandler : public CefV8Handler {
17 | public:
18 | explicit ClientAppExtensionHandler(CefRefPtr client_app)
19 | : client_app_(client_app) {
20 | }
21 |
22 | virtual bool Execute(const CefString& name,
23 | CefRefPtr object,
24 | const CefV8ValueList& arguments,
25 | CefRefPtr& retval,
26 | CefString& exception) {
27 | bool handled = false;
28 |
29 | if (name == JS_FUNC_SENDMESSAGE && arguments.size() >= 1) {
30 | CefRefPtr browser =
31 | CefV8Context::GetCurrentContext()->GetBrowser();
32 | ASSERT(browser.get());
33 |
34 | CefRefPtr message = CefProcessMessage::Create(name);
35 |
36 | cefclient::SetList(arguments, message->GetArgumentList());
37 |
38 | browser->SendProcessMessage(PID_BROWSER, message);
39 | handled = true;
40 | }
41 |
42 | if (!handled)
43 | exception = "Invalid method arguments";
44 |
45 | return true;
46 | }
47 |
48 | private:
49 | CefRefPtr client_app_;
50 |
51 | IMPLEMENT_REFCOUNTING(ClientAppExtensionHandler);
52 | };
53 |
54 | } // namespace
55 |
56 |
57 | ClientApp::ClientApp() {
58 | CreateBrowserDelegates(browser_delegates_);
59 | CreateRenderDelegates(render_delegates_);
60 |
61 | // Default schemes that support cookies.
62 | //cookieable_schemes_.push_back("http");
63 | //cookieable_schemes_.push_back("https");
64 | }
65 |
66 | void ClientApp::OnContextInitialized() {
67 | // Register cookieable schemes with the global cookie manager.
68 | //CefRefPtr manager = CefCookieManager::GetGlobalManager();
69 | //ASSERT(manager.get());
70 | //manager->SetSupportedSchemes(cookieable_schemes_);
71 |
72 | BrowserDelegateSet::iterator it = browser_delegates_.begin();
73 | for (; it != browser_delegates_.end(); ++it)
74 | (*it)->OnContextInitialized(this);
75 | }
76 |
77 | void ClientApp::OnBeforeChildProcessLaunch(
78 | CefRefPtr command_line) {
79 | BrowserDelegateSet::iterator it = browser_delegates_.begin();
80 | for (; it != browser_delegates_.end(); ++it)
81 | (*it)->OnBeforeChildProcessLaunch(this, command_line);
82 | }
83 |
84 | void ClientApp::OnRenderProcessThreadCreated(
85 | CefRefPtr extra_info) {
86 | BrowserDelegateSet::iterator it = browser_delegates_.begin();
87 | for (; it != browser_delegates_.end(); ++it)
88 | (*it)->OnRenderProcessThreadCreated(this, extra_info);
89 | }
90 |
91 | void ClientApp::OnRenderThreadCreated(CefRefPtr extra_info) {
92 | RenderDelegateSet::iterator it = render_delegates_.begin();
93 | for (; it != render_delegates_.end(); ++it)
94 | (*it)->OnRenderThreadCreated(this, extra_info);
95 | }
96 |
97 | void ClientApp::OnWebKitInitialized() {
98 | // Register the client_app extension.
99 | std::string app_code =
100 | "var app;"
101 | "if (!app) {"
102 | " app = {"
103 | " sendMessage: function(/*one or more*/) {"
104 | " native function sendMessage();"
105 | " return sendMessage.apply(this, Array.prototype.slice.call(arguments));"
106 | " }"
107 | " }"
108 | "}";
109 | CefRegisterExtension("v8/app", app_code,
110 | new ClientAppExtensionHandler(this));
111 |
112 | RenderDelegateSet::iterator it = render_delegates_.begin();
113 | for (; it != render_delegates_.end(); ++it)
114 | (*it)->OnWebKitInitialized(this);
115 | }
116 |
117 | void ClientApp::OnBrowserCreated(CefRefPtr browser) {
118 | RenderDelegateSet::iterator it = render_delegates_.begin();
119 | for (; it != render_delegates_.end(); ++it)
120 | (*it)->OnBrowserCreated(this, browser);
121 | }
122 |
123 | void ClientApp::OnBrowserDestroyed(CefRefPtr browser) {
124 | RenderDelegateSet::iterator it = render_delegates_.begin();
125 | for (; it != render_delegates_.end(); ++it)
126 | (*it)->OnBrowserDestroyed(this, browser);
127 | }
128 |
129 | CefRefPtr ClientApp::GetLoadHandler() {
130 | CefRefPtr load_handler;
131 |
132 | RenderDelegateSet::iterator it = render_delegates_.begin();
133 | for (; it != render_delegates_.end() && !load_handler.get(); ++it)
134 | load_handler = (*it)->GetLoadHandler(this);
135 |
136 | return load_handler;
137 | }
138 |
139 | bool ClientApp::OnBeforeNavigation(CefRefPtr browser,
140 | CefRefPtr frame,
141 | CefRefPtr request,
142 | NavigationType navigation_type,
143 | bool is_redirect) {
144 | RenderDelegateSet::iterator it = render_delegates_.begin();
145 | for (; it != render_delegates_.end(); ++it) {
146 | if ((*it)->OnBeforeNavigation(this, browser, frame, request,
147 | navigation_type, is_redirect)) {
148 | return true;
149 | }
150 | }
151 |
152 | return false; // Allow the navigation to proceed.
153 | }
154 |
155 | void ClientApp::OnContextCreated(CefRefPtr browser,
156 | CefRefPtr frame,
157 | CefRefPtr context) {
158 | RenderDelegateSet::iterator it = render_delegates_.begin();
159 | for (; it != render_delegates_.end(); ++it)
160 | (*it)->OnContextCreated(this, browser, frame, context);
161 | }
162 |
163 | void ClientApp::OnContextReleased(CefRefPtr browser,
164 | CefRefPtr frame,
165 | CefRefPtr context) {
166 | RenderDelegateSet::iterator it = render_delegates_.begin();
167 | for (; it != render_delegates_.end(); ++it)
168 | (*it)->OnContextReleased(this, browser, frame, context);
169 | }
170 |
171 | void ClientApp::OnUncaughtException(CefRefPtr browser,
172 | CefRefPtr frame,
173 | CefRefPtr context,
174 | CefRefPtr exception,
175 | CefRefPtr stackTrace) {
176 | RenderDelegateSet::iterator it = render_delegates_.begin();
177 | for (; it != render_delegates_.end(); ++it) {
178 | (*it)->OnUncaughtException(this, browser, frame, context, exception,
179 | stackTrace);
180 | }
181 | }
182 |
183 | void ClientApp::OnFocusedNodeChanged(CefRefPtr browser,
184 | CefRefPtr frame,
185 | CefRefPtr node) {
186 | RenderDelegateSet::iterator it = render_delegates_.begin();
187 | for (; it != render_delegates_.end(); ++it)
188 | (*it)->OnFocusedNodeChanged(this, browser, frame, node);
189 | }
190 |
191 | bool ClientApp::OnProcessMessageReceived(
192 | CefRefPtr browser,
193 | CefProcessId source_process,
194 | CefRefPtr message) {
195 | ASSERT(source_process == PID_BROWSER);
196 |
197 | bool handled = false;
198 |
199 | RenderDelegateSet::iterator it = render_delegates_.begin();
200 | for (; it != render_delegates_.end() && !handled; ++it) {
201 | handled = (*it)->OnProcessMessageReceived(this, browser, source_process,
202 | message);
203 | }
204 |
205 | if (handled)
206 | return true;
207 |
208 | return handled;
209 | }
--------------------------------------------------------------------------------
/qcef3_1650/cefclient/client_app.h:
--------------------------------------------------------------------------------
1 | #ifndef CEFCLIENT_CLIENT_APP_H_
2 | #define CEFCLIENT_CLIENT_APP_H_
3 | #pragma once
4 |
5 | #include