Cef概覽

CEF General Usage(CEF3預覽)

介紹

CEF全稱Chromium Embedded Framework,是一個基於Google Chromium 的開源項目。Google Chromium項目主要是爲Google Chrome應用開發的,而CEF的目標則是爲第三方應用提供可嵌入瀏覽器支持。CEF隔離底層Chromium和Blink的複雜代碼,並提供一套產品級穩定的API,發佈跟蹤具體Chromium版本的分支,以及二進制包。CEF的大部分特性都提供了豐富的默認實現,讓使用者做盡量少的定製即可滿足需求。在本文發佈的時候,世界上已經有很多公司和機構採用CEF,CEF的安裝量超過了100萬。[CEF wikipedia]頁面上有使用CEF的公司和機構的不完全的列表。CEF的典型應用場景包括:

  • 嵌入一個兼容HTML5的瀏覽器控件到一個已經存在的本地應用。
  • 創建一個輕量化的殼瀏覽器,用以託管主要用Web技術開發的應用。
  • 有些應用有獨立的繪製框架,使用CEF對Web內容做離線渲染。
  • 使用CEF做自動化Web測試。

CEF3是基於Chomuim Content API多進程構架的下一代CEF,擁有下列優勢:

  • 改進的性能和穩定性(JavaScript和插件在一個獨立的進程內執行)。
  • 支持Retina顯示器
  • 支持WebGL和3D CSS的GPU加速
  • 類似WebRTC和語音輸入這樣的前衛特性。
  • 通過DevTools遠程調試協議以及ChromeDriver2提供更好的自動化UI測試
  • 更快獲得當前以及未來的Web特性和標準的能力

本文檔介紹CEF3開發中涉及到的一般概念。

開始

使用二進制包

CEF3的二進制包可以在這個頁面下載。其中包含了在特定平臺(Windows,Mac OS X 以及 Linux)編譯特定版本CEF3所需的全部文件。不同平臺擁有共同的結構:

  • cefclient
  • Debug
  • include
  • libcef_dll
  • Release
  • Resources
  • tools

Each binary distribution also contains a README.txt file that describes the platform-specific distribution in greater detail and a LICENSE.txt file that contains CEF’s BSD license. When distributing an application based on CEF you should include the license text somewhere in your application’s distribution. For example, you can list it on an “About” or “Credits” page in your application’s UI, or in the documentation bundled with your application. License and credit information is also available inside of a CEF3 browser window by loading “about:license” and “about:credits” respectively.

Applications based on CEF binary distributions can be built using standard platform build tools. This includes Visual Studio on Windows, Xcode on Mac OS X and gcc/make on Linux. The project Downloads page contains information about the OS and build tool versions required for specific binary releases. When building on Linux also pay careful attention to the listed package dependencies.

See the Tutorial Wiki page for detailed instructions on how to create a simple application using the CEF3 binary distribution.

Building from Source Code

CEF can be built from source code either locally or using automated build systems like TeamCity. This requires the download of Chromium and CEF source code via either Subversion (SVN) or Git. The Chromium code base is quite large and building Chromium from source code is only recommended on moderately powerful machines with more than 4GB of RAM. Detailed instructions for building Chromium and CEF from source code are available on the BranchesAndBuilding page.

Sample Application

示例應用程序

The cefclient sample application is a complete working example of CEF integration and is included in source code form with each binary distribution. The easiest way to create a new application using CEF is to start with the cefclient application and remove the parts that you don’t need. Many of the examples in this document originate from the cefclient application.

cefclient是一個完整的CEF客戶端應用程序示例,並且它的源碼包含在CEF每個二進制發佈包中。使用CEF創建一個新的應用程序,最簡單的方法是先從cefclient應用程序開始,刪除你不需要的部分。本文檔中許多示例都是來源於cefclient應用程序。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章