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