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

Side by Side Diff: base/files/file_path.cc

Issue 448143008: Move StringToUpperASCII and LowerCaseEqualsASCII to the 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/environment.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/files/file_path.h" 5 #include "base/files/file_path.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 FilePath::kSeparatorsLength - 1); 134 FilePath::kSeparatorsLength - 1);
135 135
136 if (penultimate_dot == StringType::npos || 136 if (penultimate_dot == StringType::npos ||
137 (last_separator != StringType::npos && 137 (last_separator != StringType::npos &&
138 penultimate_dot < last_separator)) { 138 penultimate_dot < last_separator)) {
139 return last_dot; 139 return last_dot;
140 } 140 }
141 141
142 for (size_t i = 0; i < arraysize(kCommonDoubleExtensions); ++i) { 142 for (size_t i = 0; i < arraysize(kCommonDoubleExtensions); ++i) {
143 StringType extension(path, penultimate_dot + 1); 143 StringType extension(path, penultimate_dot + 1);
144 if (LowerCaseEqualsASCII(extension, kCommonDoubleExtensions[i])) 144 if (base::LowerCaseEqualsASCII(extension, kCommonDoubleExtensions[i]))
145 return penultimate_dot; 145 return penultimate_dot;
146 } 146 }
147 147
148 StringType extension(path, last_dot + 1); 148 StringType extension(path, last_dot + 1);
149 for (size_t i = 0; i < arraysize(kCommonDoubleExtensionSuffixes); ++i) { 149 for (size_t i = 0; i < arraysize(kCommonDoubleExtensionSuffixes); ++i) {
150 if (LowerCaseEqualsASCII(extension, kCommonDoubleExtensionSuffixes[i])) { 150 if (base::LowerCaseEqualsASCII(extension,
151 kCommonDoubleExtensionSuffixes[i])) {
151 if ((last_dot - penultimate_dot) <= 5U && 152 if ((last_dot - penultimate_dot) <= 5U &&
152 (last_dot - penultimate_dot) > 1U) { 153 (last_dot - penultimate_dot) > 1U) {
153 return penultimate_dot; 154 return penultimate_dot;
154 } 155 }
155 } 156 }
156 } 157 }
157 158
158 return last_dot; 159 return last_dot;
159 } 160 }
160 161
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 bool FilePath::IsContentUri() const { 1314 bool FilePath::IsContentUri() const {
1314 return StartsWithASCII(path_, "content://", false /*case_sensitive*/); 1315 return StartsWithASCII(path_, "content://", false /*case_sensitive*/);
1315 } 1316 }
1316 #endif 1317 #endif
1317 1318
1318 } // namespace base 1319 } // namespace base
1319 1320
1320 void PrintTo(const base::FilePath& path, std::ostream* out) { 1321 void PrintTo(const base::FilePath& path, std::ostream* out) {
1321 *out << path.value(); 1322 *out << path.value();
1322 } 1323 }
OLDNEW
« no previous file with comments | « base/environment.cc ('k') | base/i18n/rtl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698