Browser plugin based on Firebreath developed for multi-browser support under Mac
The first thing to distinguish between browser extension and browser plug-ins, plug-ins can do as much as local programs
I. About Firebreath
http://www.firebreath.org
Firebreath is a boast platform, boast browser, the development of browser plugin framework;
Browser plugins developed with Firebreath can be installed on multiple browsers and provide solutions for multiple platforms such as Mac,windows
Two. About Mac using Firebreath to develop browser plugin
Official Tutorials Http://www.firebreath.org/display/documentation/Building+on+Mac+OS+X
1. What is necessary
Install cmake http://www.cmake.org/download/recommended download source package, view Readme Manual Compilation installation
XOCDE installed on Mac
Xcode has Command line Tools installed
Firebreath Toolkit download from pipe network
2. Inside the downloaded Frebreath package
Fbgen.py is a new project that can be created for you
Prepmac.sh can compile your project for you and build a Xcode-based project that builds the browser plug-in using the XOCDE recompile
Examples a few examples for the official
./prepmac.sh examples compile the project,
If a cmake error occurs, CMake may not be installed, vim prepmac.sh manually change the cmake command path to the CMake path in the Bin/cmake source you downloaded.
Note: If you create a project yourself, it will be generated in the projects directory, compiled for the Duild directory, and the official demo compiled for the directory Duildex
3. Build a project with Xcode
Find the above compiled project, open the project with Xcode, compile and select target all_build;
If the compilation error occurs, select the compiled OS X SDK 10.8; do not use 10.10; and the best choice is 64-bit
4. Locate the generated plugin Xxx.plugin
If Xcode compiles successfully, the corresponding Xxx.plugin will be generated under the project.
such as: Buildex/projects/fbtestplugin/debug/fbtestplugin.plugin
Debug and Release
5. Install the plugin Xxx.plugin
Mac browser plug-in installation, is to put the plugin in the ~/library/internet plug-ins/directory; Make a connection and copy in the line
such as: Make a connection ln-s buildex/projects/fbtestplugin/debug/fbtestplugin.plugin ~/library/internet Plug-Ins/
6: Debug Run Plugin
After installing the plugin, restart the browser and open the generated Web page fbcontrol.htm
such as: buildex/projects/fbtestplugin/gen/fbcontrol.htm
Allow the plugin to run on the browser, click on me, etc.; Hello world;
Here, a browser plugin developed using Firebreath Hello World is finished;
Third: JS call using C++,C to implement local function using Firebreath development plug-in
For example, I created a Demo project;
Then use Xcode to open the Demo project you created
In the Demo directory, that is the combination of firebreath development we want to write code place;
Others are frame dependent, do not move; Here you can see an example of how the framework automatically generates
Source files is a directory of sources, generally put our integrated cpp,c can also be here to connect the static class library under the Mac, etc.
Header files is the interface header file that we provide for the JS call, which is the C++,c method declaration, and is registered with the Firebreath framework to provide the JS call, which is implemented in the above source files
The general main operation DemoApi.h declares the method, and registers to the frame; in the DemoApi.cpp inside realizes;
Generated for the generated Web page directory
Here we only care about fbcontrol.htm; here, add some JS code, in the JS code inside, to invoke the framework Declaration interface method;
Follow the sample code;
Four: Firebreath use, advanced function development, etc.
Http://www.firebreath.org/display/documentation/Using+FireBreath
Others, read the documentation yourself.
I currently use this framework for the development of the Mac under the browser to debug the USB fingerprint device;
The core layer is USB fingerprint drive, C + +;
The use of Firebrath can be used to drive the fingerprint C + + code, written in the framework, and register the interface, to JS call;
Implementation of JS operation fingerprint device
Browser plugin based on Firebreath developed for multi-browser support under Mac