当前位置: 首页 > news >正文

VC2012编译CEF3-转

原文地址:http://blog.csdn.net/tiplip/article/details/42047815

 

下载

  1. 代码下载:http://cefbuilds.com/,CEF 3.2556.1368.g535c4fb

  2. 解压到本地:D:\Develop\CEF3\cef_binary_3.2526.1361.g456ea5a_windows32

配置

  1. 下载最新的CMake,比如http://www.onlinedown.net/softdown/254393_2.htm

  2. 安装CMake后运行gui,设置使用VC2012,操作过程可参考http://blog.sina.com.cn/s/blog_53b7ddf00101mjo7.html

编译

  1. 最后进入D:\Develop\CEF3\cef_binary_3.2526.1361.g456ea5a_windows32\build

  2. 使用VC2012打开cef.sln,在IDE下build solution

warning C4610/C4510

 

[cpp]  view plain  copy
 
  1. typedef const struct __log_rec_spec {  
  2.     log_rec_type_t  type;  
  3.     u_int32_t   offset;  
  4.     const char  *name;  
  5.     const char  fmt[4];  
  6. } DB_LOG_RECSPEC;  


关闭这种警告C/C++,Advanced,Disable Specific Warnings:4100;4127;4244;4481;4512;4701;4702;4996;4510;4610

 

关于_HAS_EXCEPTIONS

CEF3项目默认的编译开关是_HAS_EXCEPTIONS=0,这会在有些情况下导致编译错误,比如有些Windows平台上的std库无法使用而产生的编译错误,这时候需要开启_HAS_EXCEPTIONS

设置:

_HAS_EXCEPTIONS=1  必须同时设置EHsc

Code Generation --> Enable C++ Exceptions: EHsc

配置命令行commandline

比如使用--disable-web-security,有两种使用方式

  1. 启动:cef.exe --disable-web-security
  2. 代码实现AppendSwitch,AppendArgument,在代码中使用前面的两个横线就不需要了,AppendSwitch("disable-gpu")

注意:--disable-web-security有可能会影响屏幕中iframe的尺寸,进而影响到css,@media screen and (max-width : 1024px),比如没有设置--disable-web-security,@media screen and (max-width : 1024px)中的样式不会包含到页面中,如果设置了--disable-web-security,@media screen and (max-width : 1024px)中的样式就会起作用,从而影响了页面的显示

关于iframe

比如我们想知道当前iframe的路径,使用js怎么做?

html

 

[html]  view plain  copy
 
  1. <div class="panel-width-start" id="map">  
  2.     <iframe allowTransparency=true name="I2" id="site" frameborder="0" src="http://www.58.com/changecity/"></iframe>  
  3. </div>  


js

 

 

[javascript]  view plain  copy
 
  1. var currentUrl = document.getElementById("site").contentWindow.location.href;  


这样可以一直获取到iframe当前页面的url,运行CEF3必须使用--disable-web-security,否则js执行会失败,告诉你当前为跨域操作不允许

控件显示与manifest

如果修改既有的cefclient工程,比如你修改了项目的名称,可执行exe的文件名,这时需要注意Post-Build Event中需要做相应的修改

mt.exe -nologo -manifest "D:/Develop/CEF3/cef_binary_3.2623.1401.gb90a3be_windows32/cefclient/resources/win/cefclient.exe.manifest" "D:/Develop/CEF3/cef_binary_3.2623.1401.gb90a3be_windows32/cefclient/resources/win/compatibility.manifest" -outputresource:"D:/Develop/CEF3/cef_binary_3.2623.1401.gb90a3be_windows32/build/cefclient/Debug/UI_example.exe";#1

常见问题

  1. warning C4510:'ATL::_NoAddRefReleaseOnCComPtr<T>' : default constructor could not begenerated

配置时,关闭-DUSE_ATL=Off to CMake

  1. error C2220: warning treated as error - no 'object' file generated

解决办法:参考http://blog.csdn.net/home1410/article/details/6004089

即:报错的文件头部添加类似#pragma warning(disable: 4510 4610) // tiplip

 

 

编译错误

gdiplusimaging.h(74) error c4430 missing type specifier - int assumed

我在window_test_win.cc中需要用到gdiplus,于是添加#include <gdiplus.h>
编译报错

答案:http://stackoverflow.com/questions/3489373/visual-studio-c-2010-express-gets-errors-using-gdi

If you have this line somewhere before the inclusion of <windows.h>

#define WIN32_LEAN_AND_MEAN 

Then comment it out.

#define WIN32_LEAN_AND_MEAN啥意思? 

支持flash

使用Chrome带的pepflashplayer.dll

以下两种方法的版本号可以省去,在CEF3.2623版本上测试有效

启用命令行

 

[plain]  view plain  copy
 
  1. --ppapi-flash-path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\53.0.2785.143\\PepperFlash\\pepflashplayer.dll" --ppapi-flash-version=23.0.0.162  


版本需要对于,比如都是32位的

 

使用代码

 

[cpp]  view plain  copy
 
  1. command_line->AppendSwitchWithValue("ppapi-flash-path","pepflashplayer.dll");  
  2. //command_line->AppendSwitchWithValue("ppapi-flash-version","23.0.0.162");  

 

 

具体位置

void ClientAppBrowser::OnBeforeCommandLineProcessing

不使用代理

启动参数:

--no-proxy-server=1

自定义添加资源resource

cefclient.rc文件

比如添加网页html文件,手动添加如下一行

 

[cpp]  view plain  copy
 
  1. IDS_ORDER_HTML          256                     "..\\root_lottery\\order.html"  


然后编译build,会产生新的resource.h文件,如下所述

 

resource.h文件

有两处resource.h文件,

\cefclient\resources\win\resource.h,编译cefclient.rc产生

\cefclient\browser\resource.h,手动修改,数值来自上面的resource.h文件

支持Windows XP

官方论坛显示,最后一个支持Windows XP的CEF3版本号为,3.2623.1401.gb90a3be

使用VC2012编译XP版本时,需要选择Visual Studio 2012 - Windows XP (v110_xp)

这样编译出来的exe,如果出现浏览器黑屏,可以尝试启动选项:--disable-gpu

截屏Screen Capture

参考

