Back to index

lightning-sunbird  0.9+nobinonly
BrowserImplPrompt.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Chak Nanga <chak@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 // File overview.....
00040 //
00041 // The nsIPrompt interface is mainly used to convey/get information
00042 // from a user via Alerts, Prompts etc.
00043 // 
00044 
00045 #ifdef _WINDOWS
00046   #include "stdafx.h"
00047 #endif
00048 #include "BrowserImpl.h"
00049 #include "IBrowserFrameGlue.h"
00050 
00051 //*****************************************************************************
00052 // CBrowserImpl::nsIPrompt Implementation
00053 //*****************************************************************************   
00054 
00055 
00056 // Needed for JavaScript and other cases where a msg needs to be 
00057 // shown to the user. For ex, when a page has some JS such as
00058 // "Alert("Hello")" this method will be invoked
00059 NS_IMETHODIMP
00060 CBrowserImpl::Alert(const PRUnichar *dialogTitle, const PRUnichar *text)
00061 {
00062        if(! m_pBrowserFrameGlue)
00063               return NS_ERROR_FAILURE;
00064        
00065        m_pBrowserFrameGlue->Alert(dialogTitle, text);
00066 
00067        return NS_OK;
00068 }
00069 
00070 // Invoked in the case of a JS confirm() method invocation
00071 NS_IMETHODIMP
00072 CBrowserImpl::Confirm(const PRUnichar *dialogTitle, 
00073                         const PRUnichar *text, PRBool *retval)
00074 {
00075        if(! m_pBrowserFrameGlue)
00076               return NS_ERROR_FAILURE;
00077 
00078        m_pBrowserFrameGlue->Confirm(dialogTitle, text, retval);
00079 
00080        return NS_OK;
00081 }
00082 
00083 NS_IMETHODIMP
00084 CBrowserImpl::Prompt(const PRUnichar *dialogTitle, const PRUnichar *text,
00085                      PRUnichar **promptText,
00086                      const PRUnichar *checkMsg, PRBool *checkValue,
00087                      PRBool *_retval)
00088 {
00089        if(! m_pBrowserFrameGlue)
00090               return NS_ERROR_FAILURE;
00091 
00092        m_pBrowserFrameGlue->Prompt(dialogTitle, text, promptText, checkMsg, checkValue, _retval);
00093 
00094        return NS_OK;
00095 }
00096 
00097 NS_IMETHODIMP
00098 CBrowserImpl::PromptPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
00099                              PRUnichar **password,
00100                              const PRUnichar *checkMsg, PRBool *checkValue,
00101                              PRBool *_retval)
00102 {
00103        if(! m_pBrowserFrameGlue)
00104               return NS_ERROR_FAILURE;
00105 
00106        m_pBrowserFrameGlue->PromptPassword(dialogTitle, text, password,
00107                                            checkMsg, checkValue, _retval);
00108 
00109     return NS_OK;
00110 }
00111 
00112 NS_IMETHODIMP
00113 CBrowserImpl::PromptUsernameAndPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
00114                                         PRUnichar **username, PRUnichar **password,
00115                                         const PRUnichar *checkMsg, PRBool *checkValue,
00116                                         PRBool *_retval)
00117 {
00118        if(! m_pBrowserFrameGlue)
00119               return NS_ERROR_FAILURE;
00120 
00121        m_pBrowserFrameGlue->PromptUserNamePassword(dialogTitle, text, 
00122                                                                      username, password,
00123                                                                      checkMsg, checkValue, 
00124                                                                      _retval);
00125 
00126     return NS_OK;
00127 }
00128 
00129 NS_IMETHODIMP
00130 CBrowserImpl::AlertCheck(const PRUnichar *dialogTitle, 
00131                            const PRUnichar *text, 
00132                            const PRUnichar *checkMsg,
00133                            PRBool *checkValue)
00134 {
00135            return NS_ERROR_NOT_IMPLEMENTED;
00136 }
00137 
00138 NS_IMETHODIMP
00139 CBrowserImpl::ConfirmCheck(const PRUnichar *dialogTitle,
00140                             const PRUnichar *text,
00141                             const PRUnichar *checkMsg, 
00142                             PRBool *checkValue, PRBool *retval)
00143 {
00144        return NS_ERROR_NOT_IMPLEMENTED;
00145 }
00146 
00147 NS_IMETHODIMP
00148 CBrowserImpl::ConfirmEx(const PRUnichar *dialogTitle, const PRUnichar *text,
00149                         PRUint32 buttonFlags, const PRUnichar *button0Title,
00150                         const PRUnichar *button1Title, const PRUnichar *button2Title,
00151                         const PRUnichar *checkMsg, PRBool *checkValue,
00152                         PRInt32 *buttonPressed)
00153 {
00154     return NS_ERROR_NOT_IMPLEMENTED;
00155 }
00156 
00157 NS_IMETHODIMP
00158 CBrowserImpl::Select(const PRUnichar *dialogTitle,
00159                        const PRUnichar *text, PRUint32 count,
00160                        const PRUnichar **selectList,
00161                        PRInt32 *outSelection, PRBool *retval)
00162 {
00163     return NS_ERROR_NOT_IMPLEMENTED;
00164 }
00165