| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 CHROME_COMMON_RENDER_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ |
| 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 default: | 513 default: |
| 514 type = L"UNKNOWN"; | 514 type = L"UNKNOWN"; |
| 515 break; | 515 break; |
| 516 } | 516 } |
| 517 | 517 |
| 518 LogParam(type, l); | 518 LogParam(type, l); |
| 519 } | 519 } |
| 520 }; | 520 }; |
| 521 | 521 |
| 522 template <> | 522 template <> |
| 523 struct ParamTraits<ContextNode> { | 523 struct ParamTraits<ContextNodeType> { |
| 524 typedef ContextNode param_type; | 524 typedef ContextNodeType param_type; |
| 525 static void Write(Message* m, const param_type& p) { | 525 static void Write(Message* m, const param_type& p) { |
| 526 m->WriteInt(p.type); | 526 m->WriteInt(p.type); |
| 527 } | 527 } |
| 528 static bool Read(const Message* m, void** iter, param_type* p) { | 528 static bool Read(const Message* m, void** iter, param_type* p) { |
| 529 int type; | 529 int type; |
| 530 if (!m->ReadInt(iter, &type)) | 530 if (!m->ReadInt(iter, &type)) |
| 531 return false; | 531 return false; |
| 532 *p = ContextNode(type); | 532 *p = ContextNodeType(type); |
| 533 return true; | 533 return true; |
| 534 } | 534 } |
| 535 static void Log(const param_type& p, std::wstring* l) { | 535 static void Log(const param_type& p, std::wstring* l) { |
| 536 std::wstring event = L""; | 536 std::wstring event = L""; |
| 537 | 537 |
| 538 if (!p.type) { | 538 if (!p.type) { |
| 539 event.append(L"NONE"); | 539 event.append(L"NONE"); |
| 540 } else { | 540 } else { |
| 541 event.append(L"("); | 541 event.append(L"("); |
| 542 if (p.type & ContextNode::PAGE) | 542 if (p.type & ContextNodeType::PAGE) |
| 543 event.append(L"PAGE|"); | 543 event.append(L"PAGE|"); |
| 544 if (p.type & ContextNode::FRAME) | 544 if (p.type & ContextNodeType::FRAME) |
| 545 event.append(L"FRAME|"); | 545 event.append(L"FRAME|"); |
| 546 if (p.type & ContextNode::LINK) | 546 if (p.type & ContextNodeType::LINK) |
| 547 event.append(L"LINK|"); | 547 event.append(L"LINK|"); |
| 548 if (p.type & ContextNode::IMAGE) | 548 if (p.type & ContextNodeType::IMAGE) |
| 549 event.append(L"IMAGE|"); | 549 event.append(L"IMAGE|"); |
| 550 if (p.type & ContextNode::SELECTION) | 550 if (p.type & ContextNodeType::SELECTION) |
| 551 event.append(L"SELECTION|"); | 551 event.append(L"SELECTION|"); |
| 552 if (p.type & ContextNode::EDITABLE) | 552 if (p.type & ContextNodeType::EDITABLE) |
| 553 event.append(L"EDITABLE|"); | 553 event.append(L"EDITABLE|"); |
| 554 if (p.type & ContextNode::MISSPELLED_WORD) | 554 if (p.type & ContextNodeType::MISSPELLED_WORD) |
| 555 event.append(L"MISSPELLED_WORD|"); | 555 event.append(L"MISSPELLED_WORD|"); |
| 556 event.append(L")"); | 556 event.append(L")"); |
| 557 } | 557 } |
| 558 | 558 |
| 559 LogParam(event, l); | 559 LogParam(event, l); |
| 560 } | 560 } |
| 561 }; | 561 }; |
| 562 | 562 |
| 563 template <> | 563 template <> |
| 564 struct ParamTraits<webkit_glue::WebAccessibility::InParams> { | 564 struct ParamTraits<webkit_glue::WebAccessibility::InParams> { |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 return | 867 return |
| 868 ReadParam(m, iter, &p->player_state) && | 868 ReadParam(m, iter, &p->player_state) && |
| 869 ReadParam(m, iter, &p->playback_rate); | 869 ReadParam(m, iter, &p->playback_rate); |
| 870 } | 870 } |
| 871 }; | 871 }; |
| 872 | 872 |
| 873 template <> | 873 template <> |
| 874 struct ParamTraits<ContextMenuParams> { | 874 struct ParamTraits<ContextMenuParams> { |
| 875 typedef ContextMenuParams param_type; | 875 typedef ContextMenuParams param_type; |
| 876 static void Write(Message* m, const param_type& p) { | 876 static void Write(Message* m, const param_type& p) { |
| 877 WriteParam(m, p.node); | 877 WriteParam(m, p.node_type); |
| 878 WriteParam(m, p.x); | 878 WriteParam(m, p.x); |
| 879 WriteParam(m, p.y); | 879 WriteParam(m, p.y); |
| 880 WriteParam(m, p.link_url); | 880 WriteParam(m, p.link_url); |
| 881 WriteParam(m, p.unfiltered_link_url); | 881 WriteParam(m, p.unfiltered_link_url); |
| 882 WriteParam(m, p.src_url); | 882 WriteParam(m, p.src_url); |
| 883 WriteParam(m, p.page_url); | 883 WriteParam(m, p.page_url); |
| 884 WriteParam(m, p.frame_url); | 884 WriteParam(m, p.frame_url); |
| 885 WriteParam(m, p.media_params); | 885 WriteParam(m, p.media_params); |
| 886 WriteParam(m, p.selection_text); | 886 WriteParam(m, p.selection_text); |
| 887 WriteParam(m, p.misspelled_word); | 887 WriteParam(m, p.misspelled_word); |
| 888 WriteParam(m, p.dictionary_suggestions); | 888 WriteParam(m, p.dictionary_suggestions); |
| 889 WriteParam(m, p.spellcheck_enabled); | 889 WriteParam(m, p.spellcheck_enabled); |
| 890 WriteParam(m, p.edit_flags); | 890 WriteParam(m, p.edit_flags); |
| 891 WriteParam(m, p.security_info); | 891 WriteParam(m, p.security_info); |
| 892 WriteParam(m, p.frame_charset); | 892 WriteParam(m, p.frame_charset); |
| 893 } | 893 } |
| 894 static bool Read(const Message* m, void** iter, param_type* p) { | 894 static bool Read(const Message* m, void** iter, param_type* p) { |
| 895 return | 895 return |
| 896 ReadParam(m, iter, &p->node) && | 896 ReadParam(m, iter, &p->node_type) && |
| 897 ReadParam(m, iter, &p->x) && | 897 ReadParam(m, iter, &p->x) && |
| 898 ReadParam(m, iter, &p->y) && | 898 ReadParam(m, iter, &p->y) && |
| 899 ReadParam(m, iter, &p->link_url) && | 899 ReadParam(m, iter, &p->link_url) && |
| 900 ReadParam(m, iter, &p->unfiltered_link_url) && | 900 ReadParam(m, iter, &p->unfiltered_link_url) && |
| 901 ReadParam(m, iter, &p->src_url) && | 901 ReadParam(m, iter, &p->src_url) && |
| 902 ReadParam(m, iter, &p->page_url) && | 902 ReadParam(m, iter, &p->page_url) && |
| 903 ReadParam(m, iter, &p->frame_url) && | 903 ReadParam(m, iter, &p->frame_url) && |
| 904 ReadParam(m, iter, &p->media_params) && | 904 ReadParam(m, iter, &p->media_params) && |
| 905 ReadParam(m, iter, &p->selection_text) && | 905 ReadParam(m, iter, &p->selection_text) && |
| 906 ReadParam(m, iter, &p->misspelled_word) && | 906 ReadParam(m, iter, &p->misspelled_word) && |
| 907 ReadParam(m, iter, &p->dictionary_suggestions) && | 907 ReadParam(m, iter, &p->dictionary_suggestions) && |
| 908 ReadParam(m, iter, &p->spellcheck_enabled) && | 908 ReadParam(m, iter, &p->spellcheck_enabled) && |
| 909 ReadParam(m, iter, &p->edit_flags) && | 909 ReadParam(m, iter, &p->edit_flags) && |
| 910 ReadParam(m, iter, &p->security_info) && | 910 ReadParam(m, iter, &p->security_info) && |
| 911 ReadParam(m, iter, &p->frame_charset); | 911 ReadParam(m, iter, &p->frame_charset); |
| 912 } | 912 } |
| 913 static void Log(const param_type& p, std::wstring* l) { | 913 static void Log(const param_type& p, std::wstring* l) { |
| 914 l->append(L"<ContextMenuParams>"); | 914 l->append(L"<ContextMenuParams>"); |
| 915 } | 915 } |
| 916 }; | 916 }; |
| 917 | 917 |
| 918 template <> |
| 919 struct ParamTraits<MediaPlayerAction> { |
| 920 typedef MediaPlayerAction param_type; |
| 921 static void Write(Message* m, const param_type& p) { |
| 922 WriteParam(m, p.command); |
| 923 WriteParam(m, p.playback_rate); |
| 924 } |
| 925 static bool Read(const Message* m, void** iter, param_type* p) { |
| 926 return |
| 927 ReadParam(m, iter, &p->command) && |
| 928 ReadParam(m, iter, &p->playback_rate); |
| 929 } |
| 930 static void Log(const param_type& p, std::wstring* l) { |
| 931 std::wstring event = L""; |
| 932 if (!p.command) { |
| 933 l->append(L"NONE"); |
| 934 } else { |
| 935 l->append(L"("); |
| 936 if (p.command & MediaPlayerAction::PLAY) |
| 937 l->append(L"PLAY|"); |
| 938 if (p.command & MediaPlayerAction::PAUSE) |
| 939 l->append(L"PAUSE|"); |
| 940 if (p.command & MediaPlayerAction::MUTE) |
| 941 l->append(L"MUTE|"); |
| 942 if (p.command & MediaPlayerAction::UNMUTE) |
| 943 l->append(L"UNMUTE|"); |
| 944 if (p.command & MediaPlayerAction::LOOP) |
| 945 l->append(L"LOOP|"); |
| 946 if (p.command & MediaPlayerAction::NO_LOOP) |
| 947 l->append(L"NO_LOOP|"); |
| 948 if (p.command & MediaPlayerAction::SET_PLAYBACK_RATE) { |
| 949 l->append(L"SET_PLAYBACK_RATE ["); |
| 950 LogParam(p.playback_rate, l); |
| 951 l->append(L"]|"); |
| 952 } |
| 953 l->append(L")"); |
| 954 } |
| 955 } |
| 956 }; |
| 957 |
| 918 // Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack. | 958 // Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack. |
| 919 template <> | 959 template <> |
| 920 struct ParamTraits<ViewHostMsg_PaintRect_Params> { | 960 struct ParamTraits<ViewHostMsg_PaintRect_Params> { |
| 921 typedef ViewHostMsg_PaintRect_Params param_type; | 961 typedef ViewHostMsg_PaintRect_Params param_type; |
| 922 static void Write(Message* m, const param_type& p) { | 962 static void Write(Message* m, const param_type& p) { |
| 923 WriteParam(m, p.bitmap); | 963 WriteParam(m, p.bitmap); |
| 924 WriteParam(m, p.bitmap_rect); | 964 WriteParam(m, p.bitmap_rect); |
| 925 WriteParam(m, p.view_size); | 965 WriteParam(m, p.view_size); |
| 926 WriteParam(m, p.plugin_window_moves); | 966 WriteParam(m, p.plugin_window_moves); |
| 927 WriteParam(m, p.flags); | 967 WriteParam(m, p.flags); |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 }; | 2037 }; |
| 1998 | 2038 |
| 1999 | 2039 |
| 2000 } // namespace IPC | 2040 } // namespace IPC |
| 2001 | 2041 |
| 2002 | 2042 |
| 2003 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" | 2043 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" |
| 2004 #include "ipc/ipc_message_macros.h" | 2044 #include "ipc/ipc_message_macros.h" |
| 2005 | 2045 |
| 2006 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 2046 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
| OLD | NEW |