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

Side by Side Diff: base/command_line.cc

Issue 1046363002: Enforce lowercase switches when calling CommandLine::HasSwitch(const char*). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test on Linux. Created 5 years, 8 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 | « base/command_line.h ('k') | base/command_line_unittest.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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 FilePath CommandLine::GetProgram() const { 257 FilePath CommandLine::GetProgram() const {
258 return FilePath(argv_[0]); 258 return FilePath(argv_[0]);
259 } 259 }
260 260
261 void CommandLine::SetProgram(const FilePath& program) { 261 void CommandLine::SetProgram(const FilePath& program) {
262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]); 262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]);
263 } 263 }
264 264
265 bool CommandLine::HasSwitch(const std::string& switch_string) const { 265 bool CommandLine::HasSwitch(const std::string& switch_string) const {
266 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end(); 266 DCHECK_EQ(StringToLowerASCII(switch_string), switch_string);
267 return switches_.find(switch_string) != switches_.end();
267 } 268 }
268 269
269 bool CommandLine::HasSwitch(const char string_constant[]) const { 270 bool CommandLine::HasSwitch(const char string_constant[]) const {
270 return HasSwitch(std::string(string_constant)); 271 return HasSwitch(std::string(string_constant));
271 } 272 }
272 273
273 std::string CommandLine::GetSwitchValueASCII( 274 std::string CommandLine::GetSwitchValueASCII(
274 const std::string& switch_string) const { 275 const std::string& switch_string) const {
275 StringType value = GetSwitchValueNative(switch_string); 276 StringType value = GetSwitchValueNative(switch_string);
276 if (!IsStringASCII(value)) { 277 if (!IsStringASCII(value)) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 #if defined(OS_WIN) 447 #if defined(OS_WIN)
447 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders); 448 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders);
448 #endif 449 #endif
449 params.append(arg); 450 params.append(arg);
450 } 451 }
451 } 452 }
452 return params; 453 return params;
453 } 454 }
454 455
455 } // namespace base 456 } // namespace base
OLDNEW
« no previous file with comments | « base/command_line.h ('k') | base/command_line_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698