Official homepage: Click to open the link. CEF introduction:
The embedded chromium framework (CEF) is an open-source project established by Marshall Greenblatt in 2008. It aims to develop a Google chromium-based webbrowser control. CEF supports a series of programming languages and operating systems and can easily be integrated into new or existing projects.
Its design ideology and politics are both easy-to-use and performance-oriented. The basic framework of CEF includes C/C ++ program interfaces, which are implemented through the interface of the local database. This library isolates the operation details of the Host Program and chromium & WebKit. It provides close integration between browser controls and host programs. It supports user plug-ins, protocols, JavaScript objects, and JavaScript extensions. The host program can freely download and navigate control resources, the following content and printing, and can be followed by Google
Chrome supports both high-performance and HTML5 technologies,
CEF guide:
Guide:
First, insert this code into the window creation function:
// Create an instance of our CefClient implementation. Various methods in the// MyClient instance will be called to notify about and customize browser// behavior. CefRefPtr<CefClient> client(new MyClient());// Information about the parent window, client rectangle, etc.CefWindowInfo info;info.SetAsChild(...);// Browser initialization settings.CefBrowserSettings settings;// Create the new browser window object asynchronously. This eventually results// in a call to CefLifeSpanHandler::OnAfterCreated().CefBrowser::CreateBrowser(info, client, "http://www.google.com", settings);
You can see this code in the cefclient project under the [test] folder.
File structure:
Include -- this folder contains the header files required by the CEF client application.
Libcef -- this folder stores the static library of CEF
Libcef_dll -- Dynamic zip library of CEF in this folder
Tests -- Example of storing the test in this folder
Cefclient-a simple client program
Unittests-CEF interface unit test
Browser events: applications call the methods cefbrowser and cefframe to handle browser control events: a. Back, forward, reload and stop load. Control browser navigation B. Undo, redo, cut, copy, paste, delete, select all. control target framework selection C. Print. Print the target framework D. Get source. Obtain the HTML source code E of the target framework in the form of a string. view Source. use a cached file to save the HTML source code of the target framework, and use the system's default text viewer to open F. load URL. load a specific URL to the target framework G. load string. load a specific string to the target framework, and use a randomly specified virtual url h. load stream. load a specific binary file to the target framework, and use a randomly specified virtual url I. load request, load a specific request to the target framework J. execute javascript: execute a specific javscript command K in the target framework. zoom. Zoom in and out the webpage content of a specific framework and insert the Netscape Plugin: CEF supports inserting the Netscape plugin. The insert plugin works the same way as inserting the plugin of the basic dynamic link library normally, but as a separate DLL, it must be created through the container and registered to the system using the cefregisterplugin () function. To call this function, you must include the header file cef_nplugin.h. Javascript Extension: CEF supports JavaScript extension that can connect to the source code of the local program. You can see the cef_v8.h and cefregisterextension () method for the demo program, and the demo example below cefclient, if you want more information, click the following link: javascriptintegration. User plan: CEF supports registering and processing user plans like myscheme: // mydomain. You can view the cefregisterscheme () and scheme handler test units in cef_scheme.h for detailed instructions. Framework Overview: All file prefixes are created and destroyed by the CEF framework. The cef ui messages are hosted in a single thread established by a framework. You are only responsible for using cefinitialize () and cefshutdown () to create and destroy this thread, but if you set cefsettings. multi_threaded_message_loop,
This UI message loop can also run in a separate thread. Reference count: the number of all frames is inherited from the cefbase base class, And all instance pointers are managed using the cefrefptr smart pointer. You can use addref () and release () function to automatically process the reference count. Platform-independent: the CEF framework is designed to be platform-independent. Now it supports windows, Mac OS-X, and Linux. to seamlessly support multiple platforms, the Framework defines a series of platform-independent interfaces and types. Framework interface: cefbrowser is the main browser window class. You can use static functions createbrowser () and createbrowsersync () to create a new browser window. Cefframe represents the frame of a browser window. Each browser window has a top-level main frame, which can be obtained using the getmainframe () method. Cefclient is the representative interface of the main browser window. This interface is passed as a parameter to createbrowser () cefrequest to represent a request such as URL, method, and data and header file. The cefschemehandlefactory class is used to process requests like myscheme: // mydomain similar to customer plans
Cefreadhandler and cefwritehandle are simple interfaces for reading and writing data.
Cefv8handler, cefv8value, and cefv8context are used to create and access JavaScript objects.
The above content is a brief introduction to CEF. How can I compile and generate a simple browser created with the CEF control!