本章回顾你已经在教程第一部分建立的代码 (see webLock1.cpp in the previous chapter) 并且使用 XPCOM 工具类让代码更容易更有效. 同时,介绍一个在XPCOM和Gecko API中广泛使用基本的字符串类型。
作为起点,第一部分描述可以替代webLock1.cpp中的很多代码的C++ 宏. 很多用来完成软件组织和组件注册的代码都可以缩减为精简的数据结构和宏代码。 继续阅读
本章会讲述一些基本代码,这些代码用于处理你的组件与XPCOM之间的关系。 如何发现和注册组件是本指南的第一节的目标。在后续的章节里,我们就可以专注WebLock本生的功能开发了。
为了创建组件库并把它加载进XPCOM,你需要编写大量的代码。 一个XPCOM组件至少需要实现XPCOM必须的3个接口,而且往往还要其它的接口。 这一章你将会看到更多的代码,然而这些并不是整个WebLock组件代码。“Using XPCOM Utilities to Make Things Easier”展示了更加简单,更加优雅的方式创建XPCOM组件(使用泛型和宏),这一章的目的是为了学习基础知识,因为这对你深入了解XPCOM是很有帮助的。 继续阅读
Like description in “Creating_XPCOM_Components“, there have three method register the XPCOM component in XPCOM system. But in Gecko17 there have some change,we must edit the chrome.manifests file for registration the component. The file put on application’s root directory, the directory is same as application.ini file. See chrome.manifests .
#chrome.manifests content test chrome/content/ locale test en-US chrome/locale/en-US/ skin test classic/1.0 chrome/skin/ manifest components/samplecomp.manifest
Look above snippet text, the highlight text shows the components that you want to register. Detail about chrome.manifests,see “Chrome registration“.
The directory list:
test + chrome + components + default + xulrunner - application.ini - chrome.manifests - xulrunner-stub.exe
You can see the link, ” Build in window “.
# My first mozilla config mk_add_options MOZ_MAKE_FLAGS="-j4" mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-xulrunner mk_add_options MOZ_BUILD_PROJECTS="xulrunner" #Global options ac_add_options --enable-debug ac_add_options --disable-optimize #XULRunner options ac_add_app_options xulrunner --enable-application=xulrunner #ac_add_options --enable-debug-symbols[=DBG] ac_add_options --disable-static ac_add_options --enable-shared ac_add_options --enable-extensions=default ac_add_options --disable-tests ac_add_options --disable-webgl ac_add_options --disable-activex ac_add_options --disable-activex-scripting
Run command “make -f client.mk build”,start build.非常庆幸,Sourceforge提供了这样一个永久,无限,免费空间。 非常幸运能够成功的创建好站点。
我已年过三十,在 Code 这条路上已经走了十余载,幸好生活和工作并没有磨灭掉我对Coder的兴趣与能力,但愿我能够一直Code下去,直到我不再能敲动键盘,而原因只是因为兴趣和对生活的热爱
!
我会把我的这个兴趣的成果都记录在这个站点上,为什么不呢?