OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "win8/delegate_execute/delegate_execute_util.h" | 5 #include "win8/delegate_execute/delegate_execute_util.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 | 9 |
10 namespace delegate_execute { | 10 namespace delegate_execute { |
11 | 11 |
12 CommandLine CommandLineFromParameters(const wchar_t* params) { | 12 CommandLine CommandLineFromParameters(const wchar_t* params) { |
13 CommandLine command_line(CommandLine::NO_PROGRAM); | 13 CommandLine command_line(CommandLine::NO_PROGRAM); |
14 | 14 |
15 if (params) { | 15 if (params) { |
16 string16 command_string(L"noprogram.exe "); | 16 string16 command_string(L"noprogram.exe "); |
17 command_string.append(params); | 17 command_string.append(params); |
18 command_line.ParseFromString(command_string); | 18 command_line.ParseFromString(command_string); |
19 command_line.SetProgram(FilePath()); | 19 command_line.SetProgram(base::FilePath()); |
20 } | 20 } |
21 | 21 |
22 return command_line; | 22 return command_line; |
23 } | 23 } |
24 | 24 |
25 CommandLine MakeChromeCommandLine(const FilePath& chrome_exe, | 25 CommandLine MakeChromeCommandLine(const base::FilePath& chrome_exe, |
26 const CommandLine& params, | 26 const CommandLine& params, |
27 const string16& argument) { | 27 const string16& argument) { |
28 CommandLine chrome_cmd(params); | 28 CommandLine chrome_cmd(params); |
29 chrome_cmd.SetProgram(chrome_exe); | 29 chrome_cmd.SetProgram(chrome_exe); |
30 | 30 |
31 if (!argument.empty()) | 31 if (!argument.empty()) |
32 chrome_cmd.AppendArgNative(argument); | 32 chrome_cmd.AppendArgNative(argument); |
33 | 33 |
34 return chrome_cmd; | 34 return chrome_cmd; |
35 } | 35 } |
36 | 36 |
37 string16 ParametersFromSwitch(const char* a_switch) { | 37 string16 ParametersFromSwitch(const char* a_switch) { |
38 if (!a_switch) | 38 if (!a_switch) |
39 return string16(); | 39 return string16(); |
40 | 40 |
41 CommandLine cmd_line(CommandLine::NO_PROGRAM); | 41 CommandLine cmd_line(CommandLine::NO_PROGRAM); |
42 | 42 |
43 cmd_line.AppendSwitch(a_switch); | 43 cmd_line.AppendSwitch(a_switch); |
44 | 44 |
45 string16 command_string(cmd_line.GetCommandLineString()); | 45 string16 command_string(cmd_line.GetCommandLineString()); |
46 TrimWhitespace(command_string, TRIM_ALL, &command_string); | 46 TrimWhitespace(command_string, TRIM_ALL, &command_string); |
47 return command_string; | 47 return command_string; |
48 } | 48 } |
49 | 49 |
50 } // namespace delegate_execute | 50 } // namespace delegate_execute |
OLD | NEW |