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

Unified Diff: base/command_line.cc

Issue 3138001: CommandLine: remove PrefixedSwitchString(). (Closed)
Patch Set: works Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/command_line.h ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/command_line.cc
diff --git a/base/command_line.cc b/base/command_line.cc
index 835ad9d93e56338cad3d61876cdd98ace28d1610..9b5824e629aca2cc4b872ca79fcf4a3552d73580 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -352,37 +352,10 @@ std::string CommandLine::command_line_string() const {
}
#endif
-// static
-std::wstring CommandLine::PrefixedSwitchString(
- const std::string& switch_string) {
-#if defined(OS_WIN)
- return kSwitchPrefixes[0] + ASCIIToWide(switch_string);
-#else
- return ASCIIToWide(kSwitchPrefixes[0] + switch_string);
-#endif
-}
-
-// static
-std::wstring CommandLine::PrefixedSwitchStringWithValue(
- const std::string& switch_string, const std::wstring& value_string) {
- if (value_string.empty()) {
- return PrefixedSwitchString(switch_string);
- }
-
- return PrefixedSwitchString(switch_string +
-#if defined(OS_WIN)
- WideToASCII(kSwitchValueSeparator)
-#else
- kSwitchValueSeparator
-#endif
- ) + value_string;
-}
-
#if defined(OS_WIN)
void CommandLine::AppendSwitch(const std::string& switch_string) {
- std::wstring prefixed_switch_string = PrefixedSwitchString(switch_string);
command_line_string_.append(L" ");
- command_line_string_.append(prefixed_switch_string);
+ command_line_string_.append(kSwitchPrefixes[0] + ASCIIToWide(switch_string));
switches_[switch_string] = L"";
}
@@ -408,7 +381,9 @@ void CommandLine::AppendSwitchNative(const std::string& switch_string,
}
std::wstring combined_switch_string =
- PrefixedSwitchStringWithValue(switch_string, value_string_edit);
+ kSwitchPrefixes[0] + ASCIIToWide(switch_string);
+ if (!value_string_edit.empty())
+ combined_switch_string += kSwitchValueSeparator + value_string_edit;
command_line_string_.append(L" ");
command_line_string_.append(combined_switch_string);
@@ -453,8 +428,10 @@ void CommandLine::AppendSwitch(const std::string& switch_string) {
void CommandLine::AppendSwitchNative(const std::string& switch_string,
const std::string& value) {
- argv_.push_back(kSwitchPrefixes[0] + switch_string +
- kSwitchValueSeparator + value);
+ std::string combined_switch_string = kSwitchPrefixes[0] + switch_string;
+ if (!value.empty())
+ combined_switch_string += kSwitchValueSeparator + value;
+ argv_.push_back(combined_switch_string);
switches_[switch_string] = value;
}
« no previous file with comments | « base/command_line.h ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698