OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif | 10 #endif |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 #endif | 162 #endif |
163 | 163 |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 return false; | 167 return false; |
168 } | 168 } |
169 | 169 |
170 // static | 170 // static |
171 void CommandLine::Init(int argc, const char* const* argv) { | 171 void CommandLine::Init(int argc, const char* const* argv) { |
172 DCHECK(current_process_commandline_ == NULL); | |
173 #if defined(OS_WIN) | 172 #if defined(OS_WIN) |
174 current_process_commandline_ = new CommandLine; | 173 current_process_commandline_ = new CommandLine; |
175 current_process_commandline_->ParseFromString(::GetCommandLineW()); | 174 current_process_commandline_->ParseFromString(::GetCommandLineW()); |
176 #elif defined(OS_POSIX) | 175 #elif defined(OS_POSIX) |
177 current_process_commandline_ = new CommandLine(argc, argv); | 176 current_process_commandline_ = new CommandLine(argc, argv); |
178 #endif | 177 #endif |
179 } | 178 } |
180 | 179 |
181 void CommandLine::Terminate() { | 180 void CommandLine::Terminate() { |
182 DCHECK(current_process_commandline_ != NULL); | 181 DCHECK(current_process_commandline_ != NULL); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { | 352 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { |
354 // The wrapper may have embedded arguments (like "gdb --args"). In this case, | 353 // The wrapper may have embedded arguments (like "gdb --args"). In this case, |
355 // we don't pretend to do anything fancy, we just split on spaces. | 354 // we don't pretend to do anything fancy, we just split on spaces. |
356 const std::string wrapper = WideToASCII(wrapper_wide); | 355 const std::string wrapper = WideToASCII(wrapper_wide); |
357 std::vector<std::string> wrapper_and_args; | 356 std::vector<std::string> wrapper_and_args; |
358 SplitString(wrapper, ' ', &wrapper_and_args); | 357 SplitString(wrapper, ' ', &wrapper_and_args); |
359 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); | 358 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); |
360 } | 359 } |
361 | 360 |
362 #endif | 361 #endif |
OLD | NEW |