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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 | 260 |
261 void CommandLine::SetProgram(const FilePath& program) { | 261 void CommandLine::SetProgram(const FilePath& program) { |
262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]); | 262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]); |
263 } | 263 } |
264 | 264 |
265 bool CommandLine::HasSwitch(const std::string& switch_string) const { | 265 bool CommandLine::HasSwitch(const std::string& switch_string) const { |
266 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end(); | 266 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end(); |
267 } | 267 } |
268 | 268 |
| 269 bool CommandLine::HasSwitch(const char string_constant[]) const { |
| 270 return HasSwitch(std::string(string_constant)); |
| 271 } |
| 272 |
269 std::string CommandLine::GetSwitchValueASCII( | 273 std::string CommandLine::GetSwitchValueASCII( |
270 const std::string& switch_string) const { | 274 const std::string& switch_string) const { |
271 StringType value = GetSwitchValueNative(switch_string); | 275 StringType value = GetSwitchValueNative(switch_string); |
272 if (!IsStringASCII(value)) { | 276 if (!IsStringASCII(value)) { |
273 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII."; | 277 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII."; |
274 return std::string(); | 278 return std::string(); |
275 } | 279 } |
276 #if defined(OS_WIN) | 280 #if defined(OS_WIN) |
277 return UTF16ToASCII(value); | 281 return UTF16ToASCII(value); |
278 #else | 282 #else |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 #if defined(OS_WIN) | 446 #if defined(OS_WIN) |
443 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders); | 447 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders); |
444 #endif | 448 #endif |
445 params.append(arg); | 449 params.append(arg); |
446 } | 450 } |
447 } | 451 } |
448 return params; | 452 return params; |
449 } | 453 } |
450 | 454 |
451 } // namespace base | 455 } // namespace base |
OLD | NEW |