Пример #1
0
NS_IMETHODIMP
nsAppStartup::DestroyHiddenWindow()
{
  nsCOMPtr<nsIAppShellService> appShellService
    (do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
  NS_ENSURE_TRUE(appShellService, NS_ERROR_FAILURE);

  return appShellService->DestroyHiddenWindow();
}
Пример #2
0
NS_IMETHODIMP MiroWindowCreator::CreateChromeWindow2(
        nsIWebBrowserChrome *parent, PRUint32 chromeFlags, 
        PRUint32 contextFlags, nsIURI *uri, PRBool *cancel,
        nsIWebBrowserChrome **_retval)
{
    nsCAutoString specString;
    if((chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME) == 0) {
      *cancel = PR_TRUE;
      *_retval = nsnull;
        if(uri) {
            uri->GetSpec(specString);
            if(mWindowCallback) {
                mWindowCallback((char*)specString.get(), mWindowCallbackData);
            }
        } else {
            log_warning("Trying to open window with no URI");
        }
    } else {
      nsCOMPtr <nsIAppShellService> appShellService(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
      if (!appShellService) {
	return NS_ERROR_FAILURE;
      }
      nsCOMPtr <nsIXULWindow> newWindow;
      nsCOMPtr <nsIAppShell> appShell(do_GetService(kAppShellCID));
      appShellService->CreateTopLevelWindow(0, 0, chromeFlags,
					    nsIAppShellService::SIZE_TO_CONTENT,
					    nsIAppShellService::SIZE_TO_CONTENT,
					    appShell, getter_AddRefs(newWindow));
      if (newWindow) {
	newWindow->SetContextFlags(contextFlags);
	 nsCOMPtr<nsIInterfaceRequestor> thing(do_QueryInterface(newWindow));
	 if (thing) {
	   CallGetInterface(thing.get(), _retval);
	   NS_IF_ADDREF(*_retval);
         }
      }
    }

    return NS_OK;
}