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

窗口的初始化,比如全屏,可縮放等窗口風格設置

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM