OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains ParamTraits templates to support serialization of WebKit | 5 // This file contains ParamTraits templates to support serialization of WebKit |
6 // data types over IPC. | 6 // data types over IPC. |
7 // | 7 // |
8 // NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED. | 8 // NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED. |
9 // | 9 // |
10 // There are several reasons for this restrictions: | 10 // There are several reasons for this restrictions: |
(...skipping 10 matching lines...) Expand all Loading... |
21 // using those beyond code that interfaces with the WebKit API. | 21 // using those beyond code that interfaces with the WebKit API. |
22 | 22 |
23 #ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 23 #ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |
24 #define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 24 #define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |
25 #pragma once | 25 #pragma once |
26 | 26 |
27 #include "ipc/ipc_message_utils.h" | 27 #include "ipc/ipc_message_utils.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" |
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" |
36 | 35 |
37 namespace WebKit { | 36 namespace WebKit { |
38 struct WebCompositionUnderline; | |
39 struct WebRect; | 37 struct WebRect; |
40 struct WebScreenInfo; | 38 struct WebScreenInfo; |
41 } | 39 } |
42 | 40 |
43 namespace IPC { | 41 namespace IPC { |
44 | 42 |
45 template <> | 43 template <> |
46 struct ParamTraits<WebKit::WebRect> { | 44 struct ParamTraits<WebKit::WebRect> { |
47 typedef WebKit::WebRect param_type; | 45 typedef WebKit::WebRect param_type; |
48 static void Write(Message* m, const param_type& p); | 46 static void Write(Message* m, const param_type& p); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 LogParam(p.images, l); | 133 LogParam(p.images, l); |
136 LogParam(p.cssStyleSheets, l); | 134 LogParam(p.cssStyleSheets, l); |
137 LogParam(p.scripts, l); | 135 LogParam(p.scripts, l); |
138 LogParam(p.xslStyleSheets, l); | 136 LogParam(p.xslStyleSheets, l); |
139 LogParam(p.fonts, l); | 137 LogParam(p.fonts, l); |
140 l->append("</WebCoreStats>"); | 138 l->append("</WebCoreStats>"); |
141 } | 139 } |
142 }; | 140 }; |
143 | 141 |
144 template <> | 142 template <> |
145 struct SimilarTypeTraits<WebKit::WebDragOperation> { | |
146 typedef int Type; | |
147 }; | |
148 | |
149 template <> | |
150 struct ParamTraits<WebKit::WebCompositionUnderline> { | |
151 typedef WebKit::WebCompositionUnderline param_type; | |
152 static void Write(Message* m, const param_type& p); | |
153 static bool Read(const Message* m, void** iter, param_type* p); | |
154 static void Log(const param_type& p, std::string* l); | |
155 }; | |
156 | |
157 template <> | |
158 struct ParamTraits<WebKit::WebTextInputType> { | 143 struct ParamTraits<WebKit::WebTextInputType> { |
159 typedef WebKit::WebTextInputType param_type; | 144 typedef WebKit::WebTextInputType param_type; |
160 static void Write(Message* m, const param_type& p) { | 145 static void Write(Message* m, const param_type& p) { |
161 m->WriteInt(p); | 146 m->WriteInt(p); |
162 } | 147 } |
163 static bool Read(const Message* m, void** iter, param_type* p) { | 148 static bool Read(const Message* m, void** iter, param_type* p) { |
164 int type; | 149 int type; |
165 if (!m->ReadInt(iter, &type)) | 150 if (!m->ReadInt(iter, &type)) |
166 return false; | 151 return false; |
167 *p = static_cast<param_type>(type); | 152 *p = static_cast<param_type>(type); |
(...skipping 29 matching lines...) Expand all Loading... |
197 struct ParamTraits<WebKit::WebTextCheckingResult> { | 182 struct ParamTraits<WebKit::WebTextCheckingResult> { |
198 typedef WebKit::WebTextCheckingResult param_type; | 183 typedef WebKit::WebTextCheckingResult param_type; |
199 static void Write(Message* m, const param_type& p); | 184 static void Write(Message* m, const param_type& p); |
200 static bool Read(const Message* m, void** iter, param_type* r); | 185 static bool Read(const Message* m, void** iter, param_type* r); |
201 static void Log(const param_type& p, std::string* l); | 186 static void Log(const param_type& p, std::string* l); |
202 }; | 187 }; |
203 | 188 |
204 } // namespace IPC | 189 } // namespace IPC |
205 | 190 |
206 #endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 191 #endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |
OLD | NEW |