http://stackoverflow.com/questions/38512422/add-suport-for-chromium-embedded-framework-to-screen-sharing

测试版本,2924上验证通过,使用--enable-media-stream --enable-usermedia-screen-capturing

测试网址

https://mgechev.github.io/jscapture/

支持HTTP HTTPS Mixed Content

比如给当前页面加载资源时,如果页面本身的url以https开始,那么加载http的资源时会报类似错误

 

[plain]  view plain  copy
 
  1. 2 Mixed Content: The page at 'https://www.xxxx.com' was loaded over HTTPS, but requested an insecure script  

 

 

解决办法

 

[cpp]  view plain  copy
 
  1. command_line->AppendSwitch("allow-running-insecure-content");  

 

Render与Browser的进程间交互

自定义JS函数操作与Browser相关的功能,比如修改窗口,传递参数

参考:http://blog.csdn.net/foruok/article/details/50584985

JS binding中传递JSON给C++

参数传递

参考代码Cef_message_router.cc (libcef_dll\wrapper)    38985    2016/5/13

[cpp]  view plain  copy
 
  1. if (name == config_.js_query_function) {  
  2.   if (arguments.size() != 1 || !arguments[0]->IsObject()) {  
  3.     exception = "Invalid arguments; expecting a single object";  
  4.     return true;  
  5.   }  
  6.   
  7.   CefRefPtr<CefV8Value> arg = arguments[0];  
  8.   
  9.   CefRefPtr<CefV8Value> requestVal = arg->GetValue(kMemberRequest);  
  10.   if (!requestVal.get() || !requestVal->IsString()) {  
  11.     exception = "Invalid arguments; object member '"+  
  12.                 std::string(kMemberRequest) +"' is required and must "  
  13.                 "have type string";  
  14.     return true;  
  15.   }  

 

参数类型互换

参考:http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11104#

拖拽截取页面的图片

参考问答:http://stackoverflow.com/questions/28099145/creating-a-drag-select-screen-capture-for-google-chrome

demo:http://jsfiddle.net/x2xmjrya/

下载编译chromium支持MP3/MP4

2623.mp3.4_x_frame

背景

使用了VPN和http代理

参考

http://www.cnblogs.com/himax/p/how_to_build_cef3_on_windows.html

和https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up

文件夹结构

设置环境变量

2785及更老版本使用GYP

 

[plain]  view plain  copy
 
  1. DEPOT_TOOLS_WIN_TOOLCHAIN=0  
  2.   
  3. GYP_DEFINES=buildtype=Official  
  4.   
  5. GYP_GENERATORS=ninja,msvs-ninja  
  6.   
  7. GYP_MSVS_VERSION=2015  

 

2785以后的版本使用GN

 

[plain]  view plain  copy
 
  1. CEF_USE_GN=1  
  2. GN_DEFINES=is_official_build=true  
  3. GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*  

 

如果需要支持MP3/MP4

 

[vb]  view plain  copy
 
  1. set CEF_USE_GN=1  
  2. set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome  
  3. set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*  
  4. call cef_create_projects.bat  


注意:编译过程中,最好关闭其他程序,因为最新official版本的编译需要占用大量的内存RAM,> 8G,理想的内存最好是 14G

 

 

以及Path

 

 

[plain]  view plain  copy
 
  1. Control Panel → System and Security → System → Advanced system settings  
  2. Modify the PATH system variable to include D:\Work_area\CEF3\depot_tools  

 

编译过程命令汇总

首次编译

 

[plain]  view plain  copy
 
  1. d:  
  2. cd Work_area\CEF3  
  3. set http_proxy=http://cn-proxy.jp.oracle.com:80  
  4. gclient  
  5. git config --global http.proxy %http_proxy%  
  6. python automate-git.py --download-dir=D:\Work_area\CEF3\source --depot-tools-dir=D:\Work_area\CEF3\depot_tools --branch=2623  --checkout=b90a3be1860b0647e8a62c218ff7c054390365b1 --no-build  

 

按照这个命令步骤,如果遇到问题

修改个别文件后的编译

直接在第一层目录下执行

 

[plain]  view plain  copy
 
  1. python automate-git.py --download-dir=c:\src\source --depot-tools-dir=c:\src\depot_tools --branch=2623  --checkout=b90a3be1860b0647e8a62c218ff7c054390365b1 --force-build  



 

编译参数说明

[plain]  view plain  copy
 
  1. set http_proxy=http://www-proxy.us.oracle.com:80  
  2. gclient  
  3. git config --global http.proxy %http_proxy%  
  4. python automate-git.py --download-dir=c:\src\source --depot-tools-dir=c:\src\depot_tools --branch=2623  --checkout=b90a3be1860b0647e8a62c218ff7c054390365b1 --force-build  
  5.   
  6. --branch=XXXX 指定cef的branch,指定后,会默认下载该branch的cef,以及最新版本的chromium再自动切换到对应版本  
  7. --checkout 手动指定cef的commit(可选参数)  
  8. --chromium-checkout 手动指定chromium的版本(可选参数)  
  9. --no-debug-build 不生成Debug版本,即不生成开发需要的libcef_dll_wrapper库(可选参数)  
  10. --force-clean 强制清除所有chromium的生成项,将源码回档到未编译前,清除后需要重新下载(可选参数)  
  11. --force-build 强制进行编译,重新开始或者继续之前的工作(可选参数)  
  12. --no-update 不再更新cef和chromium(可选参数)  



 

 

可能遇到的错误及解决办法

执行gclient出现如下错误:

 

[plain]  view plain  copy
 
  1. C:\Windows\System32>gclient  
  2. Installing python 2.7.6...  
  3. Fetching from https://src.chromium.org/svn/trunk/tools/third_party/python276_bin  
  4. .zip  
  5. [-] XMLHTTP 80072ee2: Cannot make HTTP request (操作超时  
  6.   
  7. ... Failed to checkout python automatically.  
  8. You should get the "prebaked" version at https://src.chromium.org/svn/trunk/tool  
  9. s/third_party/  
  10. 系统找不到指定的路径。  

 

 

说明当前你的电脑可能是通过代理访问的,需要修改depot_tools\bootstrap\win\get_file.js如下:

 

[javascript]  view plain  copy
 
  1. function Download(url, path, verbose) {  
  2.   if (verbose) {  
  3.     WScript.StdOut.Write(" *  GET " + url + "...");  
  4.   }  
  5.   try {  
  6.     xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP");  
  7.   } catch (e) {  
  8.     WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
  9.         ": Cannot create Active-X object (" + e.description) + ").";  
  10.     WScript.Quit(1);  
  11.   }  
  12.   try {  
  13.     xml_http.open("GET", url, false);  
  14.   } catch (e) {  
  15.     WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
  16.         ": invalid URL.");  
  17.     WScript.Quit(1);  
  18.   }  


改为

 

 

[javascript]  view plain  copy
 
  1. function Download(url, path, verbose) {  
  2.   if (verbose) {  
  3.     WScript.StdOut.Write(" *  GET " + url + "...");  
  4.   }  
  5.   try {  
  6.     xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP.6.0");  
  7.   } catch (e) {  
  8.     WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
  9.         ": Cannot create Active-X object (" + e.description) + ").";  
  10.     WScript.Quit(1);  
  11.   }  
  12.   try {  
  13.     xml_http.setProxy(2, "cn-proxy.jp.oracle.com:80");  
  14.     xml_http.open("GET", url, false);  
  15.   } catch (e) {  
  16.     WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
  17.         ": invalid URL.");  
  18.     WScript.Quit(1);  
  19.   }  

 

