Bug 488140 - rename the class in nsAutodial and friends to be consistent. r=jduell, sr=stuart
authorDoug Turner <dougt@meer.net>
Mon, 13 Apr 2009 21:41:33 -0700
changeset 27314 68d9acc704912c6554c4fd8d0ed4c1303bafc171
parent 27313 6eddf5c0fe3e70a66b878b2b00810860e863a5f2
child 27315 ed90488b4d79fd58297b19647aa46f1193ea6a75
push id6489
push userdougt@mozilla.com
push dateTue, 14 Apr 2009 15:03:49 +0000
treeherdermozilla-central@68d9acc70491 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell, stuart
bugs488140
milestone1.9.2a1pre
Bug 488140 - rename the class in nsAutodial and friends to be consistent. r=jduell, sr=stuart
netwerk/base/src/nsAutodialWin.cpp
netwerk/base/src/nsAutodialWin.h
netwerk/base/src/nsAutodialWinCE.cpp
netwerk/base/src/nsAutodialWinCE.h
netwerk/base/src/nsNativeConnectionHelper.cpp
--- a/netwerk/base/src/nsAutodialWin.cpp
+++ b/netwerk/base/src/nsAutodialWin.cpp
@@ -65,55 +65,55 @@
 static PRLogModuleInfo* gLog = nsnull;
 #endif
 
 #define LOGD(args) PR_LOG(gLog, PR_LOG_DEBUG, args)
 #define LOGE(args) PR_LOG(gLog, PR_LOG_ERROR, args)
 
 // Don't try to dial again within a few seconds of when user pressed cancel.
 #define NO_RETRY_PERIOD_SEC 5
-PRIntervalTime nsRASAutodial::mDontRetryUntil = 0;
+PRIntervalTime nsAutodial::mDontRetryUntil = 0;
 
 
-tRASPHONEBOOKDLG nsRASAutodial::mpRasPhonebookDlg = nsnull;
-tRASENUMCONNECTIONS nsRASAutodial::mpRasEnumConnections = nsnull;
-tRASENUMENTRIES nsRASAutodial::mpRasEnumEntries = nsnull;
-tRASDIALDLG nsRASAutodial::mpRasDialDlg = nsnull;
-tRASSETAUTODIALADDRESS nsRASAutodial::mpRasSetAutodialAddress = nsnull;
-tRASGETAUTODIALADDRESS nsRASAutodial::mpRasGetAutodialAddress = nsnull;
-tRASGETAUTODIALENABLE nsRASAutodial::mpRasGetAutodialEnable = nsnull;
-tRASGETAUTODIALPARAM nsRASAutodial::mpRasGetAutodialParam = nsnull;
+tRASPHONEBOOKDLG nsAutodial::mpRasPhonebookDlg = nsnull;
+tRASENUMCONNECTIONS nsAutodial::mpRasEnumConnections = nsnull;
+tRASENUMENTRIES nsAutodial::mpRasEnumEntries = nsnull;
+tRASDIALDLG nsAutodial::mpRasDialDlg = nsnull;
+tRASSETAUTODIALADDRESS nsAutodial::mpRasSetAutodialAddress = nsnull;
+tRASGETAUTODIALADDRESS nsAutodial::mpRasGetAutodialAddress = nsnull;
+tRASGETAUTODIALENABLE nsAutodial::mpRasGetAutodialEnable = nsnull;
+tRASGETAUTODIALPARAM nsAutodial::mpRasGetAutodialParam = nsnull;
 
-HINSTANCE nsRASAutodial::mhRASdlg = nsnull;
-HINSTANCE nsRASAutodial::mhRASapi32 = nsnull;
+HINSTANCE nsAutodial::mhRASdlg = nsnull;
+HINSTANCE nsAutodial::mhRASapi32 = nsnull;
 
 // ctor. 
