mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 807757 main part - remove nsIProfileChangeStatus, nsIProfile and remnants of code to support them, r=glandium
--HG-- rename : profile/public/nsIProfileChangeStatus.idl => profile/public/notifications.txt extra : rebase_source : 89db8a63effc2eab589a184a2b686cfcca3f8f63
This commit is contained in:
parent
b6e1cd2f0d
commit
fe3cd15957
@ -45,7 +45,6 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsCWebBrowser.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
|
||||
// Glue APIs (not frozen, but safe to use because they are statically linked)
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsIPromptService.h"
|
||||
@ -180,21 +179,6 @@ NS_IMETHODIMP nsAutoConfig::Observe(nsISupports *aSubject,
|
||||
nsresult rv = NS_OK;
|
||||
if (!nsCRT::strcmp(aTopic, "profile-after-change")) {
|
||||
|
||||
// Getting the current profile name since we already have the
|
||||
// pointer to the object.
|
||||
nsCOMPtr<nsIProfile> profile = do_QueryInterface(aSubject);
|
||||
if (profile) {
|
||||
nsXPIDLString profileName;
|
||||
rv = profile->GetCurrentProfile(getter_Copies(profileName));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// setting the member variable to the current profile name
|
||||
CopyUTF16toUTF8(profileName, mCurrProfile);
|
||||
}
|
||||
else {
|
||||
NS_WARNING("nsAutoConfig::GetCurrentProfile() failed");
|
||||
}
|
||||
}
|
||||
|
||||
// We will be calling downloadAutoConfig even if there is no profile
|
||||
// name. Nothing will be passed as a parameter to the URL and the
|
||||
// default case will be picked up by the script.
|
||||
@ -496,8 +480,8 @@ nsresult nsAutoConfig::getEmailAddr(nsACString & emailAddr)
|
||||
getter_Copies(prefValue));
|
||||
if (NS_SUCCEEDED(rv) && !prefValue.IsEmpty())
|
||||
emailAddr = prefValue;
|
||||
else if (NS_FAILED(PromptForEMailAddress(emailAddr)) && (!mCurrProfile.IsEmpty()))
|
||||
emailAddr = mCurrProfile;
|
||||
else
|
||||
PromptForEMailAddress(emailAddr);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -40,7 +40,7 @@ class nsAutoConfig : public nsIAutoConfig,
|
||||
nsresult writeFailoverFile();
|
||||
nsresult getEmailAddr(nsACString & emailAddr);
|
||||
nsresult PromptForEMailAddress(nsACString &emailAddress);
|
||||
nsCString mBuf, mCurrProfile;
|
||||
nsCString mBuf;
|
||||
nsCOMPtr<nsIPrefBranch> mPrefBranch;
|
||||
bool mLoaded;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
|
@ -104,7 +104,7 @@ protected:
|
||||
*
|
||||
* @param aNotifyObservers If true, will send out profile startup
|
||||
* notifications when the profile directory is set.
|
||||
* See nsIProfileChangeStatus.
|
||||
* See notifications.txt
|
||||
*/
|
||||
|
||||
nsresult NS_NewProfileDirServiceProvider(bool aNotifyObservers,
|
||||
|
@ -12,11 +12,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = profile
|
||||
|
||||
SDK_XPIDLSRCS = \
|
||||
nsIProfile.idl \
|
||||
nsIProfileChangeStatus.idl \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIProfileUnlocker.idl \
|
||||
$(NULL)
|
||||
|
61
profile/public/notifications.txt
Normal file
61
profile/public/notifications.txt
Normal file
@ -0,0 +1,61 @@
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
nsIObserver topics for profile changing. Profile changing happens in phases
|
||||
in the order given below. An observer may register separately for each phase
|
||||
of the process depending on its needs.
|
||||
|
||||
"profile-change-teardown"
|
||||
All async activity must be stopped in this phase. Typically,
|
||||
the application level observer will close all open windows.
|
||||
This is the last phase in which the subject's vetoChange()
|
||||
method may still be called.
|
||||
The next notification will be either
|
||||
profile-change-teardown-veto or profile-before-change.
|
||||
|
||||
"profile-before-change"
|
||||
Called before the profile has changed. Use this notification
|
||||
to prepare for the profile going away. If a component is
|
||||
holding any state which needs to be flushed to a profile-relative
|
||||
location, it should be done here.
|
||||
|
||||
"profile-do-change"
|
||||
Called after the profile has changed. Do the work to
|
||||
respond to having a new profile. Any change which
|
||||
affects others must be done in this phase.
|
||||
|
||||
"profile-after-change"
|
||||
Called after the profile has changed. Use this notification
|
||||
to make changes that are dependent on what some other listener
|
||||
did during its profile-do-change. For example, to respond to
|
||||
new preferences.
|
||||
|
||||
"profile-initial-state"
|
||||
Called after all phases of a change have completed. Typically
|
||||
in this phase, an application level observer will open a new window.
|
||||
|
||||
Contexts for profile changes. These are passed as the someData param to the
|
||||
observer's Observe() method.
|
||||
|
||||
"startup"
|
||||
Going from no profile to a profile.
|
||||
The following topics happen in this context:
|
||||
profile-do-change
|
||||
profile-after-change
|
||||
|
||||
"shutdown-persist"
|
||||
The user is logging out and whatever data the observer stores
|
||||
for the current profile should be released from memory and
|
||||
saved to disk.
|
||||
The following topics happen in this context:
|
||||
profile-change-net-teardown
|
||||
profile-change-teardown
|
||||
profile-before-change
|
||||
|
||||
See https://wiki.mozilla.org/XPCOM_Shutdown for more details about the shutdown
|
||||
process.
|
||||
|
||||
NOTE: Long ago there was be a "shutdown-cleanse" version of shutdown which was
|
||||
intended to clear profile data. This is no longer sent and observer code should
|
||||
remove support for it.
|
@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFile.idl"
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_PROFILE_CID \
|
||||
{ /* {02b0625b-e7f3-11d2-9f5a-006008a6efe9} */ \
|
||||
0x02b0625b, \
|
||||
0xe7f3, \
|
||||
0x11d2, \
|
||||
{ 0x9f, 0x5a, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9 } \
|
||||
}
|
||||
|
||||
#define NS_PROFILE_CONTRACTID \
|
||||
"@mozilla.org/profile/manager;1"
|
||||
|
||||
#define NS_PROFILE_STARTUP_CATEGORY \
|
||||
"profile-startup-category"
|
||||
%}
|
||||
|
||||
/**
|
||||
* nsIProfile
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
[scriptable, uuid(02b0625a-e7f3-11d2-9f5a-006008a6efe9)]
|
||||
interface nsIProfile : nsISupports {
|
||||
|
||||
readonly attribute long profileCount;
|
||||
void getProfileList(out unsigned long length, [retval, array, size_is(length)] out wstring profileNames);
|
||||
boolean profileExists(in wstring profileName);
|
||||
|
||||
attribute wstring currentProfile;
|
||||
|
||||
const unsigned long SHUTDOWN_PERSIST = 0x00000001;
|
||||
const unsigned long SHUTDOWN_CLEANSE = 0x00000002;
|
||||
|
||||
void shutDownCurrentProfile(in unsigned long shutDownType);
|
||||
|
||||
void createNewProfile(in wstring profileName,
|
||||
in wstring nativeProfileDir,
|
||||
in wstring langcode,
|
||||
in boolean useExistingDir);
|
||||
|
||||
void renameProfile(in wstring oldName, in wstring newName);
|
||||
void deleteProfile(in wstring name, in boolean canDeleteFiles);
|
||||
void cloneProfile(in wstring profileName);
|
||||
};
|
@ -1,109 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
|
||||
/**
|
||||
* nsIObserver topics for profile changing. Profile changing happens in phases
|
||||
* in the order given below. An observer may register separately for each phase
|
||||
* of the process depending on its needs. The subject passed to the observer's
|
||||
* Observe() method can be QI'd to an nsIProfileChangeStatus.
|
||||
*
|
||||
* "profile-approve-change"
|
||||
* Called before a profile change is attempted. Typically,
|
||||
* the application level observer will ask the user if
|
||||
* he/she wants to stop all network activity, close all open
|
||||
* windows, etc. If the user says NO, the observer should
|
||||
* call the subject's vetoChange(). If any observer does
|
||||
* this, the profile will not be changed.
|
||||
*
|
||||
* "profile-change-teardown"
|
||||
* All async activity must be stopped in this phase. Typically,
|
||||
* the application level observer will close all open windows.
|
||||
* This is the last phase in which the subject's vetoChange()
|
||||
* method may still be called.
|
||||
* The next notification will be either
|
||||
* profile-change-teardown-veto or profile-before-change.
|
||||
*
|
||||
* "profile-change-teardown-veto"
|
||||
* This notification will only be sent, if the profile change
|
||||
* was vetoed during the profile-change-teardown phase.
|
||||
* This allows components to bring back required resources,
|
||||
* that were tore down on profile-change-teardown.
|
||||
*
|
||||
* "profile-before-change"
|
||||
* Called before the profile has changed. Use this notification
|
||||
* to prepare for the profile going away. If a component is
|
||||
* holding any state which needs to be flushed to a profile-relative
|
||||
* location, it should be done here.
|
||||
*
|
||||
* "profile-do-change"
|
||||
* Called after the profile has changed. Do the work to
|
||||
* respond to having a new profile. Any change which
|
||||
* affects others must be done in this phase.
|
||||
*
|
||||
* "profile-after-change"
|
||||
* Called after the profile has changed. Use this notification
|
||||
* to make changes that are dependent on what some other listener
|
||||
* did during its profile-do-change. For example, to respond to
|
||||
* new preferences.
|
||||
*
|
||||
* "profile-initial-state"
|
||||
* Called after all phases of a change have completed. Typically
|
||||
* in this phase, an application level observer will open a new window.
|
||||
*
|
||||
* Contexts for profile changes. These are passed as the someData param to the
|
||||
* observer's Observe() method.
|
||||
|
||||
* "startup"
|
||||
* Going from no profile to a profile.
|
||||
*
|
||||
* The following topics happen in this context:
|
||||
* profile-do-change
|
||||
* profile-after-change
|
||||
*
|
||||
* "shutdown-persist"
|
||||
* The user is logging out and whatever data the observer stores
|
||||
* for the current profile should be released from memory and
|
||||
* saved to disk.
|
||||
*
|
||||
* "shutdown-cleanse"
|
||||
* The user is logging out and whatever data the observer stores
|
||||
* for the current profile should be released from memory and
|
||||
* deleted from disk.
|
||||
*
|
||||
* The following topics happen in both shutdown contexts:
|
||||
* profile-approve-change
|
||||
* profile-change-teardown
|
||||
* profile-before-change
|
||||
*
|
||||
* "switch"
|
||||
* Going from one profile to another.
|
||||
*
|
||||
* All of the above topics happen in a profile switch.
|
||||
*
|
||||
*/
|
||||
%}
|
||||
|
||||
|
||||
[scriptable, uuid(2f977d43-5485-11d4-87e2-0010a4e75ef2)]
|
||||
interface nsIProfileChangeStatus : nsISupports {
|
||||
|
||||
void vetoChange();
|
||||
|
||||
/**
|
||||
* Called by a profile change observer when a fatal error
|
||||
* occurred during the attempt to switch the profile.
|
||||
*
|
||||
* The profile should be considered in an unsafe condition,
|
||||
* and the profile manager should inform the user and
|
||||
* exit immediately.
|
||||
*
|
||||
*/
|
||||
void changeFailed();
|
||||
|
||||
};
|
@ -12,7 +12,6 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "nsIFile.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIToolkitChromeRegistry.h"
|
||||
|
||||
@ -835,32 +834,6 @@ nsXREDirProvider::DoStartup()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class ProfileChangeStatusImpl MOZ_FINAL : public nsIProfileChangeStatus
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROFILECHANGESTATUS
|
||||
ProfileChangeStatusImpl() { }
|
||||
private:
|
||||
~ProfileChangeStatusImpl() { }
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ProfileChangeStatusImpl, nsIProfileChangeStatus)
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileChangeStatusImpl::VetoChange()
|
||||
{
|
||||
NS_ERROR("Can't veto change!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ProfileChangeStatusImpl::ChangeFailed()
|
||||
{
|
||||
NS_ERROR("Profile change cancellation.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void
|
||||
nsXREDirProvider::DoShutdown()
|
||||
{
|
||||
@ -869,11 +842,10 @@ nsXREDirProvider::DoShutdown()
|
||||
mozilla::services::GetObserverService();
|
||||
NS_ASSERTION(obsSvc, "No observer service?");
|
||||
if (obsSvc) {
|
||||
nsCOMPtr<nsIProfileChangeStatus> cs = new ProfileChangeStatusImpl();
|
||||
static const PRUnichar kShutdownPersist[] =
|
||||
{'s','h','u','t','d','o','w','n','-','p','e','r','s','i','s','t','\0'};
|
||||
obsSvc->NotifyObservers(cs, "profile-change-net-teardown", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(cs, "profile-change-teardown", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(nullptr, "profile-change-net-teardown", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist);
|
||||
|
||||
// Phase 2c: Now that things are torn down, force JS GC so that things which depend on
|
||||
// resources which are about to go away in "profile-before-change" are destroyed first.
|
||||
@ -889,7 +861,7 @@ nsXREDirProvider::DoShutdown()
|
||||
}
|
||||
|
||||
// Phase 3: Notify observers of a profile change
|
||||
obsSvc->NotifyObservers(cs, "profile-before-change", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
|
||||
}
|
||||
mProfileNotified = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user