执行

 

[plain]  view plain  copy
 
  1. python automate-git.py  

错误

 

 

[plain]  view plain  copy
 
  1. python automate-git.py --download-dir=D:\Develop\CEF3\Compile\source --depot-tools-dir=D:\Develop\CEF3\Compile\depot_tools --branch=2357 --checkout=d66017718b0f0d44da42b706c3c2aa5c0c103852 --no-build  

 

[plain]  view plain  copy
 
  1. D:\Develop\CEF3\Compile>python automate-git.py --download=D:\Develop\CEF3\Compil  
  2. e\source --depot-tools-dir=D:\Develop\CEF3\Compile\depot_tools --branch=2357 --n  
  3. o-build  
  4. --> Download Directory: D:\Develop\CEF3\Compile\source  
  5. --> Depot Tools Directory: D:\Develop\CEF3\Compile\depot_tools  
  6. --> Updating depot_tools  
  7. -------- Running "update_depot_tools.bat" in "D:\Develop\CEF3\Compile\depot_tool  
  8. s"...  
  9. fatal: unable to access 'https://chromium.googlesource.com/chromium/tools/depot_  
  10. tools.git/': Failed connect to chromium.googlesource.com:443; No error  
  11. Cannot rebase: You have unstaged changes.  
  12. Please commit or stash them.  
  13. Failed to update depot_tools.  
  14. --> CEF Branch: 2357  
  15. --> CEF URL: https://bitbucket.org/chromiumembedded/cef.git  
  16. --> CEF Source Directory: D:\Develop\CEF3\Compile\source\cef  
  17. -------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat clone https://bitb  
  18. ucket.org/chromiumembedded/cef.git D:\Develop\CEF3\Compile\source\cef" in "D:\De  
  19. velop\CEF3\Compile\source"...  
  20. Cloning into 'D:\Develop\CEF3\Compile\source\cef'...  
  21. fatal: unable to access 'https://bitbucket.org/chromiumembedded/cef.git/': Faile  
  22. d connect to bitbucket.org:443; No error  
  23. Traceback (most recent call last):  
  24.   File "automate-git.py", line 662, in <module>  
  25.     depot_tools_dir)  
  26.   File "automate-git.py", line 55, in run  
  27.     shell=(sys.platform == 'win32'))  
  28.   File "D:\Develop\CEF3\Compile\depot_tools\python276_bin\lib\subprocess.py", li  
  29. ne 540, in check_call  
  30.     raise CalledProcessError(retcode, cmd)  
  31. subprocess.CalledProcessError: Command '['D:\\Develop\\CEF3\\Compile\\depot_tool  
  32. s\\git.bat', 'clone', 'https://bitbucket.org/chromiumembedded/cef.git', 'D:\\Dev  
  33. elop\\CEF3\\Compile\\source\\cef']' returned non-zero exit status 128  

 

 

执行gclient前设置代理

 

