TOC PREV NEXT INDEX


Preface

Who Should Read This Book
Organization of the Tutorial
Following Along with the Examples
Conventions
Acknowledgements

CHAPTER 1 What Is XPCOM?

The XPCOM Solution
Gecko
Components
Interfaces
Interfaces and Encapsulation
The nsISupports Base Interface
XPCOM Identifiers
CID
Contract ID
Factories
XPIDL and Type Libraries
XPCOM Services
XPCOM Types
Method Types
Reference Counting
Status Codes
Variable mappings
Common XPCOM Error Codes

CHAPTER 2 Using XPCOM Components

Component Examples
Cookie Manager
The WebBrowserFind Component
The WebLock Component
Component Use in Mozilla
Finding Mozilla Components
Using XPCOM Components in Your C++
XPConnect: Using XPCOM Components From Script

CHAPTER 3 Component Internals

Creating Components in C++
XPCOM Initialization
XPCOM Registry Manifests
Registration Methods in XPCOM
Autoregistration
The Shutdown Process
Three parts of a XPCOM Component Library
XPCOM Glue
The Glue Library
XPCOM String Classes

CHAPTER 4 Tutorial : Creating the Component Code

What We'll Be Working On
Component Registration
The regxpcom Program
Registration Alternatives
Overview of the WebLock Module Source
Digging In: Required Includes and Constants
Identifiers in XPCOM
Coding for the Registration Process
The Registration Methods
Creating an Instance of Your Component
webLock1.cpp

CHAPTER 5 Tutorial: Using XPCOM Utilities To Make Things Easier

XPCOM Macros
Generic XPCOM Module Macros
Common Implementation Macros
Declaration Macros
weblock2.cpp
String Classes in XPCOM
Using Strings
nsEmbedString and nsEmbedCString
Smart Pointers

CHAPTER 6 Tutorial: Starting WebLock

Getting Called at Startup
Registering for Notifications
Getting Access to the Category Manager
Providing Access to WebLock
Creating the WebLock Programming Interface
Defining the Weblock Interface in XPIDL
The XPIDL Syntax
Scriptable Interfaces
Subclassing nsISupports
The Web Locking Interface
Implementing WebLock
Declaration Macros
Representing Return Values in XPCOM
XPIDL Code Generation
Getting the WebLock Service from a Client
Implementing the iWebLock Interface
The Directory Service
Modifying Paths with nsIFile
Manipulating Files with nsIFile
Using nsILocalFile for Reading Data
Processing the White List Data
iWebLock Method by Method
Lock and Unlock
AddSite
RemoveSite
SetSites
GetNext
GetSites
HasMoreElements

CHAPTER 7 Tutorial: Finishing the Component

Using Frozen Interfaces
Copying Interfaces into Your Build Environment
Implementing the nsIContentPolicy Interface
Receiving Notifications
Implementing the nsIContentPolicy
Uniform Resource Locators
Checking the White List
Creating nsIURI Objects

CHAPTER 8 Tutorial: Building the WebLock UI

User Interface Package List
Client Code Overview
XUL
The XUL Document
The Locking UI
Site Adding UI
weblock.xul
Overlaying New User Interface Into Mozilla
webLockOverlay.xul
Other Resources
weblock.css
Image Resources

CHAPTER 9 Tutorial: Packaging WebLock

Component Installation Overview
Archiving Resources
The WebLock Installation Script
The WebLock Trigger Script
Distributing Your Component

Appendix A: Setting up the Gecko SDK

Downloading and Setting the SDK
Building a Microsoft Visual C++ Project
Creating a New Project
Adding the Gecko SDK to the Project Settings
A Makefile for Unix

Appendix B: XPCOM API Reference

XPCOM Core
nsISupports
nsIInterfaceRequestor
nsIWeakReference
nsIMemory
nsIProgrammingLanguage
XPCOM Components
nsIComponentManager
nsIFactory
nsIModule
nsIComponentRegistrar
nsIServiceManager
nsIClassInfo
XPCOM Data Structures
nsICategoryManager
nsIObserver
nsIObserverService
nsIProperties
nsISimpleEnumerator
nsISupportsPrimitives
XPCOM I/O
nsIDirectoryServiceProvider
nsIDirectoryServiceProvider2
nsIDirectoryService
nsIFile
nsIInputStream
nsILocalFile
nsIOutputStream
XPCOM Startup/Shutdown

Appendix C: Resources

WebLock Resources
Gecko Resources
XPCOM Resources
General Development Resources

Copyright (c) 2003 by Doug Turner and Ian Oeschger. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.02 or later (the latest version is presently available at http://www.opencontent.org/openpub/). Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. Distribution of the work or derivative of the work in any standard (paper) book form is prohibited unless prior permission is obtained from the copyright holder.
Brownhen Publishing
http://www.brownhen.com
TOC PREV NEXT INDEX