зеркало из https://github.com/mozilla/gecko-dev.git
Sample code - not part of the process. Bug 74120 - remove refs to old cache. r=valeski.
This commit is contained in:
Родитель
aa2fd640ff
Коммит
0108a738a8
|
@ -34,11 +34,11 @@
|
|||
#include <PP_ClassHeaders.cp>
|
||||
#endif
|
||||
|
||||
|
||||
// include mozilla prefix file
|
||||
#if wantDebugging
|
||||
#define DEBUG 1
|
||||
#include "MacPrefix_debug.h"
|
||||
#else
|
||||
#undef DEBUG
|
||||
#include "MacPrefix.h"
|
||||
#endif
|
||||
|
||||
#if wantProfiles
|
||||
|
@ -46,10 +46,7 @@
|
|||
#else
|
||||
#define USE_PROFILES 1
|
||||
#endif
|
||||
|
||||
#include "DefinesMac.h"
|
||||
#include "DefinesMozilla.h"
|
||||
|
||||
|
||||
// Support for automatically naming the precompiled header file ...
|
||||
#if __POWERPC__
|
||||
#if wantDebugging
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
#include "macstdlibextras.h"
|
||||
#include "SIOUX.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsINetDataCacheManager.h"
|
||||
|
||||
#include <TextServices.h>
|
||||
|
||||
|
@ -471,9 +470,6 @@ nsresult CBrowserApp::InitializePrefs()
|
|||
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
rv = InitCachePrefs();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not initialize cache prefs");
|
||||
|
||||
// We are using the default prefs from mozilla. If you were
|
||||
// disributing your own, this would be done simply by editing
|
||||
// the default pref files.
|
||||
|
@ -496,43 +492,6 @@ nsresult CBrowserApp::InitializePrefs()
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult CBrowserApp::InitCachePrefs()
|
||||
{
|
||||
const char * const CACHE_DIR_PREF = "browser.cache.directory";
|
||||
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// See if we have a pref to a dir which exists
|
||||
nsCOMPtr<nsILocalFile> prefDir;
|
||||
rv = prefs->GetFileXPref(CACHE_DIR_PREF, getter_AddRefs(prefDir));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool isDir;
|
||||
rv = prefDir->IsDirectory(&isDir);
|
||||
if (NS_SUCCEEDED(rv) && isDir)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Set up the new pref
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
|
||||
NS_ASSERTION(profileDir, "NS_APP_USER_PROFILE_50_DIR is not defined");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsILocalFile> cacheDir(do_QueryInterface(profileDir));
|
||||
NS_ASSERTION(cacheDir, "Cannot get nsILocalFile from cache dir");
|
||||
|
||||
PRBool exists;
|
||||
cacheDir->Append("Cache");
|
||||
rv = cacheDir->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && !exists)
|
||||
rv = cacheDir->Create(nsIFile::DIRECTORY_TYPE, 0775);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return prefs->SetFileXPref(CACHE_DIR_PREF, cacheDir);
|
||||
}
|
||||
|
||||
Boolean CBrowserApp::SelectFileObject(PP_PowerPlant::CommandT inCommand,
|
||||
FSSpec& outSpec)
|
||||
{
|
||||
|
@ -607,19 +566,6 @@ NS_IMETHODIMP CBrowserApp::Observe(nsISupports *aSubject, const PRUnichar *aTopi
|
|||
delete browserWindow;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the cache(s) The cache mgr does not do this itself since an
|
||||
// application may be using a global cache for all profiles so it would
|
||||
// not know whether to respond to a profile change.
|
||||
|
||||
NS_WITH_SERVICE(nsINetDataCacheManager, cacheMgr, NS_NETWORK_CACHE_MANAGER_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get()))
|
||||
cacheMgr->RemoveAll();
|
||||
else
|
||||
cacheMgr->Clear(nsINetDataCacheManager::MEM_CACHE);
|
||||
}
|
||||
}
|
||||
else if (!nsCRT::strcmp(aTopic, NS_LITERAL_STRING("profile-after-change").get()))
|
||||
{
|
||||
|
|
|
@ -72,7 +72,6 @@ protected:
|
|||
virtual void MakeMenuBar();
|
||||
|
||||
virtual nsresult InitializePrefs();
|
||||
static nsresult InitCachePrefs();
|
||||
|
||||
virtual Boolean SelectFileObject(PP_PowerPlant::CommandT inCommand,
|
||||
FSSpec& outSpec);
|
||||
|
|
|
@ -411,9 +411,6 @@ nsresult CMfcEmbedApp::InitializePrefs()
|
|||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
rv = InitializeCachePrefs();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not initialize cache prefs");
|
||||
|
||||
// We are using the default prefs from mozilla. If you were
|
||||
// disributing your own, this would be done simply by editing
|
||||
// the default pref files.
|
||||
|
@ -453,42 +450,6 @@ nsresult CMfcEmbedApp::InitializePrefs()
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult CMfcEmbedApp::InitializeCachePrefs()
|
||||
{
|
||||
const char * const CACHE_DIR_PREF = "browser.cache.directory";
|
||||
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// See if we have a pref to a dir which exists
|
||||
nsCOMPtr<nsILocalFile> prefDir;
|
||||
rv = prefs->GetFileXPref(CACHE_DIR_PREF, getter_AddRefs(prefDir));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRBool isDir;
|
||||
rv = prefDir->IsDirectory(&isDir);
|
||||
if (NS_SUCCEEDED(rv) && isDir)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Set up the new pref
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
|
||||
NS_ASSERTION(profileDir, "NS_APP_USER_PROFILE_50_DIR is not defined");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsILocalFile> cacheDir(do_QueryInterface(profileDir));
|
||||
NS_ASSERTION(cacheDir, "Cannot get nsILocalFile from cache dir");
|
||||
|
||||
PRBool exists;
|
||||
cacheDir->Append("Cache");
|
||||
rv = cacheDir->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && !exists)
|
||||
rv = cacheDir->Create(nsIFile::DIRECTORY_TYPE, 0775);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return prefs->SetFileXPref(CACHE_DIR_PREF, cacheDir);
|
||||
}
|
||||
|
||||
/* InitializeWindowCreator creates and hands off an object with a callback
|
||||
to a window creation function. This will be used by Gecko C++ code
|
||||
|
@ -557,10 +518,6 @@ NS_IMETHODIMP CMfcEmbedApp::Observe(nsISupports *aSubject, const PRUnichar *aTop
|
|||
pBrowserFrame->DestroyWindow();
|
||||
}
|
||||
}
|
||||
|
||||
NS_WITH_SERVICE(nsINetDataCacheManager, cacheMgr, NS_NETWORK_CACHE_MANAGER_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
cacheMgr->Clear(nsINetDataCacheManager::MEM_CACHE);
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, NS_LITERAL_STRING("profile-after-change").get()) == 0)
|
||||
{
|
||||
|
|
|
@ -106,7 +106,6 @@ private:
|
|||
BOOL InitializeProfiles();
|
||||
BOOL CreateHiddenWindow();
|
||||
nsresult InitializePrefs();
|
||||
nsresult InitializeCachePrefs();
|
||||
nsresult InitializeWindowCreator();
|
||||
|
||||
private:
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
#include "nsINetDataCacheManager.h"
|
||||
|
||||
// Local header files
|
||||
#include "winEmbed.h"
|
||||
|
@ -243,11 +242,6 @@ NS_IMETHODIMP ProfileChangeObserver::Observe(nsISupports *aSubject, const PRUnic
|
|||
|
||||
// Prevent WM_QUIT by incrementing the dialog count
|
||||
gDialogCount++;
|
||||
|
||||
// TODO why must this be done in the client???
|
||||
NS_WITH_SERVICE(nsINetDataCacheManager, cacheMgr, NS_NETWORK_CACHE_MANAGER_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
cacheMgr->Clear(nsINetDataCacheManager::MEM_CACHE);
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, NS_LITERAL_STRING("profile-after-change").get()) == 0)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче