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

Side by Side Diff: content/child/simple_webmimeregistry_impl.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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 | « content/child/npapi/plugin_host.cc ('k') | content/common/appcache_interfaces.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/simple_webmimeregistry_impl.h" 5 #include "content/child/simple_webmimeregistry_impl.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 24 matching lines...) Expand all
35 return mime_util::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) 35 return mime_util::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type))
36 ? WebMimeRegistry::IsSupported 36 ? WebMimeRegistry::IsSupported
37 : WebMimeRegistry::IsNotSupported; 37 : WebMimeRegistry::IsNotSupported;
38 } 38 }
39 39
40 WebMimeRegistry::SupportsType 40 WebMimeRegistry::SupportsType
41 SimpleWebMimeRegistryImpl::supportsImagePrefixedMIMEType( 41 SimpleWebMimeRegistryImpl::supportsImagePrefixedMIMEType(
42 const WebString& mime_type) { 42 const WebString& mime_type) {
43 std::string ascii_mime_type = ToASCIIOrEmpty(mime_type); 43 std::string ascii_mime_type = ToASCIIOrEmpty(mime_type);
44 return (mime_util::IsSupportedImageMimeType(ascii_mime_type) || 44 return (mime_util::IsSupportedImageMimeType(ascii_mime_type) ||
45 (base::StartsWithASCII(ascii_mime_type, "image/", true) && 45 (base::StartsWith(ascii_mime_type, "image/",
46 base::CompareCase::SENSITIVE) &&
46 mime_util::IsSupportedNonImageMimeType(ascii_mime_type))) 47 mime_util::IsSupportedNonImageMimeType(ascii_mime_type)))
47 ? WebMimeRegistry::IsSupported 48 ? WebMimeRegistry::IsSupported
48 : WebMimeRegistry::IsNotSupported; 49 : WebMimeRegistry::IsNotSupported;
49 } 50 }
50 51
51 WebMimeRegistry::SupportsType 52 WebMimeRegistry::SupportsType
52 SimpleWebMimeRegistryImpl::supportsJavaScriptMIMEType( 53 SimpleWebMimeRegistryImpl::supportsJavaScriptMIMEType(
53 const WebString& mime_type) { 54 const WebString& mime_type) {
54 return mime_util::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) 55 return mime_util::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type))
55 ? WebMimeRegistry::IsSupported 56 ? WebMimeRegistry::IsSupported
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 100
100 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( 101 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile(
101 const WebString& file_path) { 102 const WebString& file_path) {
102 std::string mime_type; 103 std::string mime_type;
103 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), 104 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path),
104 &mime_type); 105 &mime_type);
105 return WebString::fromUTF8(mime_type); 106 return WebString::fromUTF8(mime_type);
106 } 107 }
107 108
108 } // namespace content 109 } // namespace content
OLDNEW
« no previous file with comments | « content/child/npapi/plugin_host.cc ('k') | content/common/appcache_interfaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698