blob: e5cc376c2b460d430dc5f43362b30bb153b9cc78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_GLUE_UTIL_H_
#define WEBKIT_GLUE_GLUE_UTIL_H_
#include "base/file_path.h"
#include "base/string16.h"
class GURL;
namespace WebCore {
class AccessibilityObject;
class ChromiumDataObject;
class CString;
class Cursor;
class HistoryItem;
class HTMLFormElement;
class IntPoint;
class IntRect;
class IntSize;
class KURL;
class Node;
class Range;
class ResourceError;
class ResourceResponse;
class SecurityOrigin;
class SharedBuffer;
class String;
struct ResourceRequest;
}
namespace WebKit {
class WebAccessibilityObject;
class WebCString;
class WebData;
class WebDragData;
class WebForm;
class WebHistoryItem;
class WebNode;
class WebRange;
class WebSecurityOrigin;
class WebString;
class WebURL;
class WebURLRequest;
class WebURLResponse;
struct WebCursorInfo;
struct WebPoint;
struct WebRect;
struct WebSize;
struct WebURLError;
}
namespace WTF {
template <typename T> class PassRefPtr;
}
namespace gfx {
class Rect;
}
namespace webkit_glue {
// WebCore::CString <-> std::string. All characters are 8-bit and are preserved
// unchanged.
std::string CStringToStdString(const WebCore::CString& str);
WebCore::CString StdStringToCString(const std::string& str);
// WebCore::String <-> std::wstring. We assume that the WebCore::String is in
// UTF-16, and will either copy to a UTF-16 std::wstring (on Windows) or convert
// to a UTF-32 one on Linux and Mac.
std::wstring StringToStdWString(const WebCore::String& str);
WebCore::String StdWStringToString(const std::wstring& str);
// WebCore::String -> string16. This is a direct copy of UTF-16 characters.
string16 StringToString16(const WebCore::String& str);
WebCore::String String16ToString(const string16& str);
// WebCore::String <-> std::string. We assume the WebCore::String is UTF-16 and
// the std::string is UTF-8, and convert as necessary.
std::string StringToStdString(const WebCore::String& str);
WebCore::String StdStringToString(const std::string& str);
// WebCore::String <-> WebString. No charset conversion.
WebKit::WebString StringToWebString(const WebCore::String& str);
WebCore::String WebStringToString(const WebKit::WebString& str);
// WebCore::CString <-> WebCString. No charset conversion.
WebKit::WebCString CStringToWebCString(const WebCore::CString& str);
WebCore::CString WebCStringToCString(const WebKit::WebCString& str);
// std::string <-> WebString. Conversion to/from UTF-8.
WebKit::WebString StdStringToWebString(const std::string& str);
std::string WebStringToStdString(const WebKit::WebString& str);
// WebCore::SharedBuffer <-> WebData. No charset conversion.
WebKit::WebData SharedBufferToWebData(
const WTF::PassRefPtr<WebCore::SharedBuffer>& buf);
WTF::PassRefPtr<WebCore::SharedBuffer> WebDataToSharedBuffer(
const WebKit::WebData& data);
FilePath::StringType StringToFilePathString(const WebCore::String& str);
WebCore::String FilePathStringToString(const FilePath::StringType& str);
GURL KURLToGURL(const WebCore::KURL& url);
WebCore::KURL GURLToKURL(const GURL& url);
GURL StringToGURL(const WebCore::String& spec);
WebKit::WebURL KURLToWebURL(const WebCore::KURL& url);
WebCore::KURL WebURLToKURL(const WebKit::WebURL& url);
gfx::Rect FromIntRect(const WebCore::IntRect& r);
WebCore::IntRect ToIntRect(const gfx::Rect& r);
// WebPoint <-> IntPoint
WebCore::IntPoint WebPointToIntPoint(const WebKit::WebPoint&);
WebKit::WebPoint IntPointToWebPoint(const WebCore::IntPoint&);
// WebRect <-> IntRect
WebCore::IntRect WebRectToIntRect(const WebKit::WebRect&);
WebKit::WebRect IntRectToWebRect(const WebCore::IntRect&);
// WebSize <-> IntSize
WebCore::IntSize WebSizeToIntSize(const WebKit::WebSize&);
WebKit::WebSize IntSizeToWebSize(const WebCore::IntSize&);
// WebCursorInfo <- Cursor
WebKit::WebCursorInfo CursorToWebCursorInfo(const WebCore::Cursor&);
// WebNode <-> Node
WebKit::WebNode NodeToWebNode(const WTF::PassRefPtr<WebCore::Node>&);
WTF::PassRefPtr<WebCore::Node> WebNodeToNode(const WebKit::WebNode&);
// WebDragData <-> ChromiumDataObject
WebKit::WebDragData ChromiumDataObjectToWebDragData(
const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);
WTF::PassRefPtr<WebCore::ChromiumDataObject> WebDragDataToChromiumDataObject(
const WebKit::WebDragData&);
// WebForm <-> HTMLFormElement
WebKit::WebForm HTMLFormElementToWebForm(
const WTF::PassRefPtr<WebCore::HTMLFormElement>&);
WTF::PassRefPtr<WebCore::HTMLFormElement> WebFormToHTMLFormElement(
const WebKit::WebForm&);
// WebHistoryItem <-> HistoryItem
WebKit::WebHistoryItem HistoryItemToWebHistoryItem(
const WTF::PassRefPtr<WebCore::HistoryItem>&);
WTF::PassRefPtr<WebCore::HistoryItem> WebHistoryItemToHistoryItem(
const WebKit::WebHistoryItem&);
// WebRange <-> Range
WebKit::WebRange RangeToWebRange(
const WTF::PassRefPtr<WebCore::Range>&);
WTF::PassRefPtr<WebCore::Range> WebRangeToRange(
const WebKit::WebRange&);
// WebSecurityOrigin <-> SecurityOrigin
WebKit::WebSecurityOrigin SecurityOriginToWebSecurityOrigin(
const WTF::PassRefPtr<WebCore::SecurityOrigin>&);
// WebURLError <-> ResourceError
WebKit::WebURLError ResourceErrorToWebURLError(
const WebCore::ResourceError& error);
WebCore::ResourceError WebURLErrorToResourceError(
const WebKit::WebURLError& error);
// Exposes the ResourceRequest contained by a WebURLRequest
WebCore::ResourceRequest* WebURLRequestToMutableResourceRequest(
WebKit::WebURLRequest* req);
const WebCore::ResourceRequest* WebURLRequestToResourceRequest(
const WebKit::WebURLRequest* req);
// Exposes the ResourceResponse contained by a WebURLResponse
WebCore::ResourceResponse* WebURLResponseToMutableResourceResponse(
WebKit::WebURLResponse* resp);
const WebCore::ResourceResponse* WebURLResponseToResourceResponse(
const WebKit::WebURLResponse* resp);
// WebAccessibilityObject <-> AccessibilityObject
WebKit::WebAccessibilityObject AccessibilityObjectToWebAccessibilityObject(
const WTF::PassRefPtr<WebCore::AccessibilityObject>& o);
WTF::PassRefPtr<WebCore::AccessibilityObject> WebAccessibilityObjectToAccessibilityObject(
const WebKit::WebAccessibilityObject&);
} // namespace webkit_glue
#endif // #ifndef WEBKIT_GLUE_GLUE_UTIL_H_
|