OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/value_conversions.h" | 5 #include "base/value_conversions.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 result = SysWideToNativeMB(UTF8ToWide(str)); | 30 result = SysWideToNativeMB(UTF8ToWide(str)); |
31 #elif defined(OS_WIN) | 31 #elif defined(OS_WIN) |
32 result = UTF8ToUTF16(str); | 32 result = UTF8ToUTF16(str); |
33 #endif | 33 #endif |
34 return FilePath(result); | 34 return FilePath(result); |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 StringValue* CreateFilePathValue(const FilePath& in_value) { | 39 StringValue* CreateFilePathValue(const FilePath& in_value) { |
40 return new StringValue(FilePathToUTF8(in_value)); | 40 return StringValue::New(FilePathToUTF8(in_value)); |
41 } | 41 } |
42 | 42 |
43 bool GetValueAsFilePath(const Value& value, FilePath* file_path) { | 43 bool GetValueAsFilePath(const Value& value, FilePath* file_path) { |
44 std::string str; | 44 std::string str; |
45 if (!value.GetAsString(&str)) | 45 if (!value.GetAsString(&str)) |
46 return false; | 46 return false; |
47 if (file_path) | 47 if (file_path) |
48 *file_path = UTF8ToFilePath(str); | 48 *file_path = UTF8ToFilePath(str); |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 } // namespace base | 52 } // namespace base |
OLD | NEW |