[plain]  view plain  copy
 
  1. Microsoft Windows [版本 6.1.7601]  
  2. 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。  
  3.   
  4. C:\windows\system32>netsh  
  5. netsh>winhttp  
  6. netsh winhttp>show proxy  
  7.   
  8. 当前的 WinHTTP 代理服务器设置:  
  9.   
  10.     代理服务器:  http=cn-proxy.jp.oracle.com  
  11.     绕过列表     :  (无)  
  12.   
  13. netsh winhttp>set proxy cn-proxy.jp.oracle.com:80  
  14.   
  15. 当前的 WinHTTP 代理服务器设置:  
  16.   
  17.     代理服务器:  cn-proxy.jp.oracle.com:80  
  18.     绕过列表     :  (无)  
  19.   
  20. netsh winhttp>exit  
  21.   
  22.   
  23. C:\windows\system32>set http_proxy=http://cn-proxy.jp.oracle.com:80  
  24.   
  25. C:\windows\system32>git config -global http.proxy %http_proxy%  
  26. error: did you mean `--global` (with two dashes ?)  
  27.   
  28. C:\windows\system32>git config --global http.proxy %http_proxy%  
  29.   
  30. C:\windows\system32>git config --get http.proxy  
  31. http://cn-proxy.jp.oracle.com:80  
  32.   
  33. C:\windows\system32>d:  
  34.   
  35. D:\>cd Develop\CEF3\Compile  
  36.   
  37. D:\Develop\CEF3\Compile>python automate-git.py --download-dir=D:\Develop\CEF3\Co  
  38. mpile\source --depot-tools-dir=D:\Develop\CEF3\Compile\depot_tools --branch=2357  
  39.  --checkout=d66017718b0f0d44da42b706c3c2aa5c0c103852 --no-build  
  40. --> Download Directory: D:\Develop\CEF3\Compile\source  
  41. --> Depot Tools Directory: D:\Develop\CEF3\Compile\depot_tools  
  42. --> Updating depot_tools  
  43. -------- Running "update_depot_tools.bat" in "D:\Develop\CEF3\Compile\depot_tool  
  44. s"...  
  45. Cannot rebase: You have unstaged changes.  
  46. Please commit or stash them.  
  47. Failed to update depot_tools.  
  48. --> CEF Branch: 2357  
  49. --> CEF URL: https://bitbucket.org/chromiumembedded/cef.git  
  50. --> CEF Source Directory: D:\Develop\CEF3\Compile\source\cef  
  51. -------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat clone https://bitb  
  52. ucket.org/chromiumembedded/cef.git D:\Develop\CEF3\Compile\source\cef" in "D:\De  
  53. velop\CEF3\Compile\source"...  
  54. Cloning into 'D:\Develop\CEF3\Compile\source\cef'...  
  55. remote: Counting objects: 32815, done.  
  56. remote: Compressing objects: 100% (8915/8915), done.  
  57. remote: Total 32815 (delta 27309), reused 28831 (delta 23803)  
  58. Receiving objects: 100% (32815/32815), 9.83 MiB | 789.00 KiB/s, done.  
  59. Resolving deltas: 100% (27309/27309), done.  
  60. Checking connectivity... done.  
  61. -------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat rev-parse HEAD" in  
  62.  "D:\Develop\CEF3\Compile\source\cef"...  
  63. -------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat rev-parse d6601771  
  64. 8b0f0d44da42b706c3c2aa5c0c103852" in "D:\Develop\CEF3\Compile\source\cef"...  
  65. --> CEF Current Checkout: 6d7ee1e08439672050c2c5bd022fbcc2e79770d4  
  66. --> CEF Desired Checkout: d66017718b0f0d44da42b706c3c2aa5c0c103852 (d66017718b0f  
  67. 0d44da42b706c3c2aa5c0c103852)  
  68. -------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat checkout d66017718  
  69. b0f0d44da42b706c3c2aa5c0c103852" in "D:\Develop\CEF3\Compile\source\cef"...  
  70. Checking out files: 100% (1049/1049), done.  
  71. Note: checking out 'd66017718b0f0d44da42b706c3c2aa5c0c103852'.  
  72.   
  73. You are in 'detached HEAD' state. You can look around, make experimental  
  74. changes and commit them, and you can discard any commits you make in this  
  75. state without impacting any branches by performing another checkout.  
  76.   
  77. If you want to create a new branch to retain commits you create, you may  
  78. do so (now or later) by using -b with the checkout command again. Example:  
  79.   
  80.   git checkout -b new_branch_name  
  81.   
  82. HEAD is now at d660177... Update to Chromium version 43.0.2357.130  
  83. --> CEF Output Directory: D:\Develop\CEF3\Compile\source\out_2357  
  84. --> Creating directory D:\Develop\CEF3\Compile\source\chromium  
  85. --> Writing file: D:\Develop\CEF3\Compile\source\chromium\.gclient  
  86. -------- Running "gclient sync --nohooks --with_branch_heads --jobs 16" in "D:\D  
  87. evelop\CEF3\Compile\source\chromium"...  
  88. Cannot rebase: You have unstaged changes.  
  89. Please commit or stash them.  
  90. Failed to update depot_tools.  
  91.   
  92. [0:01:00] Still working on:  
  93. [0:01:00]   src  
  94.   
  95. [0:01:14] Still working on:  
  96. [0:01:14]   src  
  97.   
  98. [0:01:25] Still working on:  
  99. [0:01:25]   src  
  100.   
  101. [0:01:35] Still working on:  
  102. [0:01:35]   src  
  103.   
  104. [0:01:45] Still working on:  

 

cipd.ps1错误

遇到如下红字的错误可以忽略

 

[plain]  view plain  copy
 
  1. The term 'git' is not recognized as the name of a cmdlet, function, script file  
  2. , or operable program. Check the spelling of the name, or if a path was include  
  3. d, verify that the path is correct and try again.  
  4. At C:\src\depot_tools\cipd.ps1:31 char:25  
  5. + $depot_tools_version = & <<<< git -C $myPath rev-parse HEAD 2>&1  
  6. + CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFound  
  7. Exception  
  8. + FullyQualifiedErrorId : CommandNotFoundException  



 

获取代码及依赖工具

报错

 

