| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 setproctitle(have_argv0 ? "-%s" : "%s", title.c_str()); | 266 setproctitle(have_argv0 ? "-%s" : "%s", title.c_str()); |
| 267 } | 267 } |
| 268 #endif | 268 #endif |
| 269 | 269 |
| 270 void CommandLine::Reset() { | 270 void CommandLine::Reset() { |
| 271 DCHECK(current_process_commandline_ != NULL); | 271 DCHECK(current_process_commandline_ != NULL); |
| 272 delete current_process_commandline_; | 272 delete current_process_commandline_; |
| 273 current_process_commandline_ = NULL; | 273 current_process_commandline_ = NULL; |
| 274 } | 274 } |
| 275 | 275 |
| 276 // static |
| 277 CommandLine* CommandLine::ForCurrentProcess() { |
| 278 DCHECK(current_process_commandline_); |
| 279 return current_process_commandline_; |
| 280 } |
| 281 |
| 276 bool CommandLine::HasSwitch(const std::string& switch_string) const { | 282 bool CommandLine::HasSwitch(const std::string& switch_string) const { |
| 277 std::string lowercased_switch(switch_string); | 283 std::string lowercased_switch(switch_string); |
| 278 #if defined(OS_WIN) | 284 #if defined(OS_WIN) |
| 279 Lowercase(&lowercased_switch); | 285 Lowercase(&lowercased_switch); |
| 280 #endif | 286 #endif |
| 281 return switches_.find(lowercased_switch) != switches_.end(); | 287 return switches_.find(lowercased_switch) != switches_.end(); |
| 282 } | 288 } |
| 283 | 289 |
| 284 #if defined(OS_WIN) | 290 #if defined(OS_WIN) |
| 285 // Deprecated; still temporarily available on Windows. | 291 // Deprecated; still temporarily available on Windows. |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 if (source.HasSwitch(switches[i])) { | 529 if (source.HasSwitch(switches[i])) { |
| 524 StringType value = source.GetSwitchValueNative(switches[i]); | 530 StringType value = source.GetSwitchValueNative(switches[i]); |
| 525 AppendSwitchNative(switches[i], value); | 531 AppendSwitchNative(switches[i], value); |
| 526 } | 532 } |
| 527 } | 533 } |
| 528 } | 534 } |
| 529 | 535 |
| 530 // private | 536 // private |
| 531 CommandLine::CommandLine() { | 537 CommandLine::CommandLine() { |
| 532 } | 538 } |
| 539 |
| 540 // static |
| 541 CommandLine* CommandLine::ForCurrentProcessMutable() { |
| 542 DCHECK(current_process_commandline_); |
| 543 return current_process_commandline_; |
| 544 } |
| OLD | NEW |