| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #elif defined(OS_POSIX) | 10 #elif defined(OS_POSIX) |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 for (size_t i = 0; i < loose_values_.size(); ++i) | 296 for (size_t i = 0; i < loose_values_.size(); ++i) |
| 297 values.push_back(base::SysNativeMBToWide(loose_values_[i])); | 297 values.push_back(base::SysNativeMBToWide(loose_values_[i])); |
| 298 return values; | 298 return values; |
| 299 } | 299 } |
| 300 std::wstring CommandLine::program() const { | 300 std::wstring CommandLine::program() const { |
| 301 DCHECK_GT(argv_.size(), 0U); | 301 DCHECK_GT(argv_.size(), 0U); |
| 302 return base::SysNativeMBToWide(argv_[0]); | 302 return base::SysNativeMBToWide(argv_[0]); |
| 303 } | 303 } |
| 304 #endif | 304 #endif |
| 305 | 305 |
| 306 #if defined(OS_POSIX) |
| 307 std::string CommandLine::command_line_string() const { |
| 308 return JoinString(argv_, ' '); |
| 309 } |
| 310 #endif |
| 306 | 311 |
| 307 // static | 312 // static |
| 308 std::wstring CommandLine::PrefixedSwitchString( | 313 std::wstring CommandLine::PrefixedSwitchString( |
| 309 const std::string& switch_string) { | 314 const std::string& switch_string) { |
| 310 #if defined(OS_WIN) | 315 #if defined(OS_WIN) |
| 311 return kSwitchPrefixes[0] + ASCIIToWide(switch_string); | 316 return kSwitchPrefixes[0] + ASCIIToWide(switch_string); |
| 312 #else | 317 #else |
| 313 return ASCIIToWide(kSwitchPrefixes[0] + switch_string); | 318 return ASCIIToWide(kSwitchPrefixes[0] + switch_string); |
| 314 #endif | 319 #endif |
| 315 } | 320 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { | 430 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { |
| 426 // The wrapper may have embedded arguments (like "gdb --args"). In this case, | 431 // The wrapper may have embedded arguments (like "gdb --args"). In this case, |
| 427 // we don't pretend to do anything fancy, we just split on spaces. | 432 // we don't pretend to do anything fancy, we just split on spaces. |
| 428 const std::string wrapper = base::SysWideToNativeMB(wrapper_wide); | 433 const std::string wrapper = base::SysWideToNativeMB(wrapper_wide); |
| 429 std::vector<std::string> wrapper_and_args; | 434 std::vector<std::string> wrapper_and_args; |
| 430 SplitString(wrapper, ' ', &wrapper_and_args); | 435 SplitString(wrapper, ' ', &wrapper_and_args); |
| 431 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); | 436 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); |
| 432 } | 437 } |
| 433 | 438 |
| 434 #endif | 439 #endif |
| OLD | NEW |