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

Side by Side Diff: base/command_line.cc

Issue 1274123003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no media changes Created 5 years, 4 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 | « ash/test/display_manager_test_api.cc ('k') | base/debug/proc_maps_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) 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 if (include_program) 387 if (include_program)
388 SetProgram(other.GetProgram()); 388 SetProgram(other.GetProgram());
389 AppendSwitchesAndArguments(this, other.argv()); 389 AppendSwitchesAndArguments(this, other.argv());
390 } 390 }
391 391
392 void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) { 392 void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) {
393 if (wrapper.empty()) 393 if (wrapper.empty())
394 return; 394 return;
395 // The wrapper may have embedded arguments (like "gdb --args"). In this case, 395 // The wrapper may have embedded arguments (like "gdb --args"). In this case,
396 // we don't pretend to do anything fancy, we just split on spaces. 396 // we don't pretend to do anything fancy, we just split on spaces.
397 StringVector wrapper_argv; 397 StringVector wrapper_argv = SplitString(
398 SplitString(wrapper, FILE_PATH_LITERAL(' '), &wrapper_argv); 398 wrapper, FilePath::StringType(1, ' '), base::TRIM_WHITESPACE,
399 base::SPLIT_WANT_ALL);
399 // Prepend the wrapper and update the switches/arguments |begin_args_|. 400 // Prepend the wrapper and update the switches/arguments |begin_args_|.
400 argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end()); 401 argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end());
401 begin_args_ += wrapper_argv.size(); 402 begin_args_ += wrapper_argv.size();
402 } 403 }
403 404
404 #if defined(OS_WIN) 405 #if defined(OS_WIN)
405 void CommandLine::ParseFromString(const string16& command_line) { 406 void CommandLine::ParseFromString(const string16& command_line) {
406 string16 command_line_string; 407 string16 command_line_string;
407 TrimWhitespace(command_line, TRIM_ALL, &command_line_string); 408 TrimWhitespace(command_line, TRIM_ALL, &command_line_string);
408 if (command_line_string.empty()) 409 if (command_line_string.empty())
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 return params; 465 return params;
465 } 466 }
466 467
467 void CommandLine::ResetStringPieces() { 468 void CommandLine::ResetStringPieces() {
468 switches_by_stringpiece_.clear(); 469 switches_by_stringpiece_.clear();
469 for (const auto& entry : switches_) 470 for (const auto& entry : switches_)
470 switches_by_stringpiece_[entry.first] = &(entry.second); 471 switches_by_stringpiece_[entry.first] = &(entry.second);
471 } 472 }
472 473
473 } // namespace base 474 } // namespace base
OLDNEW
« no previous file with comments | « ash/test/display_manager_test_api.cc ('k') | base/debug/proc_maps_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698