OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef WEBKIT_GLUE_GLUE_UTIL_H_ | 5 #ifndef WEBKIT_GLUE_GLUE_UTIL_H_ |
6 #define WEBKIT_GLUE_GLUE_UTIL_H_ | 6 #define WEBKIT_GLUE_GLUE_UTIL_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 | 10 |
11 class GURL; | 11 class GURL; |
12 | 12 |
13 namespace WebCore { | 13 namespace WebCore { |
14 class CString; | 14 class CString; |
15 class IntRect; | 15 class IntRect; |
16 class KURL; | 16 class KURL; |
17 class String; | 17 class String; |
18 } | 18 } |
19 | 19 |
| 20 namespace WebKit { |
| 21 class WebString; |
| 22 } |
| 23 |
20 namespace gfx { | 24 namespace gfx { |
21 class Rect; | 25 class Rect; |
22 } | 26 } |
23 | 27 |
24 namespace webkit_glue { | 28 namespace webkit_glue { |
25 | 29 |
26 // WebCore::CString <-> std::string. All characters are 8-bit and are preserved | 30 // WebCore::CString <-> std::string. All characters are 8-bit and are preserved |
27 // unchanged. | 31 // unchanged. |
28 std::string CStringToStdString(const WebCore::CString& str); | 32 std::string CStringToStdString(const WebCore::CString& str); |
29 WebCore::CString StdStringToCString(const std::string& str); | 33 WebCore::CString StdStringToCString(const std::string& str); |
30 | 34 |
31 // WebCore::String <-> std::wstring. We assume that the WebCore::String is in | 35 // WebCore::String <-> std::wstring. We assume that the WebCore::String is in |
32 // UTF-16, and will either copy to a UTF-16 std::wstring (on Windows) or convert | 36 // UTF-16, and will either copy to a UTF-16 std::wstring (on Windows) or convert |
33 // to a UTF-32 one on Linux and Mac. | 37 // to a UTF-32 one on Linux and Mac. |
34 std::wstring StringToStdWString(const WebCore::String& str); | 38 std::wstring StringToStdWString(const WebCore::String& str); |
35 WebCore::String StdWStringToString(const std::wstring& str); | 39 WebCore::String StdWStringToString(const std::wstring& str); |
36 | 40 |
37 // WebCore::String -> string16. This is a direct copy of UTF-16 characters. | 41 // WebCore::String -> string16. This is a direct copy of UTF-16 characters. |
38 string16 StringToString16(const WebCore::String& str); | 42 string16 StringToString16(const WebCore::String& str); |
39 WebCore::String String16ToString(const string16& str); | 43 WebCore::String String16ToString(const string16& str); |
40 | 44 |
41 // WebCore::String <-> std::string. We assume the WebCore::String is UTF-16 and | 45 // WebCore::String <-> std::string. We assume the WebCore::String is UTF-16 and |
42 // the std::string is UTF-8, and convert as necessary. | 46 // the std::string is UTF-8, and convert as necessary. |
43 std::string StringToStdString(const WebCore::String& str); | 47 std::string StringToStdString(const WebCore::String& str); |
44 WebCore::String StdStringToString(const std::string& str); | 48 WebCore::String StdStringToString(const std::string& str); |
45 | 49 |
46 FilePath::StringType StringToFilePathString(const WebCore::String& str); | 50 FilePath::StringType StringToFilePathString(const WebCore::String& str); |
47 WebCore::String FilePathStringToString(const FilePath::StringType& str); | 51 WebCore::String FilePathStringToString(const FilePath::StringType& str); |
48 | 52 |
| 53 FilePath::StringType WebStringToFilePathString(const WebKit::WebString& str); |
| 54 WebKit::WebString FilePathStringToWebString(const FilePath::StringType& str); |
| 55 |
49 GURL KURLToGURL(const WebCore::KURL& url); | 56 GURL KURLToGURL(const WebCore::KURL& url); |
50 WebCore::KURL GURLToKURL(const GURL& url); | 57 WebCore::KURL GURLToKURL(const GURL& url); |
51 GURL StringToGURL(const WebCore::String& spec); | 58 GURL StringToGURL(const WebCore::String& spec); |
52 | 59 |
53 gfx::Rect FromIntRect(const WebCore::IntRect& r); | 60 gfx::Rect FromIntRect(const WebCore::IntRect& r); |
54 WebCore::IntRect ToIntRect(const gfx::Rect& r); | 61 WebCore::IntRect ToIntRect(const gfx::Rect& r); |
55 | 62 |
56 } // namespace webkit_glue | 63 } // namespace webkit_glue |
57 | 64 |
58 #endif // #ifndef WEBKIT_GLUE_GLUE_UTIL_H_ | 65 #endif // #ifndef WEBKIT_GLUE_GLUE_UTIL_H_ |
OLD | NEW |