| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 | 262 |
| 263 bool CommandLine::HasSwitch(const std::string& switch_string) const { | 263 bool CommandLine::HasSwitch(const std::string& switch_string) const { |
| 264 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end(); | 264 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 std::string CommandLine::GetSwitchValueASCII( | 267 std::string CommandLine::GetSwitchValueASCII( |
| 268 const std::string& switch_string) const { | 268 const std::string& switch_string) const { |
| 269 StringType value = GetSwitchValueNative(switch_string); | 269 StringType value = GetSwitchValueNative(switch_string); |
| 270 if (!IsStringASCII(value)) { | 270 if (!IsStringASCII(value)) { |
| 271 LOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII."; | 271 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII."; |
| 272 return ""; | 272 return std::string(); |
| 273 } | 273 } |
| 274 #if defined(OS_WIN) | 274 #if defined(OS_WIN) |
| 275 return WideToASCII(value); | 275 return WideToASCII(value); |
| 276 #else | 276 #else |
| 277 return value; | 277 return value; |
| 278 #endif | 278 #endif |
| 279 } | 279 } |
| 280 | 280 |
| 281 FilePath CommandLine::GetSwitchValuePath( | 281 FilePath CommandLine::GetSwitchValuePath( |
| 282 const std::string& switch_string) const { | 282 const std::string& switch_string) const { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 void CommandLine::ParseFromString(const std::wstring& command_line) { | 387 void CommandLine::ParseFromString(const std::wstring& command_line) { |
| 388 std::wstring command_line_string; | 388 std::wstring command_line_string; |
| 389 TrimWhitespace(command_line, TRIM_ALL, &command_line_string); | 389 TrimWhitespace(command_line, TRIM_ALL, &command_line_string); |
| 390 if (command_line_string.empty()) | 390 if (command_line_string.empty()) |
| 391 return; | 391 return; |
| 392 | 392 |
| 393 int num_args = 0; | 393 int num_args = 0; |
| 394 wchar_t** args = NULL; | 394 wchar_t** args = NULL; |
| 395 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); | 395 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); |
| 396 | 396 |
| 397 PLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " << | 397 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " |
| 398 command_line; | 398 << command_line; |
| 399 InitFromArgv(num_args, args); | 399 InitFromArgv(num_args, args); |
| 400 LocalFree(args); | 400 LocalFree(args); |
| 401 } | 401 } |
| 402 #endif | 402 #endif |
| OLD | NEW |