Embedding/NewApi
Contents
This has been deprecated in favor of https://wiki.mozilla.org/Embedding/IPCLiteAPI
Motivation
The idea with the new embedding API is to provide an easier way to embed Mozilla in other applications. The existing API using XPCOM has quite a steep learning curve for new-comers. We would like to improve this with the new API. This is done by making a new API on top of the existing one, which also helps shield embedders for changes in the underlying API, hopefully making things more stable long term.
For some more background check Chris Blizzard's blog entry.
Structure
The new API has a common C++ layer built on top of the existing API. The new API thus encapsulates many of the complexities of setting up and using XPCOM.
The common layer is then used by platform/toolkit specific APIs. This will allow embedders to use components that fit well into their application, e.g. GTK or Qt widgets.
Having the common layer also makes it a lot easier to add support for additional toolkits as this should only require a relative thin wrapper.
It is however still possible to access the underlying XPCOM API, see here
Common Layer
The common layer is implemented using plain C++. For strings we are using char* encoded as utf-8. When methods return pointers to newly allocated buffers (e.g. strings) it is the responsibility of the caller to free those.
There are 2 main classes for embedding:
MozView
This represent a browser view, capable of displaying content. It should be connected to a window or widget. It also has a listener interface that can be used to get notified of events like when a document has finished loading.
MozApp
This class provides access to things like preferences. NOTE: it is optional to use this, i.e. if you don't need the functionality provided by MozApp you don't need to use it.
Doxygen Documentation
You can find class documentation here
Getting the code
The code currently lives outside the main tree in a separate Mercurial repository (http://hg.mozilla.org/incubator/embedding/). Here is how to get it:
hg clone http://hg.mozilla.org/incubator/embedding/ mozembed
Build Instructions
To Do
See [Tasklist]
Feedback
Please use:
- [mozilla.dev.embedding] newsgroup
- #embedding channel on [Mozilla IRC]