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

Side by Side Diff: components/mime_util/mime_util.cc

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « base/strings/string_util.h ('k') | components/storage_monitor/portable_device_watcher_win.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mime_util/mime_util.h" 5 #include "components/mime_util/mime_util.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 for (size_t i = 0; i < arraysize(kSupportedCertificateTypes); ++i) 149 for (size_t i = 0; i < arraysize(kSupportedCertificateTypes); ++i)
150 non_image_types_.insert(kSupportedCertificateTypes[i].mime_type); 150 non_image_types_.insert(kSupportedCertificateTypes[i].mime_type);
151 } 151 }
152 152
153 bool MimeUtil::IsSupportedImageMimeType(const std::string& mime_type) const { 153 bool MimeUtil::IsSupportedImageMimeType(const std::string& mime_type) const {
154 return image_types_.find(base::ToLowerASCII(mime_type)) != image_types_.end(); 154 return image_types_.find(base::ToLowerASCII(mime_type)) != image_types_.end();
155 } 155 }
156 156
157 bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { 157 bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const {
158 return non_image_types_.find(base::StringToLowerASCII(mime_type)) != 158 return non_image_types_.find(base::ToLowerASCII(mime_type)) !=
159 non_image_types_.end() || 159 non_image_types_.end() ||
160 #if !defined(OS_IOS) 160 #if !defined(OS_IOS)
161 media::IsSupportedMediaMimeType(mime_type) || 161 media::IsSupportedMediaMimeType(mime_type) ||
162 #endif 162 #endif
163 (base::StartsWith(mime_type, "text/", 163 (base::StartsWith(mime_type, "text/",
164 base::CompareCase::INSENSITIVE_ASCII) && 164 base::CompareCase::INSENSITIVE_ASCII) &&
165 !IsUnsupportedTextMimeType(mime_type)) || 165 !IsUnsupportedTextMimeType(mime_type)) ||
166 (base::StartsWith(mime_type, "application/", 166 (base::StartsWith(mime_type, "application/",
167 base::CompareCase::INSENSITIVE_ASCII) && 167 base::CompareCase::INSENSITIVE_ASCII) &&
168 net::MatchesMimeType("application/*+json", mime_type)); 168 net::MatchesMimeType("application/*+json", mime_type));
169 } 169 }
170 170
171 bool MimeUtil::IsUnsupportedTextMimeType(const std::string& mime_type) const { 171 bool MimeUtil::IsUnsupportedTextMimeType(const std::string& mime_type) const {
172 return unsupported_text_types_.find(base::StringToLowerASCII(mime_type)) != 172 return unsupported_text_types_.find(base::ToLowerASCII(mime_type)) !=
173 unsupported_text_types_.end(); 173 unsupported_text_types_.end();
174 } 174 }
175 175
176 bool MimeUtil::IsSupportedJavascriptMimeType( 176 bool MimeUtil::IsSupportedJavascriptMimeType(
177 const std::string& mime_type) const { 177 const std::string& mime_type) const {
178 return javascript_types_.find(mime_type) != javascript_types_.end(); 178 return javascript_types_.find(mime_type) != javascript_types_.end();
179 } 179 }
180 180
181 bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const { 181 bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const {
182 return (base::StartsWith(mime_type, "image/", 182 return (base::StartsWith(mime_type, "image/",
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (base::EqualsCaseInsensitiveASCII( 225 if (base::EqualsCaseInsensitiveASCII(
226 mime_type, kSupportedCertificateTypes[i].mime_type)) { 226 mime_type, kSupportedCertificateTypes[i].mime_type)) {
227 return kSupportedCertificateTypes[i].cert_type; 227 return kSupportedCertificateTypes[i].cert_type;
228 } 228 }
229 } 229 }
230 230
231 return net::CERTIFICATE_MIME_TYPE_UNKNOWN; 231 return net::CERTIFICATE_MIME_TYPE_UNKNOWN;
232 } 232 }
233 233
234 } // namespace mime_util 234 } // namespace mime_util
OLDNEW
« no previous file with comments | « base/strings/string_util.h ('k') | components/storage_monitor/portable_device_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698