Creating XPCOM components 编辑
This guide is about Gecko, and about creating XPCOM components for Gecko-based applications. Though the emphasis is on the practical steps you take to make your C++ code into a component that can be used in Gecko, we hope that these steps will also give us an occasion to discuss all of the tools, techniques, and technologies that make up XPCOM. Accordingly, the book is arranged so that you can follow along and create your own components or learn about different XPCOM topics individually, as in a reference work. For example, the introduction includes a discussion of components and what they are, and the first chapter - in which you compile the basic code and register it with Mozilla - prompts a discussion of the relationship between components and modules, of XPCOM interfaces, and of the registration process in general.
Note: In general, you should try to avoid having to create XPCOM components. Add-ons should try to use the new Add-on SDK as much as possible; however, there may be cases when it's unavoidable.
Note:This article describes a method that uses xpidl but you should use webidl instead.
Preface
- Who Should Read This Book
- Organization of the Tutorial
- Following Along with the Examples
- Conventions
- Acknowledgements
An Overview of XPCOM
Using XPCOM Components
Component Internals
Creating the Component Code
- What We'll Be Working On
- Component Registration
- Overview of the WebLock Module Source
- Digging In: Required Includes and Constants
webLock1.cpp
Using XPCOM Utilities to Make Things Easier
Starting WebLock
- Getting Called at Startup
- Providing Access to WebLock
- Creating the WebLock Programming Interface
- Defining the WebLock Interface in XPIDL
- Implementing WebLock
iWebLock
Method By Method
Finishing the Component
Building the WebLock UI
- User Interface Package List
- Client Code Overview
- XUL
- Overlaying New User Interface Into Mozilla
- Other 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
- Building a Windows Project
- A Makefile for Unix
Appendix B - 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. 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论