[plain]  view plain  copy
 
  1. 0> Failed to fetch file gs://chromium-gn/14b37907020b299b5c6bfae1d7fed7d7a92e4fe  
  2. 6 for src/buildtools/win/gn.exe, skipping. [Err: Traceback (most recent call las  
  3. t):  
  4.   File "c:\src\depot_tools\gsutil.py", line 160, in <module>  
  5.     sys.exit(main())  
  6.   File "c:\src\depot_tools\gsutil.py", line 157, in main  
  7.     clean=args.clean)  
  8.   File "c:\src\depot_tools\gsutil.py", line 125, in run_gsutil  
  9.     gsutil_bin = ensure_gsutil(force_version, target, clean)  
  10.   File "c:\src\depot_tools\gsutil.py", line 107, in ensure_gsutil  
  11.     target_zip_filename = download_gsutil(version, instance_dir)  
  12.   File "c:\src\depot_tools\gsutil.py", line 62, in download_gsutil  
  13.     u = urllib2.urlopen(url)  
  14.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 127, in urlopen  
  15.     return _opener.open(url, data, timeout)  
  16.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 404, in open  
  17.     response = self._open(req, data)  
  18.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 422, in _open  
  19.     '_open', req)  
  20.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 382, in _call_cha  
  21. in  
  22.     result = func(*args)  
  23.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1222, in https_op  
  24. en  
  25.     return self.do_open(httplib.HTTPSConnection, req)  
  26.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1184, in do_open  
  27.     raise URLError(err)  
  28. urllib2.URLError: <urlopen error [Errno 10060] A connection attempt failed becau  
  29. se the connected party did not properly respond after a period of time, or estab  
  30. lished connection failed because connected host has failed to respond>  
  31. ]  
  32. Downloading 1 files took 21.630000 second(s)  
  33. NOTICE: You have PROXY values set in your environment, but gsutil in depot_tools  
  34.  does not (yet) obey them.  
  35. Also, --no_auth prevents the normal BOTO_CONFIG environment variable from being  
  36. used.  
  37. To use a proxy in this situation, please supply those settings in a .boto file p  
  38. ointed to by the NO_AUTH_BOTO_CONFIG environment var.  
  39. Failed to fetch file gs://chromium-gn/14b37907020b299b5c6bfae1d7fed7d7a92e4fe6 f  
  40. or src/buildtools/win/gn.exe. [Err: Traceback (most recent call last):  
  41.   File "c:\src\depot_tools\gsutil.py", line 160, in <module>  
  42.     sys.exit(main())  
  43.   File "c:\src\depot_tools\gsutil.py", line 157, in main  
  44.     clean=args.clean)  
  45.   File "c:\src\depot_tools\gsutil.py", line 125, in run_gsutil  
  46.     gsutil_bin = ensure_gsutil(force_version, target, clean)  
  47.   File "c:\src\depot_tools\gsutil.py", line 107, in ensure_gsutil  
  48.     target_zip_filename = download_gsutil(version, instance_dir)  
  49.   File "c:\src\depot_tools\gsutil.py", line 62, in download_gsutil  
  50.     u = urllib2.urlopen(url)  
  51.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 127, in urlopen  
  52.     return _opener.open(url, data, timeout)  
  53.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 404, in open  
  54.     response = self._open(req, data)  
  55.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 422, in _open  
  56.     '_open', req)  
  57.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 382, in _call_cha  
  58. in  
  59.     result = func(*args)  
  60.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1222, in https_op  
  61. en  
  62.     return self.do_open(httplib.HTTPSConnection, req)  
  63.   File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1184, in do_open  
  64.     raise URLError(err)  
  65. urllib2.URLError: <urlopen error [Errno 10060] A connection attempt failed becau  
  66. se the connected party did not properly respond after a period of time, or estab  
  67. lished connection failed because connected host has failed to respond>  
  68. ]  
  69. Error: Command 'download_from_google_storage --no_resume --platform=win32 --no_a  
  70. uth --bucket chromium-gn -s src/buildtools/win/gn.exe.sha1' returned non-zero ex  
  71. it status 1 in c:\src\source\chromium  
  72. Hook 'download_from_google_storage --no_resume --platform=win32 --no_auth --buck  
  73. et chromium-gn -s src/buildtools/win/gn.exe.sha1' took 23.11 secs  
  74. Traceback (most recent call last):  
  75.   File "automate-git.py", line 879, in <module>  
  76.     chromium_dir, depot_tools_dir)  
  77.   File "automate-git.py", line 55, in run  
  78.     shell=(sys.platform == 'win32'))  
  79.   File "C:\src\depot_tools\python276_bin\lib\subprocess.py", line 540, in check_  
  80. call  
  81.     raise CalledProcessError(retcode, cmd)  
  82. subprocess.CalledProcessError: Command '['gclient', 'sync', '--with_branch_heads  
  83. ', '--jobs', '16']' returned non-zero exit status 2  

 

 

批处理脚本RunDownloads.py.bat

注意代理https不是http

 

[plain]  view plain  copy
 
  1. @rem When Run Command [gclient runhooks]  
  2.   
  3.   
  4. @rem Download_Failed===========================  
  5. @rem download_from_google_storage --no_resume --platform=win32 --directory --recursive --no_auth --num_threads=16 --bucket chromium-apache-win32  --boto=E:\_ChromiumDev\gclient_chromium_src\.boto src/third_party/apache-win32   
  6. @rem Download_Failed===========================  
  7.   
  8. set <span style="color:#FF0000;">https</span>_proxy=http://cn-proxy.jp.oracle.com:80  
  9. call RunWget.bat  gs://chromium-gn/14b37907020b299b5c6bfae1d7fed7d7a92e4fe6 src/buildtools/win/gn.exe  
  10.   
  11.   
  12.   
  13. cmd  

 

RunWget.bat

需要设置wget的环境变量路径Path,

SRC_DIR要根据自己的代码路径设置

 

[plain]  view plain  copy
 
  1. @echo off  
  2. if "%1"=="" goto error  
  3.   
  4. @rem ##########  
  5. @rem 2> File gs://chromium-apache-win32/11ba0c1941b9c46ad279f33c2db3e3c628197ae8 for  
  6. @rem src/third_party/apache-win32\bin\httpd.exe does not exist, skipping.  
  7. @rem 3> File gs://chromium-apache-win32/199cb003a5a40db260f29128ae630f298aaf7702 for  
  8. @rem src/third_party/apache-win32\bin\libapriconv-1.dll does not exist, skipping.  
  9. @rem ##########  
  10. set SRC_DIR=D:\Work_area\CEF3\source\chromium  
  11.   
  12. @rem set param1=gs://chromium-apache-win32/11ba0c1941b9c46ad279f33c2db3e3c628197ae8  
  13. @rem set param2=src/third_party/apache-win32\bin\httpd.exe  
  14. set param1=%1  
  15. set param2=%2  
  16. echo [INFO][%time%] ==========Begin==================  
  17. echo [INFO][%time%] gs_url=%param1%  
  18. set baseurl=https://storage.googleapis.com/  
  19. set baseurl=%baseurl%%param1:~5%  
  20. echo [INFO][%time%] httpBaseUrl=%baseurl%  
  21.   
  22.   
  23. :StartDownload  
  24. @rem 进行一次 文件是否 覆盖的用户交互  
  25. pushd .  
  26. cd %SRC_DIR%  
  27. set cover  
  28. if "%cover%"=="" set cover=2  
  29. if exist %param2% (  
  30.     if %cover%==2 (  
  31.         set /p cover=文件已存在,是否覆盖?[0=不覆盖 1=覆盖]:  
  32.     )  
  33. )  
  34. popd  
  35. if not exist %param2% (  
  36.     goto :continue  
  37. )  
  38. if %cover%==1 goto :continue  
  39. echo [INFO][%time%]================END================  
  40. goto :eof  
  41.   
  42. :continue  
  43. pushd .  
  44. cd %SRC_DIR%  
  45. wget --no-check-certificate %baseurl% -O %param2%  
  46. echo [%time%][SUCCESS] Dwonloads to url:%param2%  success!!!  
  47. echo [INFO][%time%]===============END=================  
  48. popd  
  49. goto :eof  
  50.   
  51. :error  
  52. echo Help:  
  53. echo     %0 [gs://name/hash] [saveToPath]  
  54. pause  

 

各个文件的相对位置结构

 

开始编译

错误skedge.cpp(231) warning C4334

 

[plain]  view plain  copy
 
  1. [4453/15559] CXX obj\third_party\skia\src\core\skia_library.SkEdge.obj  
  2. FAILED: obj/third_party/skia/src/core/skia_library.SkEdge.obj  
  3. ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Stu  
  4. dio 14.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\ski  
  5. a\src\core\skia_library.SkEdge.obj.rsp /c ..\..\third_party\skia\src\core\SkEdge  
  6. .cpp /Foobj\third_party\skia\src\core\skia_library.SkEdge.obj /Fdobj\skia\skia_l  
  7. ibrary.cc.pdb  
  8. c:\src\source\chromium\src\third_party\skia\src\core\skedge.cpp(231): error C222  
  9. 0: warning treated as error - no 'object' file generated  
  10. c:\src\source\chromium\src\third_party\skia\src\core\skedge.cpp(231): warning C4  
  11. 334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit sh  
  12. ift intended?)  
  13. [4458/15559] CXX obj\third_party\skia\src\core\skia_library.SkFlattenable.obj  
  14. ninja: build stopped: subcommand failed.  
  15. Traceback (most recent call last):  
  16.   File "automate-git.py", line 980, in <module>  
  17.     if options.buildlogfile else None)  
  18.   File "automate-git.py", line 55, in run  
  19.     shell=(sys.platform == 'win32'))  
  20.   File "C:\src\depot_tools\python276_bin\lib\subprocess.py", line 540, in check_  
  21. call  
  22.     raise CalledProcessError(retcode, cmd)  
  23. subprocess.CalledProcessError: Command '['ninja', '-C', 'out\\Debug', 'cefclient  
  24. ']' returned non-zero exit status 1  

 

 