-nsRASAutodial::nsRASAutodial()
+nsAutodial::nsAutodial()
 :   mAutodialBehavior(AUTODIAL_DEFAULT),
     mNumRASConnectionEntries(0),
     mAutodialServiceDialingLocation(-1)
 {
     mOSVerInfo.dwOSVersionInfoSize = sizeof(mOSVerInfo);
     GetVersionEx(&mOSVerInfo);
 
     // Initializations that can be made again since RAS OS settings can 
     // change.
     Init();
 }
 
 // dtor
-nsRASAutodial::~nsRASAutodial()
+nsAutodial::~nsAutodial()
 {
 }
 
 
 // Get settings from the OS. These are settings that might change during
 // the OS session. Call Init() again to pick up those changes if required.
 // Returns NS_ERROR_FAILURE if error or NS_OK if success.
-nsresult nsRASAutodial::Init()
+nsresult nsAutodial::Init()
 {
 #ifdef PR_LOGGING
     if (!gLog)
         gLog = PR_NewLogModule("Autodial");
 #endif
 
     mDefaultEntryName[0] = '\0';
     mNumRASConnectionEntries = 0;
@@ -135,17 +135,17 @@ nsresult nsRASAutodial::Init()
     
     return result;
 }
 
 
 // Should we attempt to dial on a network error? Yes if the Internet Options
 // configured as such. Yes if the RAS autodial service is running (we'll try to
 // force it to dial in that case by adding the network address to its db.)
-PRBool nsRASAutodial::ShouldDialOnNetworkError()
+PRBool nsAutodial::ShouldDialOnNetworkError()
 {
     // Don't try to dial again within a few seconds of when user pressed cancel.
     if (mDontRetryUntil) 
     {
         PRIntervalTime intervalNow = PR_IntervalNow();
         if (intervalNow < mDontRetryUntil) 
         {
             LOGD(("Autodial: Not dialing: too soon."));
@@ -159,17 +159,17 @@ PRBool nsRASAutodial::ShouldDialOnNetwor
              || (mAutodialBehavior == AUTODIAL_USE_SERVICE));
 }
 
 
 // The autodial info is set in Control Panel | Internet Options | Connections.
 // The values are stored in the registry. This function gets those values from
 // the registry and determines if we should never dial, always dial, or dial
 // when there is no network found.
-int nsRASAutodial::QueryAutodialBehavior()
+int nsAutodial::QueryAutodialBehavior()
 {
     if (IsAutodialServiceRunning())
     {
         if (!LoadRASapi32DLL())
             return AUTODIAL_NEVER;
 
         // Is Autodial service enabled for the current login session?
         DWORD disabled = 0;
@@ -251,17 +251,17 @@ int nsRASAutodial::QueryAutodialBehavior
 // there are multiple entries but one is defined as the default, we'll use
 // the single entry dial dialog. If there are multiple connection entries,
 // and none is specified as default, we'll bring up the diallog which lets
 // the user select the connection entry to use.
 //
 // Return values:
 //  NS_OK: dialing was successful and caller should retry
 //  all other values indicate that the caller should not retry
-nsresult nsRASAutodial::DialDefault(const PRUnichar* hostName)
+nsresult nsAutodial::DialDefault(const PRUnichar* hostName)
 {
     mDontRetryUntil = 0;
 
     if (mAutodialBehavior == AUTODIAL_NEVER)
     {
         return NS_ERROR_FAILURE;    // don't retry the network error
     }
 
@@ -364,17 +364,17 @@ nsresult nsRASAutodial::DialDefault(cons
     }
 
     // Retry because we just established a dialup connection.
     return NS_OK;
 }
 
 
 // Check to see if RAS is already connected.
-PRBool nsRASAutodial::IsRASConnected()
+PRBool nsAutodial::IsRASConnected()
 {
     DWORD connections;
     RASCONN rasConn;
     rasConn.dwSize = sizeof(rasConn);
     DWORD structSize = sizeof(rasConn);
 
     if (!LoadRASapi32DLL())
         return NS_ERROR_NULL_POINTER;
@@ -387,17 +387,17 @@ PRBool nsRASAutodial::IsRASConnected()
         return (connections > 0);
     }
 
     LOGE(("Autodial: ::RasEnumConnections failed: Error = %d", result));
     return PR_FALSE;
 }
 
 // Get the first RAS dial entry name from the phonebook.
-nsresult nsRASAutodial::GetFirstEntryName(PRUnichar* entryName, int bufferSize)
+nsresult nsAutodial::GetFirstEntryName(PRUnichar* entryName, int bufferSize)
 {
     // Need to load the DLL if not loaded yet.
     if (!LoadRASapi32DLL())
         return NS_ERROR_NULL_POINTER;
 
     RASENTRYNAMEW rasEntryName;
     rasEntryName.dwSize = sizeof(rasEntryName);
     DWORD cb = sizeof(rasEntryName);
@@ -413,17 +413,17 @@ nsresult nsRASAutodial::GetFirstEntryNam
                 bufferSize / sizeof(*entryName));
         return NS_OK;
     }
 
     return NS_ERROR_FAILURE;
 }
 
 // Get the number of RAS dial entries in the phonebook.
