| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 static void Lowercase(std::string* parameter) { | 53 static void Lowercase(std::string* parameter) { |
| 54 transform(parameter->begin(), parameter->end(), parameter->begin(), | 54 transform(parameter->begin(), parameter->end(), parameter->begin(), |
| 55 tolower); | 55 tolower); |
| 56 } | 56 } |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 CommandLine::~CommandLine() { | 59 CommandLine::~CommandLine() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 63 CommandLine::CommandLine(ArgumentsOnly args_only) { | 63 CommandLine::CommandLine(NoProgram no_program) { |
| 64 } | 64 } |
| 65 | 65 |
| 66 void CommandLine::ParseFromString(const std::wstring& command_line) { | 66 void CommandLine::ParseFromString(const std::wstring& command_line) { |
| 67 TrimWhitespace(command_line, TRIM_ALL, &command_line_string_); | 67 TrimWhitespace(command_line, TRIM_ALL, &command_line_string_); |
| 68 | 68 |
| 69 if (command_line_string_.empty()) | 69 if (command_line_string_.empty()) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 int num_args = 0; | 72 int num_args = 0; |
| 73 wchar_t** args = NULL; | 73 wchar_t** args = NULL; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 CommandLine::CommandLine(const FilePath& program) { | 115 CommandLine::CommandLine(const FilePath& program) { |
| 116 if (!program.empty()) { | 116 if (!program.empty()) { |
| 117 program_ = program.value(); | 117 program_ = program.value(); |
| 118 // TODO(evanm): proper quoting here. | 118 // TODO(evanm): proper quoting here. |
| 119 command_line_string_ = L'"' + program.value() + L'"'; | 119 command_line_string_ = L'"' + program.value() + L'"'; |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 #elif defined(OS_POSIX) | 123 #elif defined(OS_POSIX) |
| 124 CommandLine::CommandLine(ArgumentsOnly args_only) { | 124 CommandLine::CommandLine(NoProgram no_program) { |
| 125 // Push an empty argument, because we always assume argv_[0] is a program. | 125 // Push an empty argument, because we always assume argv_[0] is a program. |
| 126 argv_.push_back(""); | 126 argv_.push_back(""); |
| 127 } | 127 } |
| 128 | 128 |
| 129 CommandLine::CommandLine(int argc, const char* const* argv) { | 129 CommandLine::CommandLine(int argc, const char* const* argv) { |
| 130 InitFromArgv(argc, argv); | 130 InitFromArgv(argc, argv); |
| 131 } | 131 } |
| 132 | 132 |
| 133 CommandLine::CommandLine(const std::vector<std::string>& argv) { | 133 CommandLine::CommandLine(const std::vector<std::string>& argv) { |
| 134 InitFromArgv(argv); | 134 InitFromArgv(argv); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 // private | 523 // private |
| 524 CommandLine::CommandLine() { | 524 CommandLine::CommandLine() { |
| 525 } | 525 } |
| 526 | 526 |
| 527 // static | 527 // static |
| 528 CommandLine* CommandLine::ForCurrentProcessMutable() { | 528 CommandLine* CommandLine::ForCurrentProcessMutable() { |
| 529 DCHECK(current_process_commandline_); | 529 DCHECK(current_process_commandline_); |
| 530 return current_process_commandline_; | 530 return current_process_commandline_; |
| 531 } | 531 } |
| OLD | NEW |