OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome_frame/chrome_launcher.h" | 5 #include "chrome_frame/chrome_launcher.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (num_sanitized_switches != original.GetSwitchCount()) { | 73 if (num_sanitized_switches != original.GetSwitchCount()) { |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 LOG(ERROR) << "Original command line from Low Integrity had switches " | 75 LOG(ERROR) << "Original command line from Low Integrity had switches " |
76 << "that are not on our whitelist."; | 76 << "that are not on our whitelist."; |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 bool SanitizeAndLaunchChrome(const wchar_t* command_line) { | 80 bool SanitizeAndLaunchChrome(const wchar_t* command_line) { |
81 std::wstring command_line_with_program(L"dummy.exe "); | 81 std::wstring command_line_with_program(L"dummy.exe "); |
82 command_line_with_program += command_line; | 82 command_line_with_program += command_line; |
83 CommandLine original(L""); | 83 CommandLine original = CommandLine::FromString(command_line_with_program); |
84 original.ParseFromString(command_line_with_program); | |
85 CommandLine sanitized(GetChromeExecutablePath()); | 84 CommandLine sanitized(GetChromeExecutablePath()); |
86 SanitizeCommandLine(original, &sanitized); | 85 SanitizeCommandLine(original, &sanitized); |
87 | 86 |
88 return base::LaunchApp(sanitized.command_line_string(), false, false, NULL); | 87 return base::LaunchApp(sanitized.command_line_string(), false, false, NULL); |
89 } | 88 } |
90 | 89 |
91 FilePath GetChromeExecutablePath() { | 90 FilePath GetChromeExecutablePath() { |
92 FilePath cur_path; | 91 FilePath cur_path; |
93 PathService::Get(base::DIR_MODULE, &cur_path); | 92 PathService::Get(base::DIR_MODULE, &cur_path); |
94 cur_path = cur_path.Append(chrome::kBrowserProcessExecutableName); | 93 cur_path = cur_path.Append(chrome::kBrowserProcessExecutableName); |
(...skipping 20 matching lines...) Expand all Loading... |
115 return ERROR_OPEN_FAILED; | 114 return ERROR_OPEN_FAILED; |
116 } | 115 } |
117 } | 116 } |
118 | 117 |
119 // Compile-time check to see that the type CfLaunchChromeProc is correct. | 118 // Compile-time check to see that the type CfLaunchChromeProc is correct. |
120 #ifndef NODEBUG | 119 #ifndef NODEBUG |
121 namespace { | 120 namespace { |
122 chrome_launcher::CfLaunchChromeProc cf_launch_chrome = CfLaunchChrome; | 121 chrome_launcher::CfLaunchChromeProc cf_launch_chrome = CfLaunchChrome; |
123 } // namespace | 122 } // namespace |
124 #endif // NODEBUG | 123 #endif // NODEBUG |
OLD | NEW |