解决

在文件source\chromium\src\skia\skia_common.gypi

\source\chromium\src\google_apis\google_apis.gyp

 

[plain]  view plain  copy
 
  1. # We would prefer this to be direct_dependent_settings,  
  2. # however we currently have no means to enforce that direct dependents  
  3. # re-export if they include Skia headers in their public headers.  
  4. 'all_dependent_settings': {  
  5.   'include_dirs': [  
  6.     '..',  
  7.     'config',  
  8.   ],  
  9. },  
  10.   
  11. 'msvs_disabled_warnings': [4244, 4267,<span style="color:#FF6666;"><strong> <span style="color:#FF0000;">4334</span></strong></span>, 4341, 4345, 4390, 4554, 4748, 4800],  

 

error C2679

解决:gl_bindings_skia_in_process.cc和 gl_bindings_skia_in_process.hh已经死代码了。

ui/gl/BUILD.gn和gl.gyp去除这两个引用详见https://codereview.chromium.org/1673323002

 

[html]  view plain  copy
 
  1. FAILED: obj/ui/gl/gl.gl_bindings_skia_in_process.obj  
  2. ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Stu  
  3. dio 14.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\ui\gl\gl.gl_bin  
  4. dings_skia_in_process.obj.rsp /c ..\..\ui\gl\gl_bindings_skia_in_process.cc /Foo  
  5. bj\ui\gl\gl.gl_bindings_skia_in_process.obj /Fdobj\ui\gl\gl.cc.pdb  
  6. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(860): error C267  
  7. 9: binary '=': no operator found which takes a right-hand operand of type 'overl  
  8. oaded-function' (or there is no acceptable conversion)  
  9. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  10.  note: could be 'GrGLInterface::GLPtr<GrGLBufferDataProc> &GrGLInterface::GLPtr<  
  11. GrGLBufferDataProc>::operator =(GrGLInterface::GLPtr<GrGLBufferDataProc> &&)'  
  12. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  13.  note: or       'GrGLInterface::GLPtr<GrGLBufferDataProc> &GrGLInterface::GLPtr<  
  14. GrGLBufferDataProc>::operator =(const GrGLInterface::GLPtr<GrGLBufferDataProc> &  
  15. )'  
  16. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
  17.  note: or       'GrGLInterface::GLPtr<GrGLBufferDataProc> GrGLInterface::GLPtr<G  
  18. rGLBufferDataProc>::operator =(FNPTR_TYPE)'  
  19.         with  
  20.         [  
  21.             FNPTR_TYPE=GrGLBufferDataProc  
  22.         ]  
  23. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(860): note: whil  
  24. e trying to match the argument list '(GrGLInterface::GLPtr<GrGLBufferDataProc>,  
  25. overloaded-function)'  
  26. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(861): error C267  
  27. 9: binary '=': no operator found which takes a right-hand operand of type 'overl  
  28. oaded-function' (or there is no acceptable conversion)  
  29. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  30.  note: could be 'GrGLInterface::GLPtr<GrGLBufferSubDataProc> &GrGLInterface::GLP  
  31. tr<GrGLBufferSubDataProc>::operator =(GrGLInterface::GLPtr<GrGLBufferSubDataProc  
  32. > &&)'  
  33. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  34.  note: or       'GrGLInterface::GLPtr<GrGLBufferSubDataProc> &GrGLInterface::GLP  
  35. tr<GrGLBufferSubDataProc>::operator =(const GrGLInterface::GLPtr<GrGLBufferSubDa  
  36. taProc> &)'  
  37. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
  38.  note: or       'GrGLInterface::GLPtr<GrGLBufferSubDataProc> GrGLInterface::GLPt  
  39. r<GrGLBufferSubDataProc>::operator =(FNPTR_TYPE)'  
  40.         with  
  41.         [  
  42.             FNPTR_TYPE=GrGLBufferSubDataProc  
  43.         ]  
  44. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(861): note: whil  
  45. e trying to match the argument list '(GrGLInterface::GLPtr<GrGLBufferSubDataProc  
  46. >, overloaded-function)'  
  47. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(891): error C267  
  48. 9: binary '=': no operator found which takes a right-hand operand of type 'overl  
  49. oaded-function' (or there is no acceptable conversion)  
  50. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  51.  note: could be 'GrGLInterface::GLPtr<GrGLFlushMappedBufferRangeProc> &GrGLInter  
  52. face::GLPtr<GrGLFlushMappedBufferRangeProc>::operator =(GrGLInterface::GLPtr<GrG  
  53. LFlushMappedBufferRangeProc> &&)'  
  54. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  55.  note: or       'GrGLInterface::GLPtr<GrGLFlushMappedBufferRangeProc> &GrGLInter  
  56. face::GLPtr<GrGLFlushMappedBufferRangeProc>::operator =(const GrGLInterface::GLP  
  57. tr<GrGLFlushMappedBufferRangeProc> &)'  
  58. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
  59.  note: or       'GrGLInterface::GLPtr<GrGLFlushMappedBufferRangeProc> GrGLInterf  
  60. ace::GLPtr<GrGLFlushMappedBufferRangeProc>::operator =(FNPTR_TYPE)'  
  61.         with  
  62.         [  
  63.             FNPTR_TYPE=GrGLFlushMappedBufferRangeProc  
  64.         ]  
  65. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(891): note: whil  
  66. e trying to match the argument list '(GrGLInterface::GLPtr<GrGLFlushMappedBuffer  
  67. RangeProc>, overloaded-function)'  
  68. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(920): error C267  
  69. 9: binary '=': no operator found which takes a right-hand operand of type 'overl  
  70. oaded-function' (or there is no acceptable conversion)  
  71. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  72.  note: could be 'GrGLInterface::GLPtr<GrGLMapBufferRangeProc> &GrGLInterface::GL  
  73. Ptr<GrGLMapBufferRangeProc>::operator =(GrGLInterface::GLPtr<GrGLMapBufferRangeP  
  74. roc> &&)'  
  75. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
  76.  note: or       'GrGLInterface::GLPtr<GrGLMapBufferRangeProc> &GrGLInterface::GL  
  77. Ptr<GrGLMapBufferRangeProc>::operator =(const GrGLInterface::GLPtr<GrGLMapBuffer  
  78. RangeProc> &)'  
  79. c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
  80.  note: or       'GrGLInterface::GLPtr<GrGLMapBufferRangeProc> GrGLInterface::GLP  
  81. tr<GrGLMapBufferRangeProc>::operator =(FNPTR_TYPE)'  
  82.         with  
  83.         [  
  84.             FNPTR_TYPE=GrGLMapBufferRangeProc  
  85.         ]  
  86. c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(920): note: whil  
  87. e trying to match the argument list '(GrGLInterface::GLPtr<GrGLMapBufferRangePro  
  88. c>, overloaded-function)'  
  89. [757/7473] CXX obj\ui\gl\gl.gl_bindings_autogen_gl.obj  
  90. ninja: build stopped: subcommand failed.  
  91. Traceback (most recent call last):  
  92.   File "automate-git.py", line 980, in <module>  
  93.     if options.buildlogfile else None)  
  94.   File "automate-git.py", line 55, in run  
  95.     shell=(sys.platform == 'win32'))  
  96.   File "C:\src\depot_tools\python276_bin\lib\subprocess.py", line 540, in check_  
  97. call  
  98.     raise CalledProcessError(retcode, cmd)  
  99. subprocess.CalledProcessError: Command '['ninja', '-C', 'out\\Debug', 'cefclient  
  100. ']' returned non-zero exit status 1  

 

