nsAutoConfig.h (1459B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef nsAutoConfig_h 7 #define nsAutoConfig_h 8 9 #include "nsITimer.h" 10 #include "nsIFile.h" 11 #include "nsINamed.h" 12 #include "nsIObserver.h" 13 #include "nsIStreamListener.h" 14 #include "nsWeakReference.h" 15 #include "nsString.h" 16 17 class nsIPrefBranch; 18 19 class nsAutoConfig final : public nsITimerCallback, 20 public nsIStreamListener, 21 public nsIObserver, 22 public nsSupportsWeakReference, 23 public nsINamed 24 25 { 26 public: 27 NS_DECL_THREADSAFE_ISUPPORTS 28 NS_DECL_NSIREQUESTOBSERVER 29 NS_DECL_NSISTREAMLISTENER 30 NS_DECL_NSIOBSERVER 31 NS_DECL_NSITIMERCALLBACK 32 NS_DECL_NSINAMED 33 34 nsAutoConfig(); 35 nsresult Init(); 36 37 void SetConfigURL(const char* aConfigURL); 38 39 protected: 40 virtual ~nsAutoConfig(); 41 nsresult downloadAutoConfig(); 42 nsresult readOfflineFile(); 43 nsresult evaluateLocalFile(nsIFile* file); 44 nsresult writeFailoverFile(); 45 nsresult getEmailAddr(nsACString& emailAddr); 46 nsresult PromptForEMailAddress(nsACString& emailAddress); 47 nsCString mBuf; 48 nsCOMPtr<nsIPrefBranch> mPrefBranch; 49 bool mLoaded; 50 nsCOMPtr<nsITimer> mTimer; 51 nsCString mConfigURL; 52 }; 53 54 #endif