Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Unified Diff: win8/delegate_execute/delegate_execute.cc

Issue 498573003: Add relaunch into ASH and desktop support for Chrome on Windows 7. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed build error Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: win8/delegate_execute/delegate_execute.cc
diff --git a/win8/delegate_execute/delegate_execute.cc b/win8/delegate_execute/delegate_execute.cc
index 3bd1ef151b2498adedff7c32ba561b7085efcb93..1da43e5e7812762a48cbbb04e748f0b8203ffbc1 100644
--- a/win8/delegate_execute/delegate_execute.cc
+++ b/win8/delegate_execute/delegate_execute.cc
@@ -17,6 +17,7 @@
#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_comptr.h"
#include "base/win/scoped_handle.h"
+#include "base/win/windows_version.h"
#include "breakpad/src/client/windows/handler/exception_handler.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/installer/util/browser_distribution.h"
@@ -117,21 +118,53 @@ int RelaunchChrome(const DelegateExecuteOperation& operation) {
AtlTrace("No relaunch mutex found\n");
}
cpu_(ooo_6.6-7.5) 2014/08/22 21:47:11 lets add a comment here about why we launch the wi
ananta 2014/08/22 22:17:53 Done.
- base::win::ScopedCOMInitializer com_initializer;
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
+ base::win::ScopedCOMInitializer com_initializer;
- base::string16 relaunch_flags(operation.relaunch_flags());
- SHELLEXECUTEINFO sei = { sizeof(sei) };
- sei.fMask = SEE_MASK_FLAG_LOG_USAGE;
- sei.nShow = SW_SHOWNORMAL;
- sei.lpFile = operation.shortcut().value().c_str();
- sei.lpParameters = relaunch_flags.c_str();
+ base::string16 relaunch_flags(operation.relaunch_flags());
+ SHELLEXECUTEINFO sei = { sizeof(sei) };
+ sei.fMask = SEE_MASK_FLAG_LOG_USAGE;
+ sei.nShow = SW_SHOWNORMAL;
+ sei.lpFile = operation.shortcut().value().c_str();
+ sei.lpParameters = relaunch_flags.c_str();
- AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile);
+ AtlTrace(L"Relaunching Chrome via shortcut [%ls]\n", sei.lpFile);
- if (!::ShellExecuteExW(&sei)) {
- int error = HRESULT_FROM_WIN32(::GetLastError());
- AtlTrace("ShellExecute returned 0x%08X\n", error);
- return error;
+ if (!::ShellExecuteExW(&sei)) {
+ int error = HRESULT_FROM_WIN32(::GetLastError());
+ AtlTrace("ShellExecute returned 0x%08X\n", error);
+ return error;
+ }
+ } else {
+ base::FilePath chrome_exe_path;
+ bool found_exe = CommandExecuteImpl::FindChromeExe(&chrome_exe_path);
+ DCHECK(found_exe);
+ if (found_exe) {
+ bool launch_ash = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceImmersive);
+ if (launch_ash) {
+ AtlTrace(L"Relaunching Chrome into Windows ASH on Windows 7\n");
+ } else {
+ AtlTrace(L"Relaunching Chrome into Desktop From ASH on Windows 7\n");
+ }
+ SHELLEXECUTEINFO sei = { sizeof(sei) };
+ sei.fMask = SEE_MASK_FLAG_LOG_USAGE;
+ sei.nShow = SW_SHOWNORMAL;
+ // No point in using the shortcut if we are launching into ASH as any
+ // additonal command line switches specified in the shortcut will be
+ // ignored. This is because we don't have a good way to send the command
+ // line switches from the viewer to the browser process.
+ sei.lpFile = (launch_ash || operation.shortcut().empty()) ?
+ chrome_exe_path.value().c_str() :
+ operation.shortcut().value().c_str();
+ sei.lpParameters =
+ launch_ash ? L"-ServerName:DefaultBrowserServer" : NULL;
+ if (!::ShellExecuteExW(&sei)) {
+ int error = HRESULT_FROM_WIN32(::GetLastError());
+ AtlTrace("ShellExecute returned 0x%08X\n", error);
+ return error;
+ }
+ }
}
return S_OK;
}

Powered by Google App Engine
This is Rietveld 408576698