error C4430

#解决egl语法错误
#修改h:\ws\source\chromium\src\third_party\swiftshader\include\egl\eglext.h
#在62行后加入
typedef EGLAttribKHR EGLAttrib; 

[plain]  view plain  copy
 
  1. FAILED: obj/ui/gl/gl.egl_util.obj  
  2. ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Stu  
  3. dio 14.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\ui\gl\gl.egl_ut  
  4. il.obj.rsp /c ..\..\ui\gl\egl_util.cc /Foobj\ui\gl\gl.egl_util.obj /Fdobj\ui\gl\  
  5. gl.cc.pdb  
  6. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(119): er  
  7. ror C4430: missing type specifier - int assumed. Note: C++ does not support defa  
  8. ult-int  
  9. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(119): er  
  10. ror C2143: syntax error: missing ',' before '*'  
  11. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(120): er  
  12. ror C2061: syntax error: identifier 'EGLAttrib'  
  13. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(515): er  
  14. ror C2061: syntax error: identifier 'EGLAttrib'  
  15. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(518): er  
  16. ror C2061: syntax error: identifier 'EGLAttrib'  
  17. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(585): er  
  18. ror C4430: missing type specifier - int assumed. Note: C++ does not support defa  
  19. ult-int  
  20. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(585): er  
  21. ror C2143: syntax error: missing ',' before '*'  
  22. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(586): er  
  23. ror C4430: missing type specifier - int assumed. Note: C++ does not support defa  
  24. ult-int  
  25. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(586): er  
  26. ror C2143: syntax error: missing ',' before '*'  
  27. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(587): er  
  28. ror C2061: syntax error: identifier 'EGLAttrib'  
  29. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(588): er  
  30. ror C2061: syntax error: identifier 'EGLAttrib'  
  31. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(590): er  
  32. ror C2061: syntax error: identifier 'EGLAttrib'  
  33. c:\src\source\chromium\src\third_party\swiftshader\include\egl\eglext.h(591): er  
  34. ror C2061: syntax error: identifier 'EGLAttrib'  

Release下链接错误

[html]  view plain  copy
 
  1. ffmpeg.lib(ffmpeg.wavdec.obj) : error LNK2001: unresolved external symbol _ff_w64_guid_data  

chromium/third_party/ffmpeg /ffmpeg_generated.gni
[cpp]  view plain  copy
 
  1. "libavformat/vorbiscomment.c",  
改成
[cpp]  view plain  copy
 
  1. "libavformat/vorbiscomment.c",  
  2. "libavformat/w64.c",  

chromium/third_party/ffmpeg /ffmpeg_generated.gypi
[cpp]  view plain  copy
 
  1. 'libavformat/vorbiscomment.c',  

改成
[cpp]  view plain  copy
 
  1. 'libavformat/vorbiscomment.c',  
  2. 'libavformat/w64.c',  

参考:https://ffmpeg.org/pipermail/ffmpeg-devel/2016-May/194142.html

修改代码


