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 is used to define IPC::ParamTraits<> specializations for a number | 5 // This file is used to define IPC::ParamTraits<> specializations for a number |
6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> | 6 // of types so that they can be serialized over IPC. IPC::ParamTraits<> |
7 // specializations for basic types (like int and std::string) and types in the | 7 // specializations for basic types (like int and std::string) and types in the |
8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains | 8 // 'base' project can be found in ipc/ipc_message_utils.h. This file contains |
9 // specializations for types that are shared by more than one child process. | 9 // specializations for types that are shared by more than one child process. |
10 | 10 |
11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 11 #ifndef CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 12 #define CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
13 #pragma once | 13 #pragma once |
14 | 14 |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "app/surface/transport_dib.h" | 17 #include "app/surface/transport_dib.h" |
18 #include "chrome/common/content_settings.h" | 18 #include "chrome/common/content_settings.h" |
19 #include "chrome/common/geoposition.h" | 19 #include "chrome/common/geoposition.h" |
20 #include "chrome/common/page_zoom.h" | 20 #include "chrome/common/page_zoom.h" |
21 #include "gfx/native_widget_types.h" | 21 #include "gfx/native_widget_types.h" |
22 #include "ipc/ipc_message_utils.h" | 22 #include "ipc/ipc_message_utils.h" |
23 #include "net/base/upload_data.h" | 23 #include "net/base/upload_data.h" |
24 #include "net/url_request/url_request_status.h" | 24 #include "net/url_request/url_request_status.h" |
25 #include "printing/native_metafile.h" | 25 #include "printing/native_metafile.h" |
| 26 #include "webkit/glue/password_form.h" |
26 #include "webkit/glue/webcursor.h" | 27 #include "webkit/glue/webcursor.h" |
27 #include "webkit/glue/window_open_disposition.h" | 28 #include "webkit/glue/window_open_disposition.h" |
28 | 29 |
29 // Forward declarations. | 30 // Forward declarations. |
30 class GURL; | 31 class GURL; |
31 class SkBitmap; | 32 class SkBitmap; |
32 class DictionaryValue; | 33 class DictionaryValue; |
33 class ListValue; | 34 class ListValue; |
34 struct ThumbnailScore; | 35 struct ThumbnailScore; |
35 class URLRequestStatus; | 36 class URLRequestStatus; |
36 class WebCursor; | |
37 | 37 |
38 namespace gfx { | 38 namespace gfx { |
39 class Point; | 39 class Point; |
40 class Rect; | 40 class Rect; |
41 class Size; | 41 class Size; |
42 } // namespace gfx | 42 } // namespace gfx |
43 | 43 |
44 namespace printing { | 44 namespace printing { |
45 struct PageRange; | 45 struct PageRange; |
46 } // namespace printing | 46 } // namespace printing |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } | 203 } |
204 }; | 204 }; |
205 | 205 |
206 | 206 |
207 template <> | 207 template <> |
208 struct ParamTraits<WebCursor> { | 208 struct ParamTraits<WebCursor> { |
209 typedef WebCursor param_type; | 209 typedef WebCursor param_type; |
210 static void Write(Message* m, const param_type& p) { | 210 static void Write(Message* m, const param_type& p) { |
211 p.Serialize(m); | 211 p.Serialize(m); |
212 } | 212 } |
213 static bool Read(const Message* m, void** iter, param_type* r) { | 213 static bool Read(const Message* m, void** iter, param_type* r) { |
214 return r->Deserialize(m, iter); | 214 return r->Deserialize(m, iter); |
215 } | 215 } |
216 static void Log(const param_type& p, std::wstring* l) { | 216 static void Log(const param_type& p, std::wstring* l) { |
217 l->append(L"<WebCursor>"); | 217 l->append(L"<WebCursor>"); |
218 } | 218 } |
219 }; | 219 }; |
220 | 220 |
221 | 221 |
222 template <> | 222 template <> |
223 struct ParamTraits<webkit_glue::WebApplicationInfo> { | 223 struct ParamTraits<webkit_glue::WebApplicationInfo> { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 struct ParamTraits<Geoposition::ErrorCode> { | 361 struct ParamTraits<Geoposition::ErrorCode> { |
362 typedef Geoposition::ErrorCode param_type; | 362 typedef Geoposition::ErrorCode param_type; |
363 static void Write(Message* m, const param_type& p); | 363 static void Write(Message* m, const param_type& p); |
364 static bool Read(const Message* m, void** iter, param_type* p); | 364 static bool Read(const Message* m, void** iter, param_type* p); |
365 static void Log(const param_type& p, std::wstring* l); | 365 static void Log(const param_type& p, std::wstring* l); |
366 }; | 366 }; |
367 | 367 |
368 template <> | 368 template <> |
369 struct ParamTraits<webkit_glue::PasswordForm> { | 369 struct ParamTraits<webkit_glue::PasswordForm> { |
370 typedef webkit_glue::PasswordForm param_type; | 370 typedef webkit_glue::PasswordForm param_type; |
371 static void Write(Message* m, const param_type& p); | 371 static void Write(Message* m, const param_type& p) { |
372 static bool Read(const Message* m, void** iter, param_type* p); | 372 WriteParam(m, p.signon_realm); |
373 static void Log(const param_type& p, std::wstring* l); | 373 WriteParam(m, p.origin); |
| 374 WriteParam(m, p.action); |
| 375 WriteParam(m, p.submit_element); |
| 376 WriteParam(m, p.username_element); |
| 377 WriteParam(m, p.username_value); |
| 378 WriteParam(m, p.password_element); |
| 379 WriteParam(m, p.password_value); |
| 380 WriteParam(m, p.old_password_element); |
| 381 WriteParam(m, p.old_password_value); |
| 382 WriteParam(m, p.ssl_valid); |
| 383 WriteParam(m, p.preferred); |
| 384 WriteParam(m, p.blacklisted_by_user); |
| 385 } |
| 386 static bool Read(const Message* m, void** iter, param_type* p) { |
| 387 return |
| 388 ReadParam(m, iter, &p->signon_realm) && |
| 389 ReadParam(m, iter, &p->origin) && |
| 390 ReadParam(m, iter, &p->action) && |
| 391 ReadParam(m, iter, &p->submit_element) && |
| 392 ReadParam(m, iter, &p->username_element) && |
| 393 ReadParam(m, iter, &p->username_value) && |
| 394 ReadParam(m, iter, &p->password_element) && |
| 395 ReadParam(m, iter, &p->password_value) && |
| 396 ReadParam(m, iter, &p->old_password_element) && |
| 397 ReadParam(m, iter, &p->old_password_value) && |
| 398 ReadParam(m, iter, &p->ssl_valid) && |
| 399 ReadParam(m, iter, &p->preferred) && |
| 400 ReadParam(m, iter, &p->blacklisted_by_user); |
| 401 } |
| 402 static void Log(const param_type& p, std::wstring* l) { |
| 403 l->append(L"<PasswordForm>"); |
| 404 } |
374 }; | 405 }; |
375 | 406 |
376 template <> | 407 template <> |
377 struct ParamTraits<printing::PageRange> { | 408 struct ParamTraits<printing::PageRange> { |
378 typedef printing::PageRange param_type; | 409 typedef printing::PageRange param_type; |
379 static void Write(Message* m, const param_type& p); | 410 static void Write(Message* m, const param_type& p); |
| 411 |
380 static bool Read(const Message* m, void** iter, param_type* r); | 412 static bool Read(const Message* m, void** iter, param_type* r); |
| 413 |
381 static void Log(const param_type& p, std::wstring* l); | 414 static void Log(const param_type& p, std::wstring* l); |
382 }; | 415 }; |
383 | 416 |
384 template <> | 417 template <> |
385 struct ParamTraits<printing::NativeMetafile> { | 418 struct ParamTraits<printing::NativeMetafile> { |
386 typedef printing::NativeMetafile param_type; | 419 typedef printing::NativeMetafile param_type; |
387 static void Write(Message* m, const param_type& p); | 420 static void Write(Message* m, const param_type& p); |
| 421 |
388 static bool Read(const Message* m, void** iter, param_type* r); | 422 static bool Read(const Message* m, void** iter, param_type* r); |
| 423 |
389 static void Log(const param_type& p, std::wstring* l); | 424 static void Log(const param_type& p, std::wstring* l); |
390 }; | 425 }; |
391 | 426 |
392 } // namespace IPC | 427 } // namespace IPC |
393 | 428 |
394 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ | 429 #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |