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

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

Issue 196793010: Move IsStringASCII/UTF8 to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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"
11 #include "net/base/mime_util.h" 11 #include "net/base/mime_util.h"
12 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
13 13
14 using blink::WebString; 14 using blink::WebString;
15 using blink::WebMimeRegistry; 15 using blink::WebMimeRegistry;
16 16
17 namespace content { 17 namespace content {
18 18
19 //static 19 //static
20 std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) { 20 std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) {
21 return IsStringASCII(string) ? base::UTF16ToASCII(string) : std::string(); 21 return base::IsStringASCII(string) ? base::UTF16ToASCII(string)
22 : std::string();
22 } 23 }
23 24
24 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( 25 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType(
25 const WebString& mime_type) { 26 const WebString& mime_type) {
26 return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ? 27 return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ?
27 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported; 28 WebMimeRegistry::IsSupported : WebMimeRegistry::IsNotSupported;
28 } 29 }
29 30
30 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType( 31 WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType(
31 const WebString& mime_type) { 32 const WebString& mime_type) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( 92 WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile(
92 const WebString& file_path) { 93 const WebString& file_path) {
93 std::string mime_type; 94 std::string mime_type;
94 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path), 95 net::GetMimeTypeFromFile(base::FilePath::FromUTF16Unsafe(file_path),
95 &mime_type); 96 &mime_type);
96 return WebString::fromUTF8(mime_type); 97 return WebString::fromUTF8(mime_type);
97 } 98 }
98 99
99 } // namespace content 100 } // namespace content
OLDNEW
« no previous file with comments | « content/child/ftp_directory_listing_response_delegate.cc ('k') | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698