Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: base/command_line.cc

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « app/text_elider.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) 442 for (i = other.switches_.begin(); i != other.switches_.end(); ++i)
443 switches_[i->first] = i->second; 443 switches_[i->first] = i->second;
444 } 444 }
445 445
446 void CommandLine::PrependWrapper(const std::wstring& wrapper) { 446 void CommandLine::PrependWrapper(const std::wstring& wrapper) {
447 if (wrapper.empty()) 447 if (wrapper.empty())
448 return; 448 return;
449 // The wrapper may have embedded arguments (like "gdb --args"). In this case, 449 // The wrapper may have embedded arguments (like "gdb --args"). In this case,
450 // we don't pretend to do anything fancy, we just split on spaces. 450 // we don't pretend to do anything fancy, we just split on spaces.
451 std::vector<std::wstring> wrapper_and_args; 451 std::vector<std::wstring> wrapper_and_args;
452 SplitString(wrapper, ' ', &wrapper_and_args); 452 base::SplitString(wrapper, ' ', &wrapper_and_args);
453 program_ = wrapper_and_args[0]; 453 program_ = wrapper_and_args[0];
454 command_line_string_ = wrapper + L" " + command_line_string_; 454 command_line_string_ = wrapper + L" " + command_line_string_;
455 } 455 }
456 456
457 #elif defined(OS_POSIX) 457 #elif defined(OS_POSIX)
458 void CommandLine::AppendSwitch(const std::string& switch_string) { 458 void CommandLine::AppendSwitch(const std::string& switch_string) {
459 argv_.push_back(kSwitchPrefixes[0] + switch_string); 459 argv_.push_back(kSwitchPrefixes[0] + switch_string);
460 switches_[switch_string] = ""; 460 switches_[switch_string] = "";
461 } 461 }
462 462
(...skipping 30 matching lines...) Expand all
493 argv_.push_back(other.argv_[i]); 493 argv_.push_back(other.argv_[i]);
494 std::map<std::string, StringType>::const_iterator i; 494 std::map<std::string, StringType>::const_iterator i;
495 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) 495 for (i = other.switches_.begin(); i != other.switches_.end(); ++i)
496 switches_[i->first] = i->second; 496 switches_[i->first] = i->second;
497 } 497 }
498 498
499 void CommandLine::PrependWrapper(const std::string& wrapper) { 499 void CommandLine::PrependWrapper(const std::string& wrapper) {
500 // The wrapper may have embedded arguments (like "gdb --args"). In this case, 500 // The wrapper may have embedded arguments (like "gdb --args"). In this case,
501 // we don't pretend to do anything fancy, we just split on spaces. 501 // we don't pretend to do anything fancy, we just split on spaces.
502 std::vector<std::string> wrapper_and_args; 502 std::vector<std::string> wrapper_and_args;
503 SplitString(wrapper, ' ', &wrapper_and_args); 503 base::SplitString(wrapper, ' ', &wrapper_and_args);
504 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); 504 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end());
505 } 505 }
506 506
507 #endif 507 #endif
508 508
509 void CommandLine::AppendArgPath(const FilePath& path) { 509 void CommandLine::AppendArgPath(const FilePath& path) {
510 AppendArgNative(path.value()); 510 AppendArgNative(path.value());
511 } 511 }
512 512
513 void CommandLine::AppendSwitchPath(const std::string& switch_string, 513 void CommandLine::AppendSwitchPath(const std::string& switch_string,
(...skipping 14 matching lines...) Expand all
528 528
529 // private 529 // private
530 CommandLine::CommandLine() { 530 CommandLine::CommandLine() {
531 } 531 }
532 532
533 // static 533 // static
534 CommandLine* CommandLine::ForCurrentProcessMutable() { 534 CommandLine* CommandLine::ForCurrentProcessMutable() {
535 DCHECK(current_process_commandline_); 535 DCHECK(current_process_commandline_);
536 return current_process_commandline_; 536 return current_process_commandline_;
537 } 537 }
OLDNEW
« no previous file with comments | « app/text_elider.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698