Chromium Embedded Framework 中文文档(简介)

简介

Chromium Embedded Framework (CEF)是由 Marshall Greenblatt 在2008年创办的开源项目,致力于基于Google Chromium项目开发一个Web控件。 CEF目前已支持多种编程语言和操作系统,能方便地集成到现有或者新的应用程序中,设计上,它追求高性能的同时,也追求易于使用,它的基本框架通过原生库提供C和C++的编程接口,这些接口将宿主程序与Chromium与WebKit的实现细节隔离,能让浏览器与应用程序无缝集成,并支持自定义插件、协议、Javascript对象与扩展。宿主程序还能根据需要控制资源加载、页面跳转、上下文菜单、打印等等。这些好处都是在支持Google Chrome同等效率与HTML5技术可用的基本上提供的。
大量的个人与组织为CEF的开发提供了时间与资源上的贡献,但是我们需要社区更多的投入,来支持CEF核心项目与扩展地对其它语言与框架提供支持的项目(参见扩展项目一节)。如果你有兴趣为CEF提供时间与金钱上的支持,请参见

 CEF Donations 页面。


编译发行版本

编译发行版本,包涵所有构建基于CEF应用程序所需的文件,在下载章节提供下载,该版本是可以独立使用的,不依赖于CEF或者Chromium的源代码。


源代码发行版本

