merge fx-team to m-c

This commit is contained in:
Rob Campbell 2011-11-07 18:49:23 -04:00
commit 443e44fc32

View File

@ -62,6 +62,7 @@
#include "nsWidgetsCID.h"
#include "nsPIDOMWindow.h"
#include "nsAppDirectoryServiceDefs.h"
#include "mozilla/Preferences.h"
#include <io.h>
#include <propvarutil.h>
#include <propkey.h>
@ -274,6 +275,28 @@ WinTaskbar::~WinTaskbar() {
// static
bool
WinTaskbar::GetAppUserModelID(nsAString & aDefaultGroupId) {
// If marked as such in prefs, use a hash of the profile path for the id
// instead of the install path hash setup by the installer.
bool useProfile =
Preferences::GetBool("taskbar.grouping.useprofile", false);
if (useProfile) {
nsCOMPtr<nsIFile> profileDir;
NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR,
getter_AddRefs(profileDir));
bool exists = false;
if (profileDir && NS_SUCCEEDED(profileDir->Exists(&exists)) && exists) {
nsCAutoString path;
if (NS_SUCCEEDED(profileDir->GetNativePath(path))) {
nsAutoString id;
id.AppendInt(HashString(path));
if (!id.IsEmpty()) {
aDefaultGroupId.Assign(id);
return true;
}
}
}
}
// The default value is set by the installer and is stored in the registry
// under (HKLM||HKCU)/Software/Mozilla/Firefox/TaskBarIDs. If for any reason
// hash generation operation fails, the installer will not store a value in