diff --git a/profile/public/Makefile.in b/profile/public/Makefile.in index 05619532844..44d65c75951 100644 --- a/profile/public/Makefile.in +++ b/profile/public/Makefile.in @@ -37,6 +37,7 @@ SDK_XPIDLSRCS = \ XPIDLSRCS = \ nsIProfileInternal.idl \ nsIProfileStartupListener.idl \ + nsISessionRoaming.idl \ $(NULL) ifeq ($(OS_ARCH),WINNT) diff --git a/profile/public/nsISessionRoaming.idl b/profile/public/nsISessionRoaming.idl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/profile/src/nsProfile.cpp b/profile/src/nsProfile.cpp index a4c924eb8d8..e7148dda392 100644 --- a/profile/src/nsProfile.cpp +++ b/profile/src/nsProfile.cpp @@ -80,6 +80,7 @@ #include "nsHashtable.h" #include "nsIAtom.h" #include "nsProfileDirServiceProvider.h" +#include "nsISessionRoaming.h" // Interfaces Needed #include "nsIDocShell.h" @@ -156,6 +157,7 @@ static nsProfileDirServiceProvider *gDirServiceProvider = nsnull; static NS_DEFINE_CID(kPrefMigrationCID, NS_PREFMIGRATION_CID); static NS_DEFINE_CID(kPrefConverterCID, NS_PREFCONVERTER_CID); +#define NS_SESSIONROAMING_CONTRACTID "@mozilla.org/profile/session-roaming;1" /* @@ -1258,6 +1260,13 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile) return NS_ERROR_ABORT; } + // Roaming download + // Tolerate errors. Maybe the roaming extension isn't installed. + nsCOMPtr roam = + do_GetService(NS_SESSIONROAMING_CONTRACTID, &rv); + if (NS_SUCCEEDED(rv)) + roam->BeginSession(); + // Phase 4: Notify observers that the profile has changed - Here they respond to new profile observerService->NotifyObservers(subject, "profile-do-change", context.get()); if (mProfileChangeFailed) @@ -1344,6 +1353,13 @@ NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType) observerService->NotifyObservers(subject, "profile-before-change", context.get()); } + // Roaming upload + // Tolerate errors. Maybe the roaming extension isn't installed. + nsCOMPtr roam = + do_GetService(NS_SESSIONROAMING_CONTRACTID, &rv); + if (NS_SUCCEEDED(rv)) + roam->EndSession(); + gDirServiceProvider->SetProfileDir(nsnull); UpdateCurrentProfileModTime(PR_TRUE); mCurrentProfileAvailable = PR_FALSE;