-int nsRASAutodial::NumRASEntries()
+int nsAutodial::NumRASEntries()
 {
     // Need to load the DLL if not loaded yet.
     if (!LoadRASapi32DLL())
         return 0;
 
     RASENTRYNAMEW rasEntryName;
     rasEntryName.dwSize = sizeof(rasEntryName);
     DWORD cb = sizeof(rasEntryName);
@@ -438,17 +438,17 @@ int nsRASAutodial::NumRASEntries()
     {
         return (int)cEntries;
     }
 
     return 0;
 }
 
 // Get the name of the default dial entry.
-nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
+nsresult nsAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
 {
     // No RAS dialup entries. 
     if (mNumRASConnectionEntries <= 0)
     {
         return NS_ERROR_FAILURE;
     }
 
     // Single RAS dialup entry. Use it as the default to autodial.
@@ -540,17 +540,17 @@ nsresult nsRASAutodial::GetDefaultEntryN
         return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
 }
 
 
 // Determine if the autodial service is running on this PC.
-PRBool nsRASAutodial::IsAutodialServiceRunning()
+PRBool nsAutodial::IsAutodialServiceRunning()
 {
     SC_HANDLE hSCManager = 
       OpenSCManager(nsnull, SERVICES_ACTIVE_DATABASE, SERVICE_QUERY_STATUS);
 
     if (hSCManager == nsnull)
     {
         LOGE(("Autodial: failed to open service control manager. Error %d.", 
           ::GetLastError()));
@@ -575,17 +575,17 @@ PRBool nsRASAutodial::IsAutodialServiceR
 
         return PR_FALSE;
     }
 
     return (status.dwCurrentState == SERVICE_RUNNING);
 }
 
 // Add the specified address to the autodial directory.
-PRBool nsRASAutodial::AddAddressToAutodialDirectory(const PRUnichar* hostName)
+PRBool nsAutodial::AddAddressToAutodialDirectory(const PRUnichar* hostName)
 {
     // Need to load the DLL if not loaded yet.
     if (!LoadRASapi32DLL())
         return PR_FALSE;
 
     // First see if there is already a db entry for this address. 
     RASAUTODIALENTRYW autodialEntry;
     autodialEntry.dwSize = sizeof(autodialEntry);
@@ -624,17 +624,17 @@ PRBool nsRASAutodial::AddAddressToAutodi
 
     LOGD(("Autodial: Added address %s to RAS autodial db for entry %s.",
          hostName, NS_ConvertUTF16toUTF8(autodialEntry.szEntry).get()));
 
     return PR_TRUE;
 }
 
 // Get the current TAPI dialing location.
