Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / win8 / delegate_execute / delegate_execute_util.cc
blob87a5fb66b8971e79573abd6234a43f1ea650b6ec
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "win8/delegate_execute/delegate_execute_util.h"
7 #include "base/files/file_path.h"
8 #include "base/strings/string_util.h"
10 namespace delegate_execute {
12 base::CommandLine CommandLineFromParameters(const wchar_t* params) {
13 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
15 if (params) {
16 base::string16 command_string(L"noprogram.exe ");
17 command_string.append(params);
18 command_line.ParseFromString(command_string);
19 command_line.SetProgram(base::FilePath());
22 return command_line;
25 base::CommandLine MakeChromeCommandLine(const base::FilePath& chrome_exe,
26 const base::CommandLine& params,
27 const base::string16& argument) {
28 base::CommandLine chrome_cmd(params);
29 chrome_cmd.SetProgram(chrome_exe);
31 if (!argument.empty())
32 chrome_cmd.AppendArgNative(argument);
34 return chrome_cmd;
37 base::string16 ParametersFromSwitch(const char* a_switch) {
38 if (!a_switch)
39 return base::string16();
41 base::CommandLine cmd_line(base::CommandLine::NO_PROGRAM);
43 cmd_line.AppendSwitch(a_switch);
45 base::string16 command_string(cmd_line.GetCommandLineString());
46 base::TrimWhitespace(command_string, base::TRIM_ALL, &command_string);
47 return command_string;
50 } // namespace delegate_execute