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

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

Issue 471913002: Added a method to detect all supported "image/*" MIME types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
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 17 matching lines...) Expand all
28 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; 28 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported;
29 } 29 }
30 30
31 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType( 31 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType(
32 const WebString& mime_type) { 32 const WebString& mime_type) {
33 return net::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) ? 33 return net::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) ?
34 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; 34 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported;
35 } 35 }
36 36
37 WebMimeRegistry::SupportsType 37 WebMimeRegistry::SupportsType
38 SimpleWebMimeRegistryImpl::supportsImagePrefixedMIMEType(
39 const WebString& mime_type) {
40 return net::IsSupportedImagePrefixedMimeType(ToASCIIOrEmpty(mime_type)) ?
41 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported;
42 }
43
44 WebMimeRegistry::SupportsType
38 SimpleWebMimeRegistryImpl::supportsJavaScriptMIMEType( 45 SimpleWebMimeRegistryImpl::supportsJavaScriptMIMEType(
39 const WebString& mime_type) { 46 const WebString& mime_type) {
40 return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ? 47 return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ?
41 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; 48 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported;
42 } 49 }
43 50
44 // When debugging layout tests failures in the test shell, 51 // When debugging layout tests failures in the test shell,
45 // see TestShellWebMimeRegistryImpl. 52 // see TestShellWebMimeRegistryImpl.
46 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMediaMIMEType( 53 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMediaMIMEType(
47 const WebString& mime_type, 54 const WebString& mime_type,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 98
92 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( 99 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile(
93 const WebString& file_path) { 100 const WebString& file_path) {
94 std::string mime_type; 101 std::string mime_type;
95 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), 102 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path),
96 &mime_type); 103 &mime_type);
97 return WebString::fromUTF8(mime_type); 104 return WebString::fromUTF8(mime_type);
98 } 105 }
99 106
100 } // namespace content 107 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698