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

Side by Side Diff: base/environment.cc

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « base/command_line.cc ('k') | base/i18n/rtl.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/environment.h" 5 #include "base/environment.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 18 matching lines...) Expand all
29 29
30 // Some commonly used variable names are uppercase while others 30 // Some commonly used variable names are uppercase while others
31 // are lowercase, which is inconsistent. Let's try to be helpful 31 // are lowercase, which is inconsistent. Let's try to be helpful
32 // and look for a variable name with the reverse case. 32 // and look for a variable name with the reverse case.
33 // I.e. HTTP_PROXY may be http_proxy for some users/systems. 33 // I.e. HTTP_PROXY may be http_proxy for some users/systems.
34 char first_char = variable_name[0]; 34 char first_char = variable_name[0];
35 std::string alternate_case_var; 35 std::string alternate_case_var;
36 if (first_char >= 'a' && first_char <= 'z') 36 if (first_char >= 'a' && first_char <= 'z')
37 alternate_case_var = StringToUpperASCII(std::string(variable_name)); 37 alternate_case_var = StringToUpperASCII(std::string(variable_name));
38 else if (first_char >= 'A' && first_char <= 'Z') 38 else if (first_char >= 'A' && first_char <= 'Z')
39 alternate_case_var = StringToLowerASCII(std::string(variable_name)); 39 alternate_case_var = base::StringToLowerASCII(std::string(variable_name));
40 else 40 else
41 return false; 41 return false;
42 return GetVarImpl(alternate_case_var.c_str(), result); 42 return GetVarImpl(alternate_case_var.c_str(), result);
43 } 43 }
44 44
45 virtual bool SetVar(const char* variable_name, 45 virtual bool SetVar(const char* variable_name,
46 const std::string& new_value) OVERRIDE { 46 const std::string& new_value) OVERRIDE {
47 return SetVarImpl(variable_name, new_value); 47 return SetVarImpl(variable_name, new_value);
48 } 48 }
49 49
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 for (size_t i = 0; i < result_indices.size(); i++) 228 for (size_t i = 0; i < result_indices.size(); i++)
229 result[i] = &storage_data[result_indices[i]]; 229 result[i] = &storage_data[result_indices[i]];
230 result[result_indices.size()] = 0; // Null terminator. 230 result[result_indices.size()] = 0; // Null terminator.
231 231
232 return result.Pass(); 232 return result.Pass();
233 } 233 }
234 234
235 #endif // OS_POSIX 235 #endif // OS_POSIX
236 236
237 } // namespace base 237 } // namespace base
OLDNEW
« no previous file with comments | « base/command_line.cc ('k') | base/i18n/rtl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698