-int nsRASAutodial::GetCurrentLocation()
+int nsAutodial::GetCurrentLocation()
 {
     HKEY hKey = 0;
     LONG result = ::RegOpenKeyExW(
                     HKEY_LOCAL_MACHINE, 
                     L"Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations", 
                     0, 
                     KEY_READ, 
                     &hKey);
@@ -658,17 +658,17 @@ int nsRASAutodial::GetCurrentLocation()
     }
 
     ::RegCloseKey(hKey);
     return location;
 
 }
 
 // Check to see if autodial for the specified location is enabled. 
-PRBool nsRASAutodial::IsAutodialServiceEnabled(int location)
+PRBool nsAutodial::IsAutodialServiceEnabled(int location)
 {
     if (location < 0)
         return PR_FALSE;
 
     if (!LoadRASapi32DLL())
         return PR_FALSE;
 
     PRBool enabled;
@@ -678,17 +678,17 @@ PRBool nsRASAutodial::IsAutodialServiceE
         return PR_FALSE;
     }
 
     return enabled;
 }
 
 
 
-PRBool nsRASAutodial::LoadRASapi32DLL()
+PRBool nsAutodial::LoadRASapi32DLL()
 {
     if (!mhRASapi32)
     {
         mhRASapi32 = ::LoadLibraryW(L"rasapi32.dll");
         if ((UINT)mhRASapi32 > 32)
         {
             // RasEnumConnections
             mpRasEnumConnections = (tRASENUMCONNECTIONS)
@@ -727,17 +727,17 @@ PRBool nsRASAutodial::LoadRASapi32DLL()
     {
         LOGE(("Autodial: Error loading RASAPI32.DLL."));
         return PR_FALSE;
     }
 
     return PR_TRUE;
 }
 
-PRBool nsRASAutodial::LoadRASdlgDLL()
+PRBool nsAutodial::LoadRASdlgDLL()
 {
     if (!mhRASdlg)
     {
         mhRASdlg = ::LoadLibraryW(L"rasdlg.dll");
         if ((UINT)mhRASdlg > 32)
         {
             // RasPhonebookDlg
             mpRasPhonebookDlg =
--- a/netwerk/base/src/nsAutodialWin.h
+++ b/netwerk/base/src/nsAutodialWin.h
@@ -87,17 +87,17 @@ typedef DWORD (WINAPI* tRASGETAUTODIALPA
 // In this case, the initialization overhead is not significant, and it will
 // guaranteed to be in sync with OS.
 //
 // To use, create an instance and call ShouldDialOnNetworkError() to determine 
 // if you should dial or not. That function only return true for the
 // target OS's so the caller doesn't have to deal with OS version checking.
 //
 
-class nsRASAutodial
+class nsAutodial
 {
 private:
 
     //
     // Some helper functions to query the OS for autodial configuration.
     //
 
     // Determine if the autodial service is running on this PC.
@@ -169,20 +169,20 @@ private:
 
     PRBool LoadRASapi32DLL();
     PRBool LoadRASdlgDLL();
 
 
 public:
   
     // ctor
-    nsRASAutodial();
+    nsAutodial();
 
     // dtor
-    virtual ~nsRASAutodial();
+    virtual ~nsAutodial();
 
     // Get the autodial info from the OS and init this obj with it. Call it any
     // time to refresh the object's settings from the OS.
     nsresult Init();
 
     // Dial the default RAS dialup connection.
     nsresult DialDefault(const PRUnichar* hostName);
 
--- a/netwerk/base/src/nsAutodialWinCE.cpp
+++ b/netwerk/base/src/nsAutodialWinCE.cpp
@@ -44,46 +44,46 @@
 #include "nsAutodialWinCE.h"
 
 #include "nsCOMPtr.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 
 // pulled from the header so that we do not get multiple define errors during link
-static const GUID ras_DestNetInternet =
+static const GUID autodial_DestNetInternet =
         { 0x436ef144, 0xb4fb, 0x4863, { 0xa0, 0x41, 0x8f, 0x90, 0x5a, 0x62, 0xc5, 0x72 } };
 
-nsRASAutodial::nsRASAutodial()
+nsAutodial::nsAutodial()
 {
 }
 
-nsRASAutodial::~nsRASAutodial()
+nsAutodial::~nsAutodial()
 {
 }
 
 nsresult
-nsRASAutodial::Init()
+nsAutodial::Init()
 {
   return NS_OK;
 }
 
-nsresult nsRASAutodial::DialDefault(const PRUnichar* /* hostName */)
+nsresult nsAutodial::DialDefault(const PRUnichar* /* hostName */)
 {
 #ifdef WINCE_WINDOWS_MOBILE
   HANDLE connectionHandle;
 
   // Make the connection to the new network
   CONNMGR_CONNECTIONINFO conn_info;
   memset(&conn_info, 0, sizeof(conn_info));
   
   conn_info.cbSize      = sizeof(conn_info);
   conn_info.dwParams    = CONNMGR_PARAM_GUIDDESTNET;
   conn_info.dwPriority  = CONNMGR_PRIORITY_USERINTERACTIVE;
-  conn_info.guidDestNet = ras_DestNetInternet;
+  conn_info.guidDestNet = autodial_DestNetInternet;
   conn_info.bExclusive  = FALSE;
   conn_info.bDisabled   = FALSE;
   
   DWORD status;
   HRESULT result = ConnMgrEstablishConnectionSync(&conn_info, 
                                                   &connectionHandle, 
                                                   60000,
                                                   &status);
@@ -93,16 +93,16 @@ nsresult nsRASAutodial::DialDefault(cons
 
   return NS_OK;
 #else
   return NS_ERROR_FAILURE;
 #endif
 }
 
 PRBool
-nsRASAutodial::ShouldDialOnNetworkError()
+nsAutodial::ShouldDialOnNetworkError()
 {
 #ifdef WINCE_WINDOWS_MOBILE
   return PR_TRUE;
 #else
   return PR_FALSE;
 #endif
 }
--- a/netwerk/base/src/nsAutodialWinCE.h
+++ b/netwerk/base/src/nsAutodialWinCE.h
@@ -39,25 +39,25 @@
 #define nsAutodialWin_h__
 
 #include "nspr.h"
 #include "nscore.h"
 
 #include <windows.h>
 
 
-class nsRASAutodial
+class nsAutodial
 {
 public:
   
     // ctor
-    nsRASAutodial();
+    nsAutodial();
 
     // dtor
-    virtual ~nsRASAutodial();
+    virtual ~nsAutodial();
 
     // Get the autodial info from the OS and init this obj with it. Call it any
     // time to refresh the object's settings from the OS.
     nsresult Init();
 
     // Dial the default RAS dialup connection.
     nsresult DialDefault(const PRUnichar* hostName);
 
--- a/netwerk/base/src/nsNativeConnectionHelper.cpp
+++ b/netwerk/base/src/nsNativeConnectionHelper.cpp
@@ -49,23 +49,22 @@
 //-----------------------------------------------------------------------------
 
 PRBool
 nsNativeConnectionHelper::OnConnectionFailed(const PRUnichar* hostName)
 {
     if (gIOService->IsLinkUp())
         return PR_FALSE;
 
-    nsRASAutodial autodial;
+    nsAutodial autodial;
 
     if (autodial.ShouldDialOnNetworkError()) 
         return NS_SUCCEEDED(autodial.DialDefault(hostName));
     else
         return PR_FALSE;
 }
 
 PRBool
 nsNativeConnectionHelper::IsAutodialEnabled()
 {
-    nsRASAutodial autodial;
-
+    nsAutodial autodial;
     return autodial.Init() == NS_OK && autodial.ShouldDialOnNetworkError();
 }