author | williamt <williamt> | 2007-01-05 10:06:01 (UTC) |
---|---|---|
committer | williamt <williamt> | 2007-01-05 10:06:01 (UTC) |
commit | c4b3096e166a0a9a60fd27c8f2dc06e688f13172 (patch) (unidiff) | |
tree | e5f234745835e28d56e5d5b7d6146886d04b3436 /src/chrome | |
download | foxri-c4b3096e166a0a9a60fd27c8f2dc06e688f13172.zip foxri-c4b3096e166a0a9a60fd27c8f2dc06e688f13172.tar.gz foxri-c4b3096e166a0a9a60fd27c8f2dc06e688f13172.tar.bz2 |
Initial revision
20 files changed, 414 insertions, 0 deletions
diff --git a/src/chrome/content/aim_logo.gif b/src/chrome/content/aim_logo.gif new file mode 100755 index 0000000..9d5bffe --- a/dev/null +++ b/src/chrome/content/aim_logo.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/email_icon.gif b/src/chrome/content/email_icon.gif new file mode 100755 index 0000000..1c62b57 --- a/dev/null +++ b/src/chrome/content/email_icon.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/feed-icon-14x14.png b/src/chrome/content/feed-icon-14x14.png new file mode 100755 index 0000000..b3c949d --- a/dev/null +++ b/src/chrome/content/feed-icon-14x14.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/feed-icon-28x28.png b/src/chrome/content/feed-icon-28x28.png new file mode 100755 index 0000000..d64c669 --- a/dev/null +++ b/src/chrome/content/feed-icon-28x28.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/foxri.xul b/src/chrome/content/foxri.xul new file mode 100755 index 0000000..dc1cc37 --- a/dev/null +++ b/src/chrome/content/foxri.xul | |||
@@ -0,0 +1,32 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <?xml-stylesheet href="foxri.css" type="text/css"?> | ||
3 | |||
4 | |||
5 | <overlay id="foxri" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
6 | |||
7 | |||
8 | <!-- | ||
9 | <script type="application/x-javascript" src="chrome://foxri/content/xrdsHandler.js"/> | ||
10 | --> | ||
11 | |||
12 | <script> | ||
13 | function xriFix(event) | ||
14 | { | ||
15 | var txt = gURLBar.value; | ||
16 | if (/^(=|@|!)\S+/.test(txt)) { | ||
17 | gURLBar.value = "xri://" + txt; | ||
18 | } | ||
19 | } | ||
20 | </script> | ||
21 | |||
22 | |||
23 | <toolbaritem id="urlbar-container"> | ||
24 | <textbox id="urlbar" ontextentered="xriFix(); return handleURLBarCommand(param);" /> | ||
25 | </toolbaritem> | ||
26 | |||
27 | <toolbaritem id="go-container"> | ||
28 | <toolbarbutton id="go-button" oncommand="xriFix(); return handleURLBarCommand(event);" /> | ||
29 | </toolbaritem> | ||
30 | |||
31 | </overlay> | ||
32 | |||
diff --git a/src/chrome/content/foxri_explorer.css b/src/chrome/content/foxri_explorer.css new file mode 100755 index 0000000..9e68e95 --- a/dev/null +++ b/src/chrome/content/foxri_explorer.css | |||
@@ -0,0 +1,124 @@ | |||
1 | |||
2 | |||
3 | * { | ||
4 | margin: 0; | ||
5 | padding: 0; | ||
6 | } | ||
7 | |||
8 | |||
9 | body { | ||
10 | background-color: #b1d8ff; | ||
11 | font-family: Trebuchet MS, Verdana, Helvetica, Arial, sans-serif; | ||
12 | } | ||
13 | |||
14 | |||
15 | a { | ||
16 | text-decoration: none; | ||
17 | } | ||
18 | |||
19 | a:link, a:visited { | ||
20 | color: #D65B5B; /* inames.net logo color */ | ||
21 | } | ||
22 | |||
23 | a:hover { | ||
24 | border-bottom: 1px dashed #555A5C; | ||
25 | } | ||
26 | |||
27 | a img { | ||
28 | border: none; | ||
29 | text-decoration: none; | ||
30 | } | ||
31 | |||
32 | |||
33 | h1,h2,h3,h4,h5,h6,p { | ||
34 | margin-left: 100px; | ||
35 | } | ||
36 | |||
37 | h1 { | ||
38 | margin: 0 100px; | ||
39 | padding: 0; | ||
40 | color: #D65B5B; /* inames.net logo color */ | ||
41 | } | ||
42 | |||
43 | h3 { | ||
44 | margin: 0 100px; | ||
45 | padding: 0; | ||
46 | color: #666666; | ||
47 | } | ||
48 | |||
49 | h3 strong { | ||
50 | color: #FF0000; /* inames.net logo color */ | ||
51 | } | ||
52 | |||
53 | |||
54 | .service { | ||
55 | background-color: #ffffff; /* inames.net */ | ||
56 | color: #333333; | ||
57 | |||
58 | margin: 20px 100px; | ||
59 | padding: 10px 150px; | ||
60 | min-height: 100px; | ||
61 | background-repeat: no-repeat; | ||
62 | background-position: 15px 10px; | ||
63 | |||
64 | -moz-border-radius: 10px; | ||
65 | } | ||
66 | |||
67 | |||
68 | .srv_skype { | ||
69 | background-image: url(chrome://foxri/content/skype_logo.png); | ||
70 | } | ||
71 | |||
72 | .srv_aim { | ||
73 | background-image: url(chrome://foxri/content/aim_logo.gif); | ||
74 | } | ||
75 | |||
76 | .srv_yahoo { | ||
77 | background-image: url(chrome://foxri/content/yahoo_logo.gif); | ||
78 | } | ||
79 | |||
80 | .srv_msn { | ||
81 | background-image: url(chrome://foxri/content/msn_logo.gif); | ||
82 | } | ||
83 | |||
84 | .srv_jabber { | ||
85 | background-image: url(chrome://foxri/content/jabber_logo.gif); | ||
86 | } | ||
87 | |||
88 | .srv_openid { | ||
89 | background-image: url(chrome://foxri/content/openid_logo.png); | ||
90 | } | ||
91 | |||
92 | .srv_i-contact { | ||
93 | background-image: url(chrome://foxri/content/i-contact_logo.gif); | ||
94 | } | ||
95 | |||
96 | .srv_i-forwarding { | ||
97 | background-image: url(chrome://foxri/content/i-forwarding_logo.gif); | ||
98 | } | ||
99 | |||
100 | .srv_authn-saml { | ||
101 | background-image: url(chrome://foxri/content/i-sso_logo.gif); | ||
102 | } | ||
103 | |||
104 | .srv_email { | ||
105 | background-image: url(chrome://foxri/content/email_icon.gif); | ||
106 | } | ||
107 | |||
108 | .srv_feed { | ||
109 | background-image: url(chrome://foxri/content/feed-icon-28x28.png); | ||
110 | } | ||
111 | |||
112 | .service a { | ||
113 | color: #D65B5B; /* inames.net logo color */ | ||
114 | } | ||
115 | |||
116 | |||
117 | div a:hover { | ||
118 | text-decoration: none; | ||
119 | border: none; | ||
120 | } | ||
121 | |||
122 | .error { | ||
123 | color: #FF5B5B; | ||
124 | } | ||
diff --git a/src/chrome/content/i-contact_logo.gif b/src/chrome/content/i-contact_logo.gif new file mode 100755 index 0000000..9775919 --- a/dev/null +++ b/src/chrome/content/i-contact_logo.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/i-forwarding_logo.gif b/src/chrome/content/i-forwarding_logo.gif new file mode 100755 index 0000000..125b1de --- a/dev/null +++ b/src/chrome/content/i-forwarding_logo.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/i-sso_logo.gif b/src/chrome/content/i-sso_logo.gif new file mode 100755 index 0000000..f948dd6 --- a/dev/null +++ b/src/chrome/content/i-sso_logo.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/icn_sso_lg.gif b/src/chrome/content/icn_sso_lg.gif new file mode 100755 index 0000000..f948dd6 --- a/dev/null +++ b/src/chrome/content/icn_sso_lg.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/jabber_logo.gif b/src/chrome/content/jabber_logo.gif new file mode 100755 index 0000000..01628d1 --- a/dev/null +++ b/src/chrome/content/jabber_logo.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/msn_logo.gif b/src/chrome/content/msn_logo.gif new file mode 100755 index 0000000..19dd647 --- a/dev/null +++ b/src/chrome/content/msn_logo.gif | |||
Binary files differ | |||
diff --git a/src/chrome/content/openid_logo.png b/src/chrome/content/openid_logo.png new file mode 100755 index 0000000..51d3654 --- a/dev/null +++ b/src/chrome/content/openid_logo.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/skype_add_large.png b/src/chrome/content/skype_add_large.png new file mode 100755 index 0000000..2cfb5dc --- a/dev/null +++ b/src/chrome/content/skype_add_large.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/skype_call.png b/src/chrome/content/skype_call.png new file mode 100755 index 0000000..bbb9807 --- a/dev/null +++ b/src/chrome/content/skype_call.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/skype_call_large.png b/src/chrome/content/skype_call_large.png new file mode 100755 index 0000000..65ce0dd --- a/dev/null +++ b/src/chrome/content/skype_call_large.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/skype_chat_large.png b/src/chrome/content/skype_chat_large.png new file mode 100755 index 0000000..9642d8a --- a/dev/null +++ b/src/chrome/content/skype_chat_large.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/skype_logo.png b/src/chrome/content/skype_logo.png new file mode 100755 index 0000000..a190417 --- a/dev/null +++ b/src/chrome/content/skype_logo.png | |||
Binary files differ | |||
diff --git a/src/chrome/content/xrdsHandler.js b/src/chrome/content/xrdsHandler.js new file mode 100755 index 0000000..d4b0d35 --- a/dev/null +++ b/src/chrome/content/xrdsHandler.js | |||
@@ -0,0 +1,258 @@ | |||
1 | |||
2 | const nsISupports = Components.interfaces.nsISupports; | ||
3 | const nsIChannel = Components.interfaces.nsIChannel; | ||
4 | const nsIContentHandler = Components.interfaces.nsIContentHandler; | ||
5 | const nsIDOMWindow = Components.interfaces.nsIDOMWindow; | ||
6 | const nsIInterfaceRequestor = Components.interfaces.nsIInterfaceRequestor; | ||
7 | const nsIStreamListener = Components.interfaces.nsIStreamListener; | ||
8 | const nsIRequestObserver = Components.interfaces.nsIRequestObserver; | ||
9 | const nsIURILoader = Components.interfaces.nsIURILoader; | ||
10 | const nsIURIContentListener = Components.interfaces.nsIURIContentListener; | ||
11 | |||
12 | |||
13 | |||
14 | |||
15 | var g_xrdsHandler = null; | ||
16 | |||
17 | |||
18 | |||
19 | |||
20 | |||
21 | |||
22 | XrdsContentHandler.prototype = { | ||
23 | |||
24 | /** browser window */ | ||
25 | contentWindow: null, | ||
26 | |||
27 | /** XRDS buffer */ | ||
28 | buf: null, | ||
29 | |||
30 | scriptableInStream: null, | ||
31 | |||
32 | init: function(contentWin) { | ||
33 | dump("XrdsContentHandler.init()\n"); | ||
34 | this.contentWindow = contentWin; | ||
35 | |||
36 | var uriLoader = Components.classes["@mozilla.org/uriloader;1"] | ||
37 | .getService(Components.interfaces.nsIURILoader); | ||
38 | uriLoader.registerContentListener(this); | ||
39 | dump("XrdsContentHandler.init() returning\n"); | ||
40 | }, | ||
41 | |||
42 | close: function() { | ||
43 | this.contentWindow = null; | ||
44 | var uriLoader = Components.classes["@mozilla.org/uriloader;1"] | ||
45 | .getService(Components.interfaces.nsIURILoader); | ||
46 | uriLoader.unRegisterContentListener(g_xrdsHandler); | ||
47 | }, | ||
48 | |||
49 | /* nsISupports */ | ||
50 | QueryInterface : function(iid) { | ||
51 | dump("xrdsCH ... "); | ||
52 | if (iid.equals(nsISupports)) { | ||
53 | dump("QI(nsISupports)\n"); | ||
54 | } | ||
55 | else if (iid.equals(nsIContentHandler)) { | ||
56 | dump("QI(nsIContentHandler)\n"); | ||
57 | } | ||
58 | else if (iid.equals(nsIStreamListener)) { | ||
59 | dump("QI(nsIStreamListener)\n"); | ||
60 | } | ||
61 | else if (iid.equals(nsIRequestObserver)) { | ||
62 | dump("QI(nsIRequestObserver)\n"); | ||
63 | } | ||
64 | else if (iid.equals(Components.interfaces.nsIURIContentListener)) { | ||
65 | dump("QI(nsIURIContentListener)\n"); | ||
66 | } | ||
67 | else if (iid.equals(nsIFactory)) { | ||
68 | dump("QI(nsIFactory)\n"); | ||
69 | } | ||
70 | else { | ||
71 | dump("QI(" + iid + ") - IDONTKNOW!!!!!\n"); | ||
72 | } | ||
73 | |||
74 | if (!iid.equals(nsISupports) && | ||
75 | // !iid.equals(nsIContentHandler) && | ||
76 | !iid.equals(nsIURIContentListener) && | ||
77 | !iid.equals(nsIStreamListener) && | ||
78 | // !iid.equals(nsIRequestObserver) && | ||
79 | !iid.equals(nsIFactory)) | ||
80 | throw Components.results.NS_ERROR_NO_INTERFACE; | ||
81 | |||
82 | dump("QI returning this..\n"); | ||
83 | return this; | ||
84 | }, | ||
85 | |||
86 | |||
87 | /* nsIURIContentListener */ | ||
88 | loadCookie: null, | ||
89 | |||
90 | parentContentListener: null, | ||
91 | |||
92 | onStartURIOpen: function(uri) | ||
93 | { | ||
94 | dump("xrdsCH onStartURIOpen '" + uri + "'"); | ||
95 | // ignore and don't abort | ||
96 | return false; | ||
97 | }, | ||
98 | |||
99 | doContent: function(contentType, isContentPreferred, request, contentHandler) | ||
100 | { | ||
101 | dump("doContent called\n"); | ||
102 | // forward the doContent to our content area webshell | ||
103 | var docShell = this.contentWindow.docShell; | ||
104 | var contentListener; | ||
105 | try { | ||
106 | contentListener = | ||
107 | docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor) | ||
108 | .getInterface(Components.interfaces.nsIURIContentListener); | ||
109 | } catch (ex) { | ||
110 | dump(ex); | ||
111 | } | ||
112 | |||
113 | dump("no content listener from docShell!\n"); | ||
114 | if (!contentListener) return false; | ||
115 | |||
116 | var rv = contentListener.doContent(contentType, isContentPreferred, request, contentHandler); | ||
117 | |||
118 | if (rv) { | ||
119 | dump("docShell wants to handle the load..\n"); | ||
120 | } | ||
121 | else { | ||
122 | dump("docShell does NOT want to handle the load..\n"); | ||
123 | |||
124 | contentHandler = contentHandler.value; | ||
125 | } | ||
126 | |||
127 | return rv; | ||
128 | |||
129 | }, | ||
130 | |||
131 | isPreferred: function(contentType, desiredContentType) | ||
132 | { | ||
133 | dump("isPreferred '" + contentType + "'\n"); | ||
134 | switch(contentType) { | ||
135 | case "application/xrds+xml": | ||
136 | case "application/xrd+xml": | ||
137 | dump("yes!!!\n"); | ||
138 | return true; | ||
139 | } | ||
140 | dump("erm.. nope!\n"); | ||
141 | return false; | ||
142 | }, | ||
143 | |||
144 | canHandleContent: function(contentType, isContentPreferred, desiredContentType) | ||
145 | { | ||
146 | dump("canHandleContent '" + contentType + "'\n"); | ||
147 | return this.isPreferred(contentType, desiredContentType); | ||
148 | }, | ||
149 | |||
150 | |||
151 | |||
152 | /* nsIRequestObserver */ | ||
153 | onStartRequest: function(request, ctx) | ||
154 | { | ||
155 | dump("xrdsContentHandler - onStartRequest\n"); | ||
156 | }, | ||
157 | |||
158 | onStopRequest: function(request, ctx, status) | ||
159 | { | ||
160 | dump("xrdsContentHandler - onStopRequest\n"); | ||
161 | this.scriptableInStream.close(); | ||
162 | }, | ||
163 | |||
164 | |||
165 | /* nsIStreamListener */ | ||
166 | onDataAvailable: function(request, domWindow, inputStream, offset, count) | ||
167 | { | ||
168 | dump("onDataAvailable, offset=" + offset + ", count=" + count + "\n"); | ||
169 | if (offset == 0) { | ||
170 | this.scriptableInStream.init(inputStream); | ||
171 | } | ||
172 | |||
173 | buf += this.scriptableInStream.read(count); | ||
174 | |||
175 | if (!request.isPending()) { | ||
176 | dump("request finished, buf = " + buf + "\n"); | ||
177 | var html = domWindow.document.createElement("html"); | ||
178 | html.createTextNode(buf); | ||
179 | this.scriptableInStream = null; | ||
180 | } | ||
181 | else { | ||
182 | dump("request pending...\n"); | ||
183 | } | ||
184 | }, | ||
185 | |||
186 | /* nsIContentHandler */ | ||
187 | |||
188 | handleContent : function(contentType, context, request) | ||
189 | { | ||
190 | dump("handleContent " + contentType + "\n"); | ||
191 | var parentWin; | ||
192 | try { | ||
193 | parentWin = context.getInterface(nsIDOMWindow); | ||
194 | } | ||
195 | catch (e) { | ||
196 | alert("no parent!!!"); // XXX | ||
197 | return; | ||
198 | } | ||
199 | |||
200 | dump("getting channel\n"); | ||
201 | var channel = request.QueryInterface(nsIChannel); | ||
202 | if (!channel) { | ||
203 | dump("no channel!!!\n"); | ||
204 | return; | ||
205 | } | ||
206 | |||
207 | if (this.scriptableInStream) { | ||
208 | dump("Hey! You can't possibly be reusing this handler?!\n"); | ||
209 | return; | ||
210 | } | ||
211 | |||
212 | dump("making scriptableInStream\n"); | ||
213 | this.scriptableInStream = Components.classes["@mozilla.org/scriptableinputstream;1"] | ||
214 | .createInstance(Components.interfaces.nsIScriptableInputStream); | ||
215 | |||
216 | buf = ''; | ||
217 | |||
218 | } | ||
219 | |||
220 | }; | ||
221 | |||
222 | |||
223 | function XrdsContentHandler(contentWindow) | ||
224 | { | ||
225 | this.init(contentWindow); | ||
226 | } | ||
227 | |||
228 | |||
229 | |||
230 | |||
231 | |||
232 | |||
233 | |||
234 | |||
235 | |||
236 | |||
237 | |||
238 | |||
239 | |||
240 | function foxri_startup() { | ||
241 | // our XRDS content-handler also does nsIURIContentListener | ||
242 | var xrdsHandler = new XrdsContentHandler(getBrowser()); | ||
243 | g_xrdsHandler = xrdsHandler; | ||
244 | |||
245 | } | ||
246 | |||
247 | |||
248 | function foxri_shutdown() { | ||
249 | if (!g_xrdsHandler) | ||
250 | return; | ||
251 | |||
252 | g_xrdsHandler.close(); | ||
253 | } | ||
254 | |||
255 | |||
256 | |||
257 | |||
258 | foxri_startup(); | ||
diff --git a/src/chrome/content/yahoo_logo.gif b/src/chrome/content/yahoo_logo.gif new file mode 100755 index 0000000..34e6cd2 --- a/dev/null +++ b/src/chrome/content/yahoo_logo.gif | |||
Binary files differ | |||