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 "webkit/base/file_path_string_conversions.h" | 5 #include "webkit/base/file_path_string_conversions.h" |
6 | 6 |
7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
10 | 10 |
11 namespace webkit_base { | 11 namespace webkit_base { |
12 | 12 |
13 FilePath::StringType WebStringToFilePathString(const WebKit::WebString& str) { | 13 base::FilePath::StringType WebStringToFilePathString( |
| 14 const WebKit::WebString& str) { |
14 #if defined(OS_POSIX) | 15 #if defined(OS_POSIX) |
15 return base::SysWideToNativeMB(UTF16ToWideHack(str)); | 16 return base::SysWideToNativeMB(UTF16ToWideHack(str)); |
16 #elif defined(OS_WIN) | 17 #elif defined(OS_WIN) |
17 return UTF16ToWideHack(str); | 18 return UTF16ToWideHack(str); |
18 #endif | 19 #endif |
19 } | 20 } |
20 | 21 |
21 WebKit::WebString FilePathStringToWebString(const FilePath::StringType& str) { | 22 WebKit::WebString FilePathStringToWebString( |
| 23 const base::FilePath::StringType& str) { |
22 #if defined(OS_POSIX) | 24 #if defined(OS_POSIX) |
23 return WideToUTF16Hack(base::SysNativeMBToWide(str)); | 25 return WideToUTF16Hack(base::SysNativeMBToWide(str)); |
24 #elif defined(OS_WIN) | 26 #elif defined(OS_WIN) |
25 return WideToUTF16Hack(str); | 27 return WideToUTF16Hack(str); |
26 #endif | 28 #endif |
27 } | 29 } |
28 | 30 |
29 FilePath WebStringToFilePath(const WebKit::WebString& str) { | 31 base::FilePath WebStringToFilePath(const WebKit::WebString& str) { |
30 return FilePath(WebStringToFilePathString(str)); | 32 return base::FilePath(WebStringToFilePathString(str)); |
31 } | 33 } |
32 | 34 |
33 WebKit::WebString FilePathToWebString(const FilePath& file_path) { | 35 WebKit::WebString FilePathToWebString(const base::FilePath& file_path) { |
34 return FilePathStringToWebString(file_path.value()); | 36 return FilePathStringToWebString(file_path.value()); |
35 } | 37 } |
36 | 38 |
37 } // namespace webkit_base | 39 } // namespace webkit_base |
OLD | NEW |