|
|
|
|
Introductions |
|
XPCOM & Modules |
|
Examples |
|
Wrap-up |
|
|
|
|
|
Open Source Project Initiated by Netscape |
|
”The fastest Web Browser” |
|
Many products in addition to Web browser: |
|
Bonsai (tree control) |
|
Tinderbox (tree status) |
|
Bugzilla (bug database) |
|
... |
|
|
|
|
|
|
|
”A Component” |
|
SGML/XML/HTML Browser with HyTime link support |
|
Differencies to standard Mozilla Browser: |
|
DTD and SGML declaration handling |
|
Supports additional image formats |
|
Enhanced link support |
|
Structured and index-based search |
|
|
|
|
|
|
Binary compatible components |
|
Interface and implementation completely
separated |
|
Enables distributed computing |
|
Multiple implementations possible |
|
Objects can support multiple interfaces |
|
No versioning problems; globally unique
interface identifiers |
|
Strict rules about in/out parameters |
|
Reference counting |
|
|
|
|
|
|
Language/compiler independent |
|
New ”dynamic_cast” for interfaces
(QueryInterface) |
|
|
|
|
Simplified COM |
|
Cross-platfrom |
|
”Binary compatible with COM” |
|
|
|
|
|
|
|
Interface (mozIHello) |
|
Written in IDL |
|
Inherits from nsISupports |
|
Pure abstract class |
|
IID |
|
Implementation (mozHello) |
|
Reference counts |
|
QueryInterface |
|
CID |
|
|
|
|
|
|
NSGetFactory(…) |
|
new mozHelloFactory(); |
|
NSRegisterSelf(…) |
|
nsComponentManager::RegisterComponent(…); |
|
CLSID, class name, ProgID, path... |
|
NSUnregisterSelf(…) |
|
nsComponentManager::UnregisterComponent(…); |
|
NSCanUnload(…) |
|
Return PR_TRUE if the component can be unloaded. |
|
NSGetModule(…) will replace all these… |
|
|
|
|
|
|
Factory (mozHelloFactory, inherts from
nsIFactory) |
|
CreateInstance(…); |
|
LockFactory(…); |
|
Creating a mozHello instance |
|
C++ |
|
nsComponentManager::CreateInstance(…); |
|
JavaScript |
|
Components.classes[…].createInstance(); |
|
|
|
|
|
|
NSPR |
|
XPCOM |
|
Parser Engine |
|
Widgets |
|
Graphics |
|
Layout |
|
Webshell |
|
? |
|
|
|
|
|
XPCOM Hello |
|
Embedded webshell |
|
Frankenbrowser |
|
|
|
+ Adam Lock’s ActiveX samples… |
|
http://www.iol.ie/~locka/mozilla/mozilla.htm |
|
+ Alexander Larsson’s Embedding Gecko in a GTK
app. (mozilla/webshell/embed/gtk) |
|
|
|
|
”Easy way to embed web browser functionality
into an application” |
|
Register libraries |
|
Create event queue |
|
Create web shell |
|
... |
|
|
|
|
|
|
|
|
Register components that aren’t self registering |
|
NS_SetupRegistry(); |
|
|
|
Registering selfregistering modules |
|
nsComponentManager::Autoregister(…) |
|
Give path to component directory. |
|
|
|
|
|
|
|
|
|
Obtain the EventQueueService |
|
nsServiceManager::GetService(…); |
|
|
|
Creating the thread event queue |
|
aEventQueueService->CreateThreadEventQueue(…); |
|
|
|
|
|
Creating the webshell instance |
|
nsComponentManager::CreateInstance(…); |
|
|
|
Initializing the webshell |
|
mWebShell->Init(native window, x, y, w, h); |
|
mWebShell->Show(); |
|
|
|
Loading a URL |
|
mWebShell->LoadURL(L”http://…”); |
|
|
|
|
|
|
”Easiest way to extend Mozilla” |
|
Unlimited flexibility |
|
Leverage your knowledge of other frameworks |
|
Minimal knowledge of Mozilla interfaces required |
|
|
|
|
http://www.doczilla.com |
|
Email authors |
|
|
|
|
Mozilla Organization newsgroups |
|
Email/call authors |
|
|
|
|
|
Don Box, Essential COM |
|
Erich Gamma et. al., Design Patterns |
|
www.mozilla.org |
|
|
|
|