| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 delete current_process_commandline_; | 194 delete current_process_commandline_; |
| 195 current_process_commandline_ = NULL; | 195 current_process_commandline_ = NULL; |
| 196 } | 196 } |
| 197 | 197 |
| 198 // static | 198 // static |
| 199 CommandLine* CommandLine::ForCurrentProcess() { | 199 CommandLine* CommandLine::ForCurrentProcess() { |
| 200 DCHECK(current_process_commandline_); | 200 DCHECK(current_process_commandline_); |
| 201 return current_process_commandline_; | 201 return current_process_commandline_; |
| 202 } | 202 } |
| 203 | 203 |
| 204 // static |
| 205 bool CommandLine::InitializedForCurrentProcess() { |
| 206 return !!current_process_commandline_; |
| 207 } |
| 208 |
| 204 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
| 205 // static | 210 // static |
| 206 CommandLine CommandLine::FromString(const std::wstring& command_line) { | 211 CommandLine CommandLine::FromString(const std::wstring& command_line) { |
| 207 CommandLine cmd(NO_PROGRAM); | 212 CommandLine cmd(NO_PROGRAM); |
| 208 cmd.ParseFromString(command_line); | 213 cmd.ParseFromString(command_line); |
| 209 return cmd; | 214 return cmd; |
| 210 } | 215 } |
| 211 #endif | 216 #endif |
| 212 | 217 |
| 213 void CommandLine::InitFromArgv(int argc, | 218 void CommandLine::InitFromArgv(int argc, |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 int num_args = 0; | 415 int num_args = 0; |
| 411 wchar_t** args = NULL; | 416 wchar_t** args = NULL; |
| 412 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); | 417 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); |
| 413 | 418 |
| 414 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " | 419 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " |
| 415 << command_line; | 420 << command_line; |
| 416 InitFromArgv(num_args, args); | 421 InitFromArgv(num_args, args); |
| 417 LocalFree(args); | 422 LocalFree(args); |
| 418 } | 423 } |
| 419 #endif | 424 #endif |
| OLD | NEW |