~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpfe/bootstrap/nsNativeAppSupportBase.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 Communicator client 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
 *   Bill Law       law@netscape.com
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of
 
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
29
 * of those above. If you wish to allow use of your version of this file only
 
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
31
 * use your version of this file under the terms of the NPL, indicate your
 
32
 * decision by deleting the provisions above and replace them with the notice
 
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
34
 * the provisions above, a recipient may use your version of this file under
 
35
 * the terms of any one of the NPL, the GPL or the LGPL.
 
36
 *
 
37
 * ***** END LICENSE BLOCK ***** */
 
38
#include "nsNativeAppSupportBase.h"
 
39
 
 
40
PRBool nsNativeAppSupportBase::mLastWindowIsConfirmation = PR_FALSE;
 
41
 
 
42
nsNativeAppSupportBase::nsNativeAppSupportBase()
 
43
    : mRefCnt( 0 ),
 
44
      mSplash( 0 ),
 
45
      mServerMode( PR_FALSE ),
 
46
      mShouldShowUI( PR_TRUE ),
 
47
      mShownTurboDialog( PR_FALSE ) {
 
48
}
 
49
 
 
50
nsNativeAppSupportBase::~nsNativeAppSupportBase() {
 
51
}
 
52
 
 
53
// Start answer defaults to OK.
 
54
NS_IMETHODIMP
 
55
nsNativeAppSupportBase::Start( PRBool *result ) {
 
56
    NS_ENSURE_ARG( result );
 
57
    *result = PR_TRUE;
 
58
    return NS_OK;
 
59
}
 
60
 
 
61
// Stop answer defaults to OK.
 
62
NS_IMETHODIMP
 
63
nsNativeAppSupportBase::Stop( PRBool *result ) {
 
64
    NS_ENSURE_ARG( result );
 
65
    *result = PR_TRUE;
 
66
    return NS_OK;
 
67
}
 
68
 
 
69
// Quit is a 0x90.
 
70
NS_IMETHODIMP
 
71
nsNativeAppSupportBase::Quit() {
 
72
    return NS_OK;
 
73
}
 
74
 
 
75
NS_IMETHODIMP
 
76
nsNativeAppSupportBase::ReOpen()
 
77
{
 
78
  return NS_OK;
 
79
}
 
80
 
 
81
// Show splash screen if implementation has one.
 
82
NS_IMETHODIMP
 
83
nsNativeAppSupportBase::ShowSplashScreen() {
 
84
    if ( !mSplash ) {
 
85
        CreateSplashScreen( getter_AddRefs( mSplash ) );
 
86
    }
 
87
    if ( mSplash ) {
 
88
        mSplash->Show();
 
89
    }
 
90
    return NS_OK;
 
91
}
 
92
 
 
93
// Hide splash screen if there is one.
 
94
NS_IMETHODIMP
 
95
nsNativeAppSupportBase::HideSplashScreen() {
 
96
    // See if there is a splash screen object.
 
97
    if ( mSplash ) {
 
98
        // Unhook it.
 
99
        nsCOMPtr<nsISplashScreen> splash = mSplash;
 
100
        mSplash = 0;
 
101
        // Hide it.
 
102
        splash->Hide();
 
103
    }
 
104
    return NS_OK;
 
105
}
 
106
 
 
107
NS_IMETHODIMP
 
108
nsNativeAppSupportBase::SetIsServerMode(PRBool aIsServerMode) {
 
109
    mServerMode = aIsServerMode;
 
110
    return NS_OK;
 
111
}
 
112
 
 
113
NS_IMETHODIMP
 
114
nsNativeAppSupportBase::GetIsServerMode(PRBool *aIsServerMode) {
 
115
    NS_ENSURE_ARG( aIsServerMode );
 
116
    *aIsServerMode = mServerMode;
 
117
    return NS_OK;
 
118
}
 
119
 
 
120
NS_IMETHODIMP
 
121
nsNativeAppSupportBase::SetShouldShowUI(PRBool aShouldShowUI) {
 
122
    mShouldShowUI = aShouldShowUI;
 
123
    return NS_OK;
 
124
}
 
125
 
 
126
NS_IMETHODIMP
 
127
nsNativeAppSupportBase::GetShouldShowUI(PRBool *aShouldShowUI) {
 
128
    NS_ENSURE_ARG( aShouldShowUI );
 
129
    *aShouldShowUI = mShouldShowUI;
 
130
    return NS_OK;
 
131
}
 
132
 
 
133
NS_IMETHODIMP
 
134
nsNativeAppSupportBase::StartServerMode() {
 
135
    return NS_OK;
 
136
}
 
137
 
 
138
NS_IMETHODIMP
 
139
nsNativeAppSupportBase::OnLastWindowClosing() {
 
140
    return NS_OK;
 
141
}
 
142
 
 
143
// Default implementation doesn't have a splash screen.
 
144
NS_IMETHODIMP
 
145
nsNativeAppSupportBase::CreateSplashScreen( nsISplashScreen **splash ) {
 
146
    NS_ENSURE_ARG( splash );
 
147
    *splash = 0;
 
148
    return NS_CreateSplashScreen( splash );
 
149
}
 
150
 
 
151
// Standard implementations of AddRef/Release/QueryInterface.
 
152
NS_IMETHODIMP_(nsrefcnt)
 
153
nsNativeAppSupportBase::AddRef() {
 
154
    ++mRefCnt;
 
155
    return mRefCnt;
 
156
}
 
157
 
 
158
NS_IMETHODIMP_(nsrefcnt)
 
159
nsNativeAppSupportBase::Release() {
 
160
    --mRefCnt;
 
161
    if ( !mRefCnt ) {
 
162
        delete this;
 
163
        return 0;
 
164
    }
 
165
    return mRefCnt;
 
166
}
 
167
 
 
168
NS_IMETHODIMP
 
169
nsNativeAppSupportBase::QueryInterface( const nsIID &iid, void**p ) {
 
170
    nsresult rv = NS_OK;
 
171
    if ( p ) {
 
172
        *p = 0;
 
173
        if ( iid.Equals( NS_GET_IID( nsINativeAppSupport ) ) ) {
 
174
            nsINativeAppSupport *result = this;
 
175
            *p = result;
 
176
            NS_ADDREF( result );
 
177
        } else if ( iid.Equals( NS_GET_IID( nsISupports ) ) ) {
 
178
            nsISupports *result = NS_STATIC_CAST( nsISupports*, this );
 
179
            *p = result;
 
180
            NS_ADDREF( result );
 
181
        } else {
 
182
            rv = NS_NOINTERFACE;
 
183
        }
 
184
    } else {
 
185
        rv = NS_ERROR_NULL_POINTER;
 
186
    }
 
187
    return rv;
 
188
}
 
189
 
 
190
NS_IMETHODIMP
 
191
nsNativeAppSupportBase::EnsureProfile(nsICmdLineService* args)
 
192
{
 
193
    return NS_OK;
 
194
}