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

Unified Diff: win8/delegate_execute/command_execute_impl.cc

Issue 10962023: Prefix Chrome switches with the switch prefix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/command_execute_impl.cc
diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc
index 943a6d6998f8cb34907743b477e0835dd55d9487..d82ccb43f93def0642d8f499db2c20a61cc043b9 100644
--- a/win8/delegate_execute/command_execute_impl.cc
+++ b/win8/delegate_execute/command_execute_impl.cc
@@ -13,11 +13,13 @@
#include "base/win/registry.h"
#include "base/win/scoped_co_mem.h"
#include "base/win/scoped_handle.h"
+#include "base/win/scoped_process_information.h"
#include "base/win/win_util.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "win8/delegate_execute/chrome_util.h"
+#include "win8/delegate_execute/delegate_execute_util.h"
// CommandExecuteImpl is resposible for activating chrome in Windows 8. The
// flow is complicated and this tries to highlight the important events.
@@ -75,8 +77,9 @@
// a slow way to start chrome.
//
CommandExecuteImpl::CommandExecuteImpl()
- : integrity_level_(base::INTEGRITY_UNKNOWN),
+ : parameters_(CommandLine::NO_PROGRAM),
launch_scheme_(INTERNET_SCHEME_DEFAULT),
+ integrity_level_(base::INTEGRITY_UNKNOWN),
chrome_mode_(ECHUIM_SYSTEM_LAUNCHER) {
memset(&start_info_, 0, sizeof(start_info_));
start_info_.cb = sizeof(start_info_);
@@ -93,9 +96,7 @@ STDMETHODIMP CommandExecuteImpl::SetKeyState(DWORD key_state) {
STDMETHODIMP CommandExecuteImpl::SetParameters(LPCWSTR params) {
AtlTrace("In %hs [%S]\n", __FUNCTION__, params);
- if (params) {
- parameters_ = params;
- }
+ parameters_ = delegate_execute::CommandLineFromParameters(params);
return S_OK;
}
@@ -350,32 +351,21 @@ HRESULT CommandExecuteImpl::LaunchDesktopChrome() {
break;
}
- string16 command_line = L"\"";
- command_line += chrome_exe_.value();
- command_line += L"\"";
-
- if (!parameters_.empty()) {
- AtlTrace("Adding parameters %ls to command line\n", parameters_.c_str());
- command_line += L" ";
- command_line += parameters_.c_str();
- }
-
- if (!display_name.empty()) {
- command_line += L" -- ";
- command_line += display_name;
- }
+ CommandLine chrome(
+ delegate_execute::MakeChromeCommandLine(chrome_exe_, parameters_,
+ display_name));
+ string16 command_line(chrome.GetCommandLineString());
AtlTrace("Formatted command line is %ls\n", command_line.c_str());
- PROCESS_INFORMATION proc_info = {0};
- BOOL ret = CreateProcess(NULL, const_cast<LPWSTR>(command_line.c_str()),
+ base::win::ScopedProcessInformation proc_info;
+ BOOL ret = CreateProcess(chrome_exe_.value().c_str(),
+ const_cast<LPWSTR>(command_line.c_str()),
NULL, NULL, FALSE, 0, NULL, NULL, &start_info_,
- &proc_info);
+ proc_info.Receive());
if (ret) {
- AtlTrace("Process id is %d\n", proc_info.dwProcessId);
- AllowSetForegroundWindow(proc_info.dwProcessId);
- CloseHandle(proc_info.hProcess);
- CloseHandle(proc_info.hThread);
+ AtlTrace("Process id is %d\n", proc_info.process_id());
+ AllowSetForegroundWindow(proc_info.process_id());
} else {
AtlTrace("Process launch failed, error %d\n", ::GetLastError());
}
@@ -400,14 +390,14 @@ EC_HOST_UI_MODE CommandExecuteImpl::GetLaunchMode() {
return launch_mode;
}
- if (parameters_ == ASCIIToWide(switches::kForceImmersive)) {
+ if (parameters_.HasSwitch(switches::kForceImmersive)) {
launch_mode = ECHUIM_IMMERSIVE;
launch_mode_determined = true;
- parameters_.clear();
- } else if (parameters_ == ASCIIToWide(switches::kForceDesktop)) {
+ parameters_ = CommandLine(CommandLine::NO_PROGRAM);
+ } else if (parameters_.HasSwitch(switches::kForceDesktop)) {
launch_mode = ECHUIM_DESKTOP;
launch_mode_determined = true;
- parameters_.clear();
+ parameters_ = CommandLine(CommandLine::NO_PROGRAM);
}
base::win::RegKey reg_key;

Powered by Google App Engine
This is Rietveld 408576698