This commit is contained in:
Jim Mathies 2010-06-30 21:09:47 -05:00
commit 74b6dfff3b
2 changed files with 25 additions and 37 deletions

View File

@ -107,36 +107,9 @@ GeckoChildProcessHost::~GeckoChildProcessHost()
);
}
#ifdef XP_WIN
void GeckoChildProcessHost::InitWindowsGroupID()
{
// On Win7+, pass the application user model to the child, so it can
// register with it. This insures windows created by the container
// properly group with the parent app on the Win7 taskbar.
nsCOMPtr<nsIWinTaskbar> taskbarInfo =
do_GetService(NS_TASKBAR_CONTRACTID);
if (taskbarInfo) {
PRBool isSupported = PR_FALSE;
taskbarInfo->GetAvailable(&isSupported);
nsAutoString appId;
if (isSupported && NS_SUCCEEDED(taskbarInfo->GetDefaultGroupId(appId))) {
mGroupId.Assign(PRUnichar('\"'));
mGroupId.Append(appId);
mGroupId.Append(PRUnichar('\"'));
} else {
mGroupId.AssignLiteral("-");
}
}
}
#endif
bool
GeckoChildProcessHost::SyncLaunch(std::vector<std::string> aExtraOpts)
{
#ifdef XP_WIN
InitWindowsGroupID();
#endif
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
NS_ASSERTION(MessageLoop::current() != ioLoop, "sync launch from the IO thread NYI");
@ -158,10 +131,6 @@ GeckoChildProcessHost::SyncLaunch(std::vector<std::string> aExtraOpts)
bool
GeckoChildProcessHost::AsyncLaunch(std::vector<std::string> aExtraOpts)
{
#ifdef XP_WIN
InitWindowsGroupID();
#endif
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
ioLoop->PostTask(FROM_HERE,
NewRunnableMethod(this,
@ -320,7 +289,31 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts)
cmdLine.AppendLooseValue(UTF8ToWide(*it));
}
cmdLine.AppendLooseValue(std::wstring(mGroupId.get()));
// On Win7+, pass the application user model to the child, so it can
// register with it. This insures windows created by the container
// properly group with the parent app on the Win7 taskbar.
nsCOMPtr<nsIWinTaskbar> taskbarInfo =
do_GetService(NS_TASKBAR_CONTRACTID);
PRBool set = PR_FALSE;
if (taskbarInfo) {
PRBool isSupported = PR_FALSE;
taskbarInfo->GetAvailable(&isSupported);
if (isSupported) {
// Set the id for the container.
nsAutoString appId, param;
param.Append(PRUnichar('\"'));
if (NS_SUCCEEDED(taskbarInfo->GetDefaultGroupId(appId))) {
param.Append(appId);
param.Append(PRUnichar('\"'));
cmdLine.AppendLooseValue(std::wstring(param.get()));
set = PR_TRUE;
}
}
}
if (!set) {
cmdLine.AppendLooseValue(std::wstring(L"-"));
}
cmdLine.AppendLooseValue(UTF8ToWide(pidstring));
cmdLine.AppendLooseValue(UTF8ToWide(childProcessType));
#if defined(MOZ_CRASHREPORTER)

View File

@ -96,11 +96,6 @@ protected:
bool mChannelInitialized;
FilePath mProcessPath;
#ifdef XP_WIN
void InitWindowsGroupID();
nsString mGroupId;
#endif
#if defined(OS_POSIX)
base::file_handle_mapping_vector mFileMap;
#endif