Creating XPCOM Components

Preface

Who Should Read This Book 이 문서가 필요한 사람
Organization of the Tutorial 튜토리얼 구조
Following Along with the Examples 예제 따라하기
Conventions
Acknowledgements

An Overview of 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

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 Cpp
XPConnect: Using XPCOM Components From Script

Component Internals

Creating Components in Cpp
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

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

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

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

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

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

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 Cpp Project
Creating a New Project
Adding the Gecko SDK to the Project Settings
A Makefile for Unix

Appendix B - Resources

WebLock Resources
Gecko Resources
XPCOM Resources
General Development Resources

Document Tags and Contributors

Contributors to this page: 하양파랑
Last updated by: 하양파랑,