| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "public/platform/FilePathConversion.h" | 5 #include "public/platform/FilePathConversion.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "platform/wtf/text/StringUTF8Adaptor.h" |
| 9 #include "platform/wtf/text/WTFString.h" |
| 8 #include "public/platform/WebString.h" | 10 #include "public/platform/WebString.h" |
| 9 #include "wtf/text/StringUTF8Adaptor.h" | |
| 10 #include "wtf/text/WTFString.h" | |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 base::FilePath WebStringToFilePath(const WebString& webString) { | 14 base::FilePath WebStringToFilePath(const WebString& webString) { |
| 15 if (webString.isEmpty()) | 15 if (webString.isEmpty()) |
| 16 return base::FilePath(); | 16 return base::FilePath(); |
| 17 | 17 |
| 18 String str = webString; | 18 String str = webString; |
| 19 if (!str.is8Bit()) { | 19 if (!str.is8Bit()) { |
| 20 return base::FilePath::FromUTF16Unsafe( | 20 return base::FilePath::FromUTF16Unsafe( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 return WebString(); | 36 return WebString(); |
| 37 | 37 |
| 38 #if OS(POSIX) | 38 #if OS(POSIX) |
| 39 return WebString::fromUTF8(path.value()); | 39 return WebString::fromUTF8(path.value()); |
| 40 #else | 40 #else |
| 41 return WebString::fromUTF16(path.AsUTF16Unsafe()); | 41 return WebString::fromUTF16(path.AsUTF16Unsafe()); |
| 42 #endif | 42 #endif |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace blink | 45 } // namespace blink |
| OLD | NEW |