[plain]  view plain  copy
 
  1. Refused to display in a frame because it set 'X-Frame-Options' to  


[cpp]  view plain  copy
 
  1. bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, const KURL& url, unsigned long requestIdentifier)  
  2. {  
  3.     return false;  
  4. }  

运行错误

错误代码:

Error Code: -130 Failed to load web page (unknown error).

原因

IE的代理问题,比如可能是代理没设置对,或者不需要代理

 

CEF3版本升级需要porting的代码文件

比如从cef_binary_3.2454.1323.g71c7271_windows32 -->cef_binary_3.2704.1434.gec3e9ed_windows32

cefclient\browser\client_handler.cc

操作视窗,拖放客户区,缩放

 

[cpp]  view plain  copy
 
  1. // Window Manipulator  
  2. const char kDrag[]        = "kDrag";  
  3. const char kRestore[]     = "kRestore";  
  4. const char kMinimize[]    = "kMinimize";  
  5. const char kMaximize[]    = "kMaximize";  
  6. const char kFullscreen[]  = "kFullscreen";  
  7. const char kShow[]        = "kShow";  
  8. const char kHide[]        = "kHide";  

 

[cpp]  view plain  copy
 
  1. // Check for messages from the client renderer.  
  2. std::string message_name = message->GetName();  
  3. if (message_name == kFocusedNodeChangedMessage) {  
  4.   // A message is sent from ClientRenderDelegate to tell us whether the  
  5.   // currently focused DOM node is editable. Use of |focus_on_editable_field_|  
  6.   // is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent  
  7.   // but is useful for demonstration purposes.  
  8.   focus_on_editable_field_ = message->GetArgumentList()->GetBool(0);  
  9.   return true;  
  10. else if (message_name == kDrag) { // Window Manipulator  
  11.   RootWindow::GetWindow(browser)->Drag();  
  12.   return true;  
  13. else if (message_name == kRestore) {  
  14.   RootWindow::GetWindow(browser)->Restore();  
  15.   return true;  
  16. else if (message_name == kMinimize) {  
  17.   RootWindow::GetWindow(browser)->Minimize();  
  18.   return true;  
  19. else if (message_name == kMaximize) {  
  20.   RootWindow::GetWindow(browser)->Maximize();  
  21.   return true;  
  22. }  

 

[cpp]  view plain  copy
 
  1. bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,  
  2.                                      const CefString& message,  
  3.                                      const CefString& source,  
  4.                                      int line) {  


cefclient\browser\main_context_impl.cc

 

修改首页初始访问的URL

 

[cpp]  view plain  copy
 
  1. // The default URL to load in a browser window.  
  2. const char kDefaultUrl[] = "http://happ/index.html"; // "http://www.google.com";  


cefclient\browser\resource_util_win.cc

 

如果需要添加资源,比如图标之类的才需要修改这里

cefclient\browser\root_window_win.cc

窗口的初始化,比如全屏,可缩放等窗口风格设置

 

转载于:https://www.cnblogs.com/micro-chen/p/6992443.html

相关文章:

  • Android之用HTTP的get,post,HttpClient三种方式向service提交文本数据
  • PCB原理图库
  • mysql相关故障
  • Win7 打开网页超级慢的解决方案
  • Java并发和多线程3:线程调度和有条件取消调度
  • Android之使用Http协议实现文件上传功能
  • poi API大全
  • Authentication和Authrization(上)
  • std::bind()图解
  • perl概述
  • Thinkphp中在本地测试很好,在服务器上出错,有可能是因为debug缓存的问题
  • perl入门--语法和结构(1)
  • 6月15日云栖精选夜读:阿里配管专家解读:如何最优成本搭建非标准的iOS构建集群...
  • Android下实现电话号码归属地的查询
  • 【转】设计模式总结
  • 网络传输文件的问题
  • Android框架之Volley
  • Apache Pulsar 2.1 重磅发布
  • JavaWeb(学习笔记二)
  • log4j2输出到kafka
  • php ci框架整合银盛支付
  • php面试题 汇集2
  • React+TypeScript入门
  • SpringBoot 实战 (三) | 配置文件详解
  • SpringBoot几种定时任务的实现方式
  • 对话:中国为什么有前途/ 写给中国的经济学
  • 复杂数据处理
  • 那些年我们用过的显示性能指标
  • 使用putty远程连接linux
  • 双管齐下,VMware的容器新战略
  • ​​​​​​​GitLab 之 GitLab-Runner 安装,配置与问题汇总
  • ​sqlite3 --- SQLite 数据库 DB-API 2.0 接口模块​
  • ​第20课 在Android Native开发中加入新的C++类
  • ​二进制运算符:(与运算)、|(或运算)、~(取反运算)、^(异或运算)、位移运算符​
  • # Maven错误Error executing Maven
  • # 学号 2017-2018-20172309 《程序设计与数据结构》实验三报告
  • #HarmonyOS:Web组件的使用
  • #免费 苹果M系芯片Macbook电脑MacOS使用Bash脚本写入(读写)NTFS硬盘教程
  • (2022版)一套教程搞定k8s安装到实战 | RBAC
  • (env: Windows,mp,1.06.2308310; lib: 3.2.4) uniapp微信小程序
  • (翻译)Entity Framework技巧系列之七 - Tip 26 – 28
  • (附源码)spring boot智能服药提醒app 毕业设计 102151
  • (论文阅读笔记)Network planning with deep reinforcement learning
  • (实战篇)如何缓存数据
  • (转)重识new
  • .babyk勒索病毒解析:恶意更新如何威胁您的数据安全
  • .bat批处理(六):替换字符串中匹配的子串
  • .htaccess 强制https 单独排除某个目录
  • .net 4.0发布后不能正常显示图片问题
  • .net redis定时_一场由fork引发的超时,让我们重新探讨了Redis的抖动问题
  • .net 打包工具_pyinstaller打包的exe太大?你需要站在巨人的肩膀上-VC++才是王道
  • .Net 中的反射(动态创建类型实例) - Part.4(转自http://www.tracefact.net/CLR-and-Framework/Reflection-Part4.aspx)...
  • .NET/ASP.NETMVC 大型站点架构设计—迁移Model元数据设置项(自定义元数据提供程序)...
  • .net快速开发框架源码分享
  • @Builder用法