OLD | NEW |
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 Loading... |
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 (base::LowerCaseEqualsASCII(extension, kCommonDoubleExtensions[i])) | 144 if (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 (base::LowerCaseEqualsASCII(extension, | 150 if (LowerCaseEqualsASCII(extension, kCommonDoubleExtensionSuffixes[i])) { |
151 kCommonDoubleExtensionSuffixes[i])) { | |
152 if ((last_dot - penultimate_dot) <= 5U && | 151 if ((last_dot - penultimate_dot) <= 5U && |
153 (last_dot - penultimate_dot) > 1U) { | 152 (last_dot - penultimate_dot) > 1U) { |
154 return penultimate_dot; | 153 return penultimate_dot; |
155 } | 154 } |
156 } | 155 } |
157 } | 156 } |
158 | 157 |
159 return last_dot; | 158 return last_dot; |
160 } | 159 } |
161 | 160 |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 bool FilePath::IsContentUri() const { | 1313 bool FilePath::IsContentUri() const { |
1315 return StartsWithASCII(path_, "content://", false /*case_sensitive*/); | 1314 return StartsWithASCII(path_, "content://", false /*case_sensitive*/); |
1316 } | 1315 } |
1317 #endif | 1316 #endif |
1318 | 1317 |
1319 } // namespace base | 1318 } // namespace base |
1320 | 1319 |
1321 void PrintTo(const base::FilePath& path, std::ostream* out) { | 1320 void PrintTo(const base::FilePath& path, std::ostream* out) { |
1322 *out << path.value(); | 1321 *out << path.value(); |
1323 } | 1322 } |
OLD | NEW |