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: Mozilla-sample-code 1.0
00004  *
00005  * Copyright (c) 2002 Netscape Communications Corporation and
00006  * other contributors
00007  *
00008  * Permission is hereby granted, free of charge, to any person obtaining a
00009  * copy of this Mozilla sample software and associated documentation files
00010  * (the "Software"), to deal in the Software without restriction, including
00011  * without limitation the rights to use, copy, modify, merge, publish,
00012  * distribute, sublicense, and/or sell copies of the Software, and to permit
00013  * persons to whom the Software is furnished to do so, subject to the
00014  * following conditions:
00015  *
00016  * The above copyright notice and this permission notice shall be included
00017  * in all copies or substantial portions of the Software.
00018  *
00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00020  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00022  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00024  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00025  * DEALINGS IN THE SOFTWARE.
00026  *
00027  * Contributor(s):
00028  *   Chak Nanga <chak@netscape.com>
00029  *
00030  * ***** END LICENSE BLOCK ***** */
00031 
00032 // File overview.....
00033 //
00034 // The nsIPrompt interface is mainly used to convey/get information
00035 // from a user via Alerts, Prompts etc.
00036 // 
00037 
00038 #ifdef _WINDOWS
00039   #include "stdafx.h"
00040 #endif
00041 #include "BrowserImpl.h"
00042 #include "IBrowserFrameGlue.h"
00043 
00044 //*****************************************************************************
00045 // CBrowserImpl::nsIPrompt Implementation
00046 //*****************************************************************************   
00047 
00048 
00049 // Needed for JavaScript and other cases where a msg needs to be 
00050 // shown to the user. For ex, when a page has some JS such as
00051 // "Alert("Hello")" this method will be invoked
00052 NS_IMETHODIMP
00053 CBrowserImpl::Alert(const PRUnichar *dialogTitle, const PRUnichar *text)
00054 {
00055     if(! m_pBrowserFrameGlue)
00056         return NS_ERROR_FAILURE;
00057     
00058     m_pBrowserFrameGlue->Alert(dialogTitle, text);
00059 
00060     return NS_OK;
00061 }
00062 
00063 // Invoked in the case of a JS confirm() method invocation
00064 NS_IMETHODIMP
00065 CBrowserImpl::Confirm(const PRUnichar *dialogTitle, 
00066                const PRUnichar *text, PRBool *retval)
00067 {
00068     if(! m_pBrowserFrameGlue)
00069         return NS_ERROR_FAILURE;
00070 
00071     m_pBrowserFrameGlue->Confirm(dialogTitle, text, retval);
00072 
00073     return NS_OK;
00074 }
00075 
00076 NS_IMETHODIMP
00077 CBrowserImpl::Prompt(const PRUnichar *dialogTitle, const PRUnichar *text,
00078                      PRUnichar **promptText,
00079                      const PRUnichar *checkMsg, PRBool *checkValue,
00080                      PRBool *_retval)
00081 {
00082     if(! m_pBrowserFrameGlue)
00083         return NS_ERROR_FAILURE;
00084 
00085     m_pBrowserFrameGlue->Prompt(dialogTitle, text, promptText, checkMsg, checkValue, _retval);
00086 
00087     return NS_OK;
00088 }
00089 
00090 NS_IMETHODIMP
00091 CBrowserImpl::PromptPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
00092                              PRUnichar **password,
00093                              const PRUnichar *checkMsg, PRBool *checkValue,
00094                              PRBool *_retval)
00095 {
00096     if(! m_pBrowserFrameGlue)
00097         return NS_ERROR_FAILURE;
00098 
00099     m_pBrowserFrameGlue->PromptPassword(dialogTitle, text, password,
00100                                         checkMsg, checkValue, _retval);
00101 
00102     return NS_OK;
00103 }
00104 
00105 NS_IMETHODIMP
00106 CBrowserImpl::PromptUsernameAndPassword(const PRUnichar *dialogTitle, const PRUnichar *text,
00107                                         PRUnichar **username, PRUnichar **password,
00108                                         const PRUnichar *checkMsg, PRBool *checkValue,
00109                                         PRBool *_retval)
00110 {
00111     if(! m_pBrowserFrameGlue)
00112         return NS_ERROR_FAILURE;
00113 
00114     m_pBrowserFrameGlue->PromptUserNamePassword(dialogTitle, text, 
00115                                                 username, password,
00116                                                 checkMsg, checkValue, 
00117                                                 _retval);
00118 
00119     return NS_OK;
00120 }
00121 
00122 NS_IMETHODIMP
00123 CBrowserImpl::AlertCheck(const PRUnichar *dialogTitle, 
00124                   const PRUnichar *text, 
00125                   const PRUnichar *checkMsg,
00126                   PRBool *checkValue)
00127 {
00128         return NS_ERROR_NOT_IMPLEMENTED;
00129 }
00130 
00131 NS_IMETHODIMP
00132 CBrowserImpl::ConfirmCheck(const PRUnichar *dialogTitle,
00133                 const PRUnichar *text,
00134                 const PRUnichar *checkMsg, 
00135                 PRBool *checkValue, PRBool *retval)
00136 {
00137     return NS_ERROR_NOT_IMPLEMENTED;
00138 }
00139 
00140 NS_IMETHODIMP
00141 CBrowserImpl::ConfirmEx(const PRUnichar *dialogTitle, const PRUnichar *text,
00142                         PRUint32 buttonFlags, const PRUnichar *button0Title,
00143                         const PRUnichar *button1Title, const PRUnichar *button2Title,
00144                         const PRUnichar *checkMsg, PRBool *checkValue,
00145                         PRInt32 *buttonPressed)
00146 {
00147     return NS_ERROR_NOT_IMPLEMENTED;
00148 }
00149 
00150 NS_IMETHODIMP
00151 CBrowserImpl::Select(const PRUnichar *dialogTitle,
00152               const PRUnichar *text, PRUint32 count,
00153               const PRUnichar **selectList,
00154               PRInt32 *outSelection, PRBool *retval)
00155 {
00156     return NS_ERROR_NOT_IMPLEMENTED;
00157 }
00158