Annotation of chimera/nsCocoaBrowserService.mm, revision 1.10
1.1 hyatt 1: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2: /* ***** BEGIN LICENSE BLOCK *****
3: * Version: NPL 1.1/GPL 2.0/LGPL 2.1
4: *
5: * The contents of this file are subject to the Netscape Public License
6: * Version 1.1 (the "License"); you may not use this file except in
7: * compliance with the License. You may obtain a copy of the License at
8: * http://www.mozilla.org/NPL/
9: *
10: * Software distributed under the License is distributed on an "AS IS" basis,
11: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12: * for the specific language governing rights and limitations under the
13: * License.
14: *
15: * The Original Code is mozilla.org code.
16: *
17: * The Initial Developer of the Original Code is
18: * Netscape Communications Corporation.
19: * Portions created by the Initial Developer are Copyright (C) 1998
20: * the Initial Developer. All Rights Reserved.
21: *
22: * Contributor(s):
23: *
24: * Alternatively, the contents of this file may be used under the terms of
25: * either the GNU General Public License Version 2 or later (the "GPL"), or
26: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27: * in which case the provisions of the GPL or the LGPL are applicable instead
28: * of those above. If you wish to allow use of your version of this file only
29: * under the terms of either the GPL or the LGPL, and not to allow others to
30: * use your version of this file under the terms of the NPL, indicate your
31: * decision by deleting the provisions above and replace them with the notice
32: * and other provisions required by the GPL or the LGPL. If you do not delete
33: * the provisions above, a recipient may use your version of this file under
34: * the terms of any one of the NPL, the GPL or the LGPL.
35: *
36: * ***** END LICENSE BLOCK ***** */
37:
38: #include "nsCocoaBrowserService.h"
39:
40: #include "nsIWindowWatcher.h"
41: #include "nsIWebBrowserChrome.h"
42: #include "nsIEmbeddingSiteWindow.h"
43: #include "nsIProfile.h"
1.10 ! hyatt 44: #include "nsIPrefService.h"
1.1 hyatt 45: #include "NSBrowserView.h"
46: #include "nsCRT.h"
47: #include "nsString.h"
48:
49: nsAlertController* nsCocoaBrowserService::sController = nsnull;
50: nsCocoaBrowserService* nsCocoaBrowserService::sSingleton = nsnull;
1.5 hyatt 51: PRUint32 nsCocoaBrowserService::sNumBrowsers = 0;
1.9 hyatt 52: PRBool nsCocoaBrowserService::sCanTerminate = PR_FALSE;
1.1 hyatt 53:
54: // nsCocoaBrowserService implementation
55: nsCocoaBrowserService::nsCocoaBrowserService()
56: {
57: NS_INIT_ISUPPORTS();
58: }
59:
60: nsCocoaBrowserService::~nsCocoaBrowserService()
61: {
62: }
63:
64: NS_IMPL_ISUPPORTS3(nsCocoaBrowserService,
65: nsIWindowCreator,
66: nsIPromptService,
67: nsIFactory)
68:
69: nsresult
70: nsCocoaBrowserService::InitEmbedding()
71: {
1.5 hyatt 72: sNumBrowsers++;
73:
1.4 hyatt 74: if (sSingleton)
1.1 hyatt 75: return NS_OK;
76:
77: // XXX Temporary hack to make sure we find the
78: // right executable directory
79: NSBundle* mainBundle = [NSBundle mainBundle];
80: NSString* path = [mainBundle bundlePath];
81: NSMutableString* mutablePath = [NSMutableString stringWithString:path];
82: [mutablePath appendString:@"/Contents/MacOS/"];
83: const char* cstr = [mutablePath cString];
84: setenv("MOZILLA_FIVE_HOME", cstr, 1);
85:
86: sSingleton = new nsCocoaBrowserService();
87: if (!sSingleton) {
88: return NS_ERROR_OUT_OF_MEMORY;
89: }
90: NS_ADDREF(sSingleton);
1.4 hyatt 91:
1.1 hyatt 92: nsresult rv = NS_InitEmbedding(nsnull, nsnull);
93: if (NS_FAILED(rv)) {
94: return rv;
95: }
96:
97: // Register as the prompt service
98: #define NS_PROMPTSERVICE_CID \
99: {0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
100: static NS_DEFINE_CID(kPromptServiceCID, NS_PROMPTSERVICE_CID);
101:
102: rv = nsComponentManager::RegisterFactory(kPromptServiceCID,
103: "Prompt Service",
104: "@mozilla.org/embedcomp/prompt-service;1",
105: sSingleton,
106: PR_TRUE); // replace existing
107: if (NS_FAILED(rv)) {
108: return rv;
109: }
110:
111: // Register as the window creator
112: nsCOMPtr<nsIWindowWatcher> watcher(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
113: if (!watcher) {
114: return NS_ERROR_FAILURE;
115: }
116:
117: watcher->SetWindowCreator(sSingleton);
118:
119: // Set the profile which the control will use
120: nsCOMPtr<nsIProfile> profileService(do_GetService(NS_PROFILE_CONTRACTID, &rv));
121: if (NS_FAILED(rv))
122: return rv;
123:
124: // Make a new default profile for the control if none exists.
125: nsAutoString newProfileName(NS_LITERAL_STRING("Chimera"));
126: PRBool profileExists = PR_FALSE;
127: rv = profileService->ProfileExists(newProfileName.get(), &profileExists);
128: if (NS_FAILED(rv))
129: return rv;
130:
131: if (!profileExists) {
132: rv = profileService->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_FALSE);
133: if (NS_FAILED(rv))
134: return rv;
135: }
136:
137: rv = profileService->SetCurrentProfile(newProfileName.get());
138: if (NS_FAILED(rv))
139: return rv;
140:
141: return NS_OK;
142: }
143:
144: void
1.5 hyatt 145: nsCocoaBrowserService::BrowserClosed()
146: {
147: sNumBrowsers--;
1.9 hyatt 148: if (sCanTerminate && sNumBrowsers == 0) {
1.5 hyatt 149: // The app is terminating *and* our count dropped to 0.
1.9 hyatt 150: NS_IF_RELEASE(sSingleton);
1.10 ! hyatt 151: nsCOMPtr<nsIPrefService> pref(do_GetService("@mozilla.org/preferences-service;1"));
! 152: pref->SavePrefFile(nsnull);
1.5 hyatt 153: NS_TermEmbedding();
1.6 hyatt 154: printf("Shutting down embedding!\n");
1.5 hyatt 155: }
156: }
157:
158: void
1.1 hyatt 159: nsCocoaBrowserService::TermEmbedding()
160: {
1.9 hyatt 161: sCanTerminate = PR_TRUE;
1.6 hyatt 162: if (sNumBrowsers == 0) {
1.9 hyatt 163: NS_IF_RELEASE(sSingleton);
164: NS_TermEmbedding();
1.6 hyatt 165: printf("Shutting down embedding.\n");
166: }
1.9 hyatt 167: else
168: printf("Cannot yet shut down embedding.\n");
169: // Otherwise we cannot yet terminate. We have to let the death of the browser windows
170: // induce termination.
1.1 hyatt 171: }
172:
173: #define NS_ALERT_NIB_NAME "alert"
174:
175: nsAlertController*
176: nsCocoaBrowserService::GetAlertController()
177: {
178: if (!sController) {
179: NSBundle* bundle = [NSBundle bundleForClass:[NSBrowserView class]];
180: [bundle loadNibFile:@NS_ALERT_NIB_NAME externalNameTable:nsnull withZone:[NSApp zone]];
181: }
182: return sController;
183: }
184:
185: void
186: nsCocoaBrowserService::SetAlertController(nsAlertController* aController)
187: {
188: // XXX When should the controller be released?
189: sController = aController;
190: [sController retain];
191: }
192:
193: // nsIFactory implementation
194: NS_IMETHODIMP
195: nsCocoaBrowserService::CreateInstance(nsISupports *aOuter,
196: const nsIID & aIID,
197: void **aResult)
198: {
199: NS_ENSURE_ARG_POINTER(aResult);
200:
201: return sSingleton->QueryInterface(aIID, aResult);
202: }
203:
204: NS_IMETHODIMP
205: nsCocoaBrowserService::LockFactory(PRBool lock)
206: {
207: return NS_OK;
208: }
209:
210: // nsIPromptService implementation
211: static NSWindow*
212: GetNSWindowForDOMWindow(nsIDOMWindow* window)
213: {
214: nsCOMPtr<nsIWindowWatcher> watcher(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
215: if (!watcher) {
216: return nsnull;
217: }
218:
219: nsCOMPtr<nsIWebBrowserChrome> chrome;
220: watcher->GetChromeForWindow(window, getter_AddRefs(chrome));
221: if (!chrome) {
222: return nsnull;
223: }
224:
225: nsCOMPtr<nsIEmbeddingSiteWindow> siteWindow(do_QueryInterface(chrome));
226: if (!siteWindow) {
227: return nsnull;
228: }
229:
230: NSWindow* nswin;
231: siteWindow->GetSiteWindow((void**)&nswin);
232:
233: return nswin;
234: }
235:
236: // Implementation of nsIPromptService
237: NS_IMETHODIMP
238: nsCocoaBrowserService::Alert(nsIDOMWindow *parent,
239: const PRUnichar *dialogTitle,
240: const PRUnichar *text)
241: {
242: nsAlertController* controller = GetAlertController();
243: if (!controller) {
244: return NS_ERROR_FAILURE;
245: }
246:
247: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
248: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
249: NSWindow* window = GetNSWindowForDOMWindow(parent);
250:
251: [controller alert:window title:titleStr text:textStr];
252:
253: return NS_OK;
254: }
255:
256: /* void alertCheck (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, in wstring checkMsg, inout boolean checkValue); */
257: NS_IMETHODIMP
258: nsCocoaBrowserService::AlertCheck(nsIDOMWindow *parent,
259: const PRUnichar *dialogTitle,
260: const PRUnichar *text,
261: const PRUnichar *checkMsg,
262: PRBool *checkValue)
263: {
264: nsAlertController* controller = GetAlertController();
265: if (!controller) {
266: return NS_ERROR_FAILURE;
267: }
268:
269: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
270: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
271: NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
272: NSWindow* window = GetNSWindowForDOMWindow(parent);
273:
274: if (checkValue) {
275: BOOL valueBool = *checkValue ? YES : NO;
276:
277: [controller alertCheck:window title:titleStr text:textStr checkMsg:msgStr checkValue:&valueBool];
278:
279: *checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
280: }
281: else {
282: [controller alert:window title:titleStr text:textStr];
283: }
284:
285: return NS_OK;
286: }
287:
288: /* boolean confirm (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text); */
289: NS_IMETHODIMP
290: nsCocoaBrowserService::Confirm(nsIDOMWindow *parent,
291: const PRUnichar *dialogTitle,
292: const PRUnichar *text,
293: PRBool *_retval)
294: {
295: nsAlertController* controller = GetAlertController();
296: if (!controller) {
297: return NS_ERROR_FAILURE;
298: }
299:
300: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
301: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
302: NSWindow* window = GetNSWindowForDOMWindow(parent);
303:
304: *_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
305:
306: return NS_OK;
307: }
308:
309: /* boolean confirmCheck (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, in wstring checkMsg, inout boolean checkValue); */
310: NS_IMETHODIMP
311: nsCocoaBrowserService::ConfirmCheck(nsIDOMWindow *parent,
312: const PRUnichar *dialogTitle,
313: const PRUnichar *text,
314: const PRUnichar *checkMsg,
315: PRBool *checkValue, PRBool *_retval)
316: {
317: nsAlertController* controller = GetAlertController();
318: if (!controller) {
319: return NS_ERROR_FAILURE;
320: }
321:
322: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
323: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
324: NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
325: NSWindow* window = GetNSWindowForDOMWindow(parent);
326:
327: if (checkValue) {
328: BOOL valueBool = *checkValue ? YES : NO;
329:
330: *_retval = (PRBool)[controller confirmCheck:window title:titleStr text:textStr checkMsg:msgStr checkValue:&valueBool];
331:
332: *checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
333: }
334: else {
335: *_retval = (PRBool)[controller confirm:window title:titleStr text:textStr];
336: }
337:
338: return NS_OK;
339: }
340:
341: /* void confirmEx (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, in unsigned long buttonFlags, in wstring button0Title, in wstring button1Title, in wstring button2Title, in wstring checkMsg, inout boolean checkValue, out PRInt32 buttonPressed); */
342: NS_IMETHODIMP
343: nsCocoaBrowserService::ConfirmEx(nsIDOMWindow *parent,
344: const PRUnichar *dialogTitle,
345: const PRUnichar *text,
346: PRUint32 buttonFlags,
347: const PRUnichar *button0Title,
348: const PRUnichar *button1Title,
349: const PRUnichar *button2Title,
350: const PRUnichar *checkMsg,
351: PRBool *checkValue, PRInt32 *buttonPressed)
352: {
1.7 hyatt 353: nsAlertController* controller = GetAlertController();
354: if (!controller) {
355: return NS_ERROR_FAILURE;
356: }
357:
358: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
359: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
360: NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
361: NSWindow* window = GetNSWindowForDOMWindow(parent);
362:
363: NSString* btn1Str = [NSString stringWithCharacters:button0Title length:(button0Title ? nsCRT::strlen(button0Title) : 0)];
364: NSString* btn2Str = [NSString stringWithCharacters:button1Title length:(button1Title ? nsCRT::strlen(button1Title) : 0)];
365: NSString* btn3Str = [NSString stringWithCharacters:button2Title length:(button2Title ? nsCRT::strlen(button2Title) : 0)];
366:
367: if (checkValue) {
368: BOOL valueBool = *checkValue ? YES : NO;
369:
370: *buttonPressed = (PRInt32)[controller confirmCheckEx:window title:titleStr text:textStr
371: button1: btn1Str button2: btn2Str button3: btn3Str
372: checkMsg:msgStr checkValue:&valueBool];
373:
374: *checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
375: }
376: else {
377: *buttonPressed = (PRInt32)[controller confirmEx:window title:titleStr text:textStr
378: button1: btn1Str button2: btn2Str button3: btn3Str];
379: }
380:
381: printf("Uh-oh! Not posing the confirm yet, but just assuming OK was pressed.\n");
382:
383: return NS_OK;
384:
1.1 hyatt 385: }
386:
387: /* boolean prompt (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, inout wstring value, in wstring checkMsg, inout boolean checkValue); */
388: NS_IMETHODIMP
389: nsCocoaBrowserService::Prompt(nsIDOMWindow *parent,
390: const PRUnichar *dialogTitle,
391: const PRUnichar *text,
392: PRUnichar **value,
393: const PRUnichar *checkMsg,
394: PRBool *checkValue,
395: PRBool *_retval)
396: {
397: nsAlertController* controller = GetAlertController();
398: if (!controller) {
399: return NS_ERROR_FAILURE;
400: }
401:
402: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
403: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
404: NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
405: NSMutableString* valueStr = [NSMutableString stringWithCharacters:*value length:(*value ? nsCRT::strlen(*value) : 0)];
406:
407: BOOL valueBool;
408: if (checkValue) {
409: valueBool = *checkValue ? YES : NO;
410: }
411: NSWindow* window = GetNSWindowForDOMWindow(parent);
412:
413: *_retval = (PRBool)[controller prompt:window title:titleStr text:textStr promptText:valueStr checkMsg:msgStr checkValue:&valueBool doCheck:(checkValue != nsnull)];
414:
415: if (checkValue) {
416: *checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
417: }
418: PRUint32 length = [valueStr length];
419: PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
420: [valueStr getCharacters:retStr];
421: retStr[length] = PRUnichar(0);
422: *value = retStr;
423:
424: return NS_OK;
425: }
426:
427: /* boolean promptUsernameAndPassword (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, inout wstring username, inout wstring password, in wstring checkMsg, inout boolean checkValue); */
428: NS_IMETHODIMP
429: nsCocoaBrowserService::PromptUsernameAndPassword(nsIDOMWindow *parent,
430: const PRUnichar *dialogTitle,
431: const PRUnichar *text,
432: PRUnichar **username,
433: PRUnichar **password,
434: const PRUnichar *checkMsg,
435: PRBool *checkValue,
436: PRBool *_retval)
437: {
438: nsAlertController* controller = GetAlertController();
439: if (!controller) {
440: return NS_ERROR_FAILURE;
441: }
442:
443: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
444: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
445: NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
446: NSMutableString* userNameStr = [NSMutableString stringWithCharacters:*username length:(*username ? nsCRT::strlen(*username) : 0)];
447: NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
448:
449: BOOL valueBool;
450: if (checkValue) {
451: valueBool = *checkValue ? YES : NO;
452: }
453: NSWindow* window = GetNSWindowForDOMWindow(parent);
454:
455: *_retval = (PRBool)[controller promptUserNameAndPassword:window title:titleStr text:textStr userNameText:userNameStr passwordText:passwordStr checkMsg:msgStr checkValue:&valueBool doCheck:(checkValue != nsnull)];
456:
457: if (checkValue) {
458: *checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
459: }
460:
461: PRUint32 length = [userNameStr length];
462: PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
463: [userNameStr getCharacters:retStr];
464: retStr[length] = PRUnichar(0);
465: *username = retStr;
466:
467: length = [passwordStr length];
468: retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
469: [passwordStr getCharacters:retStr];
470: retStr[length] = PRUnichar(0);
471: *password = retStr;
472:
473: return NS_OK;
474: }
475:
476: /* boolean promptPassword (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, inout wstring password, in wstring checkMsg, inout boolean checkValue); */
477: NS_IMETHODIMP
478: nsCocoaBrowserService::PromptPassword(nsIDOMWindow *parent,
479: const PRUnichar *dialogTitle,
480: const PRUnichar *text,
481: PRUnichar **password,
482: const PRUnichar *checkMsg,
483: PRBool *checkValue,
484: PRBool *_retval)
485: {
486: nsAlertController* controller = GetAlertController();
487: if (!controller) {
488: return NS_ERROR_FAILURE;
489: }
490:
491: NSString* titleStr = [NSString stringWithCharacters:dialogTitle length:(dialogTitle ? nsCRT::strlen(dialogTitle) : 0)];
492: NSString* textStr = [NSString stringWithCharacters:text length:(text ? nsCRT::strlen(text) : 0)];
493: NSString* msgStr = [NSString stringWithCharacters:checkMsg length:(checkMsg ? nsCRT::strlen(checkMsg) : 0)];
494: NSMutableString* passwordStr = [NSMutableString stringWithCharacters:*password length:(*password ? nsCRT::strlen(*password) : 0)];
495:
496: BOOL valueBool;
497: if (checkValue) {
498: valueBool = *checkValue ? YES : NO;
499: }
500: NSWindow* window = GetNSWindowForDOMWindow(parent);
501:
502: *_retval = (PRBool)[controller promptPassword:window title:titleStr text:textStr passwordText:passwordStr checkMsg:msgStr checkValue:&valueBool doCheck:(checkValue != nsnull)];
503:
504: if (checkValue) {
505: *checkValue = (valueBool == YES) ? PR_TRUE : PR_FALSE;
506: }
507:
508: PRUint32 length = [passwordStr length];
509: PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
510: [passwordStr getCharacters:retStr];
511: retStr[length] = PRUnichar(0);
512: *password = retStr;
513:
514: return NS_OK;
515: }
516:
517: /* boolean select (in nsIDOMWindow parent, in wstring dialogTitle, in wstring text, in PRUint32 count, [array, size_is (count)] in wstring selectList, out long outSelection); */
518: NS_IMETHODIMP
519: nsCocoaBrowserService::Select(nsIDOMWindow *parent,
520: const PRUnichar *dialogTitle,
521: const PRUnichar *text,
522: PRUint32 count,
523: const PRUnichar **selectList,
524: PRInt32 *outSelection,
525: PRBool *_retval)
526: {
1.7 hyatt 527: printf("Uh-oh. Select has not been implemented.\n");
1.1 hyatt 528: return NS_ERROR_NOT_IMPLEMENTED;
529: }
530:
531: // Implementation of nsIWindowCreator
532: /* nsIWebBrowserChrome createChromeWindow (in nsIWebBrowserChrome parent, in PRUint32 chromeFlags); */
533: NS_IMETHODIMP
534: nsCocoaBrowserService::CreateChromeWindow(nsIWebBrowserChrome *parent,
535: PRUint32 chromeFlags,
536: nsIWebBrowserChrome **_retval)
537: {
1.8 hyatt 538: if (!parent) {
539: printf("Uh-oh. Attempt to create a new browser window with a null parent. Should not happen in Chimera.\n");
540: return NS_ERROR_FAILURE;
541: }
542:
543: nsCOMPtr<nsIWindowCreator> browserChrome(do_QueryInterface(parent));
544: return browserChrome->CreateChromeWindow(parent, chromeFlags, _retval);
1.1 hyatt 545: }
546:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>