CEF项目是Chromium项目(http://chromium.org)的扩展项目,因此,要编译CEF源代码需要先下载Chromium源代码(下载方式见http://dev.chromium.org/developers/how-tos/get-the-code)并且根据你所选的系统与编译指示安装所有依赖的项目;然后,将CEF的文件放在Chromium的src目录顶层,跟base/chrome/thrid-party这些目录一起,比方说如果你的Chromium安装目录是C:\svn\Chromium\src那么CEF的文件应该在C:\svn\Chromium\src\cef。CHROMIUM_BUILD_COMPATIBILITY.txt 文件有CEF与Chromium版本兼容性的说明信息,如果要将Chromium升级某一版本,使用
gclient sync --revision src@#### --force,

此外,DEPS文件将确保其它目录以合适的形式下载。在大多数系统下,编译需要提供至少4GB内存。


在Windows下编译

跟随你的Visual Studio版本的 Windows build instructions ,运行CEF根目录下的cef_create_projects.bat脚本,根据GYP的配置生成Visual Stodio项目文件。如果你机器上同时安装了VS2005和VS2008,那么在运行cef_create_projects脚本前,可通过设置GYP_MSVS_VERSION 环境变量为"2005" 或"2008"来指定版本。

通过将gclient工具集成到CEF,可以自动在Chromium源代码更新后下载CEF源代码更新和运行cef_create_projects。编辑位于Chromium src目录父目录(上例中是"C:\svn\Chromium") 的.gclient文件,在已有的solutions数组中添加如下的行:

solutions = [ { #Existing definitions here... }, # BEGIN NEW LINES { "name"        : "src/cef",     "url"         : "http://chromiumembedded.googlecode.com/svn/trunk", }, #END NEW LINES ]

Mac OS X下编译

目前仅支持Mac OS X 10.6 (Snow Leopard) 和10.7 (Lion) ,编译结果可运行于10.5, 10.6 and 10.7。根据Mac build instructions正确的配置系统,如果是10.7和Xcode 4,请遵循Xcode4Tips中额外的编译指示。

运行CEF根目录下的cef_create_projects.sh可根据GYP的配置生成XCode项目文件。


Linux下的编译

开发中。

扩展项目

CEF基础框架支持C和C++语言,感谢其它维护者的努力工作,CEF可以支持更多的编程语言与框架。这些扩展项目并非由CEF团队维护,所以如果你有任何问题,请直接联系各项目的维护者。

如果你维护着一个不在这个列表中的项目,请到CEF Forum发贴或者直接联系Marshall。

支持

General Usage Wiki page提供使用CEF的概览,CEF支持与相关讨论在CEF Forum中进行。

帮助

CEF仍有大量工作需要开展,如果你想为CEF做出贡献请查看Open状态的Issue,或者在CEF的源代码中搜索TODO,我们还需要人为所有支持的功能编写测试用例。

重大更改

此处并未列出所有的版本,完整版本列表请查看 Changes list

9月 23, 2011: 编译版本293,添加对VS2010的支持,并包含以下改进与Bug修复:

August 9, 2011: Binary release 275 contains the following enhancements and bug fixes.

  • 关闭触摸屏的支持,以使Google Map API功能正常( issue #134 ).
  • 修复一个执行大量同步加载请求时死循环的bug ( issue #192 ).
  • 修复OnResourceResponse拼写错误( issue #270 ).
  • 修复一个在某些情况下关机时会造成Crash的线程问题( issue #277 ).
  • 增加accelerated_video_enabled, accelerated_drawing_enabled 和accelerated_plugins_enabled浏览器设置( issue #278 ).
  • 添加在某些windows机器上加速内容需要的d3dx9_43.dll和d3dcompiler_43.dll文件( issue #280 ).
  • 清理模态窗口回调实现 ( issue #281 ).
  • 关闭语音输入,避免在Google搜索页面点话筒图标会crash的问题。 ( issue #282 ).
  • 当将drag_drop_disabled 设为true时禁用HTML5 drag( issue #284 ).
  • 修复在取消popup窗口时crash的问题( issue #285 ).

June 14, 2011: Binary release 259 significantly revamps the CEF API and contains the following enhancements and bug fixes.

  • 使用angle库支持GL ( issue #136 ).
  • CefV8Value 添加Date类型支持( issue #190 ).
  • Add a workaround for the SyncRequestProxy deadlock problem ( issue #192 ).
  • Replace CefHandler with a new CefClient interface and separate handler interfaces ( issue #218 ).
  • Add support for virtual inheritance to allow multiple CefBase parented interfaces to be implemented in the same class ( issue #218 ).
  • Replace CefThreadSafeBase with IMPLEMENT macros to support virtual inheritance and to only provide locking implementations when needed ( issue #218 ).
  • Move the CefBrowserSettings parameter from CefInitialize to CreateBrowser ( issue #218 ).
  • Add a new cef_build.h header that provides platform-specific and OS defines ( issue #218 ).
  • Introduce the use of OVERRIDE to generate compiler errors on Windows if a child virtual method declaration doesn't match the parent declaration ( issue #218 ).
  • Move CEF header files that should not be directly included by the client to the "include/internal" folder ( issue #218 ).
  • Add support for navigator.onLine and online/offline window events ( issue #234 ).
  • Use NDEBUG instead of _DEBUG because _DEBUG is not defined on Mac ( issue #240 ).
  • Add OnResourceReponse and CefContentFilter for viewing and filtering response content ( issue #241 ).
  • Add support for setting response header values ( issue #246 ).
  • Break CefRegisterScheme into separate CefRegisterCustomScheme and CefRegisterSchemeHandlerFactory functions ( issue #246 ).
  • Allow registration of handlers for built-in schemes ( issue #246 ).
  • Supply scheme and request information to CefSchemeHandlerFactory::Create ( issue #246 ).
  • Add CrossOriginWhitelist functions for bypassing the same-origin policy with both built-in and custom standard schemes ( issue #246 ).
  • Add support for modal dialogs ( issue #250 ).
  • Add support for IME-aware applications ( issue #254 ).
  • Restore keyboard focus on window activation ( issue #256 ).
  • Fix bug when dragging to a window before mouse events have been detected ( issue #262 ).

May 10, 2011: Binary release 231 contains the following enhancements and bug fixes.

  • Add cookie get/set support ( issue #88 ).
  • Allow custom schemes to cause redirects ( issue #98 ).
  • Set the libcef.dll version number to the build revision number ( issue #108 ).
  • Add support for returning an HTTP status code from HandleBeforeResourceLoad and custom scheme handlers via the CefResponse class ( issue #202 ).
  • Add support for V8 accessors and entering a V8 context asynchronously ( issue #203 ).
  • Don't load URLs twice for popup windows ( issue #215 ).
  • Make modal popup windows behave the same as non-modal popup windows ( issue #216 ).
  • Force Flash and Silverlight plugins to use windowless mode when rendering off-screen ( issue #214 ).
  • Don't download files that will be loaded by a plugin ( issue #227 ).
  • Add a CefDOMNode::IsSame() method for comparing CefDOMNode objects.

March 25, 2011: Binary release 212 contains the following enhancements and bug fixes.

  • Add off-screen rendering support ( issue #100 ).
  • Add persistent storage support for cookie data ( issue #193 ).
  • Allow registration of non-standard schemes ( issue #195 ).
  • Improve the behavior of HandleAddressChange, HandleTitleChange, HandleLoadStart and HandleLoadEnd notifications ( issue #200 ).
  • Respect the WS_VISIBLE flag when creating browser windows ( issue #201 ).
  • Fix a bug in CefWebURLRequest that could result in inappropriate calls to CefHandler methods ( issue #204 ).
  • Add a history entry when navigating to anchors within the same page ( issue #207 ).
  • Add a HandleNavStateChange notification for back/forward state changes ( issue #208 ).
  • Fix crash when using WebKit inspector break points ( issue #210 ).
  • Add support for retrieving values from DOM form elements using CefDOMNode::GetValue.
  • Add the CefRunMessageLoop() function for efficient message loop processing in single-threaded message loop mode.

February 28, 2011: Binary release 195 contains the following enhancements and bug fixes.

  • Add the CefWebURLRequest class that supports direct loading of URL resources from client applications ( issue #51 ).
  • Add CefDOM classes and the CefFrame::VisitDOM method that allow direct access to and modification of the DOM ( issue #60 ).
  • Add support for the HTML5 drag and drop API and support for dragging content to other applications or the desktop (issue #140).
  • Add a CefV8Context object and CefV8Value::ExecuteFunctionWithContext method to support asynchronous V8 callbacks ( issue #188 ).
  • CefRegisterPlugin now only supports a single mime type per registration.
  • Fix a bug where URL and title change notifications were not being sent for CefFrame::LoadString.

February 1, 2011: Binary release 181 will be the last binary release that includes libraries for VS2005. It contains the following enhancements and bug fixes.

  • Improve thread safety by making some methods only callable on the UI thread ( issue #175 ).
  • Add NewCefRunnableMethod and NewCefRunnableFunction templates (in cef_runnable.h) that simplify task posting ( issue #175 ).
  • Add a boolean argument to the HandleLoadStart and HandleLoadEnd events that will be true while the main content frame is loading ( issue #166  issue #183 ).
  • Add an HTTP status code argument to the HandleLoadEnd event ( issue #177 ).
  • Only call the HandleAddressChange and HandleTitleChange events for the main content frame load ( issue #166 )
  • Pass the URL for new popup windows to the HandleBeforeCreated event (issue #5).
  • Add members to the CefSettings structure for specifying log file location and severity level ( issue #172 ).
  • Add single sign-on support ( issue #148 ).
  • Add zooming support ( issue #116 ).
  • Add developer tools support ( issue #127 ).
  • Add a HandleProtocolExecution event for handling unregistered protocols ( issue #155 ).
  • Add a HandleStatus event for status messages, mouse over URLs and keyboard focus URLs ( issue #61 ).
  • Add support for creating and parsing URLs via CefCreateURL and CefParseURL ( issue #181 ).
  • Fix the problem with frame activation when displaying SELECT list popups ( issue #169 ).
  • Accelerated compositing and HTML5 video now work together ( issue #143 ).

November 22, 2010: Revision 149 introduces a number of long-awaited features and a few important bug fixes.

  • The API now uses CefString and cef_string_t types instead of std::wstring and wchar_t. The new types support conversion between ASCII, UTF-8, UTF-16 and UTF-32 character formats and the default character type can be changed by recompiling CEF ( issue #146 ).
  • Allow customization of global and per-browser settings for everything from User-Agent and plugin search paths to specific WebKit features ( issue #145 ).
  • Add support for accelerated compositing and fast WebGL ( issue #136 ). You will need to disable accelerated compositing to watch HTML5 video with this release ( issue #143 ).
  • Expose popup window feature information via the CefPopupFeatures argument passed to CefHandler::HandleBeforeCreated ( issue #135 ).
  • Fix a crash caused by Flash-related JavaScript ( issue #115 ).

November 15, 2010: Revision 137 provides the first working build of CEF for the Mac OS X platform (issue #68). There's still a lot of work required to bring it up to par with the Windows port. Missing features are indicated by "TODO(port)" comments in the source code. Help with fixing bugs and implementing missing features is welcome.

October 24, 2010: Revision 126 disables WebGL support due to performance problems with the default Chromium implementation. WebGL support will be re-enabled once a better-performing implementation is available ( issue #136 ).

  • Add a CefHandler::HandleDownloadResponse() method for handling Content-Disposition initiated file downloads ( issue #6 ).
  • Add XML parsing support with CefXmlReader and CefXmlObject classes ( issue #28 ).
  • Add Zip archive reading support with CefZipReader and CefZipArchive classes (issue #30).
  • Add a new cef_wrapper.h header file that exposes helpful utility classes provided as part of the libcef_dll_wrapper target.

October 15, 2010: Revision 116 causes CEF to ignore the "Automatically detect settings" option under LAN Settings in order to fix a problem with slow resource loading on Windows ( issue #81 ). Manual configuration under LAN Settings is still respected.

  • Add a CefBrowser::ReloadIgnoreCache() method and MENU_ID_NAV_RELOAD_NOCACHE menu support. ( issue #118 ).
  • Add support for audio playback with HTML5 video ( issue #121 ).
  • Fix back/forward navigation when the history contains pages that failed to load ( issue #125 ).
  • Change the CEF User-Agent product version to "Chrome/7.0.517.0"

August 31, 2010: Revision 100 re-introduces the CefHandler::HandleJSBinding method. The memory leaks that necessitated the elimination of this method have now been fixed ( issue #72 ).

  • The CefRequest argument to CefHandler::HandleBeforeResourceLoad can now be modified allowing the request to be changed on the fly ( issue #41 ).
  • A default tooltip implementation is now provided and tooltip text can be modified using CefHandler::HandleTooltip ( issue #61 ).
  • Printing paper size, orientation and margins can now be changed using CefHandler::HandlePrintOptions ( issue #112 ).
  • Find in page with result highlighting is now supported using CefBrowser::Find, CefBrowser::StopFinding and CefHandler::HandleFindResult.
  • The binary release of revision 100 provides libraries for both Visual Studio 2005 and Visual Studio 2008. It can be downloaded from the project Downloads page.

April 7, 2010: Revision 73 eliminates the CefHandler::HandleJSBinding method. This modification addresses memory leaks that many users have been reporting. For more information see  issue #72 .

October 2, 2009: Revision 50 adds GYP support for generating the CEF project files. This makes it easy to build CEF with both VS2005 and VS2008. See the "Source Distributions" section above for additional details.

August 21, 2009: Revision 37 adds support for custom scheme handlers. Use the new CefRegisterScheme() function in combination with the CefSchemeHandlerFactory and CefSchemeHandler classes to create handlers for requests using custom schemes such as myscheme://mydomain.

July 24, 2009: Revision 32 helps to speed up the addition of new features and bug fixes to CEF. It adds the CEF Patch Application Tool and the "patch" project which together support automatic application of patches to the Chromium and WebKit source trees as part of the build process. See the README.txt file in the new patch directory for additional information.

July 8, 2009: CEF now has a dedicated build bot thanks to Nicolas Sylvain and Darin Fisher over at Google. The build bot synchronizes to each Chromium revision and then builds CEF, reporting on any compile errors that occur. Having a build bot for CEF will help the Chromium developers avoid accidentally breaking API features required by CEF, and help the CEF developers keep up with the frequently changing Chromium HEAD revision. You can view the build bot output at http://build.chromium.org/buildbot/waterfall.fyi/waterfall?branch=&builder=Chromium+Embedded

June 20, 2009: Revision 30 adds the CEF Translator Tool which facilitates automatic generation of the C API header file (cef_capi.h) and CToCpp/CppToC wrapper classes. See the translator.README.txt file in the new tools directory for additional information. Introduction of this tool required minor changes to the CEF C++ and C APIs.

  • The C++ 'arguments' attribute of CefV8Handler::Execute() and CefV8Value::ExecuteFunction() now has the 'const' qualifier.
  • C API global function names that were previously in the cef_create_classname() format are now in the cef_classname_create() format.
  • The C API cef_frame_t::get_frame_names() member function now has return type 'void' instead of 'size_t'.
  • The C API cef_frame_t::execute_javascript() member function has been renamed to cef_frame_t::execute_java_script().

May 27, 2009: Revision 26 introduces two major changes to the CEF framework.

  • Frame-dependent functions such as loading content and executing JavaScript have been moved to a new CefFrame class. Use the new CefBrowser::Get*Frame() methods to retrieve the appropriate CefFrame instance. A CefFrame instance will now also be passed to CefHandler callback methods as appropriate.
  • The CEF JavaScript API now uses the V8 framework directly instead of creating NPObjects. JavaScript object hierarchies can be written in native C++ code and exported to the JavaScript user-space, and user-space object hierarchies can be accessed from native C++ code. Furthermore, support for the V8 extension framework has been added via the new CefRegisterExtension() function. The CefJSHandler and CefVariant classes have been removed in favor of new CefV8Handler and CefV8Value classes. To attach values to the JavaScript 'window' object you must now implement the CefHandler::HandleJSBinding() callback method instead of calling the (now removed) CefBrowser::AddJSHandler() method.
posted @ 2011-10-06 00:00  Think  阅读(48692)  评论(4编辑  收藏  举报