Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: chrome/common/render_messages.h

Issue 155954: Implement sending actions back to the render for media element context menus. (Closed)
Patch Set: remove uneeded bits. Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 default: 476 default:
477 type = L"UNKNOWN"; 477 type = L"UNKNOWN";
478 break; 478 break;
479 } 479 }
480 480
481 LogParam(type, l); 481 LogParam(type, l);
482 } 482 }
483 }; 483 };
484 484
485 template <> 485 template <>
486 struct ParamTraits<ContextNode> { 486 struct ParamTraits<ContextNodeType> {
487 typedef ContextNode param_type; 487 typedef ContextNodeType param_type;
488 static void Write(Message* m, const param_type& p) { 488 static void Write(Message* m, const param_type& p) {
489 m->WriteInt(p.type); 489 m->WriteInt(p.type);
490 } 490 }
491 static bool Read(const Message* m, void** iter, param_type* p) { 491 static bool Read(const Message* m, void** iter, param_type* p) {
492 int type; 492 int type;
493 if (!m->ReadInt(iter, &type)) 493 if (!m->ReadInt(iter, &type))
494 return false; 494 return false;
495 *p = ContextNode(type); 495 *p = ContextNodeType(type);
496 return true; 496 return true;
497 } 497 }
498 static void Log(const param_type& p, std::wstring* l) { 498 static void Log(const param_type& p, std::wstring* l) {
499 std::wstring event = L""; 499 std::wstring event = L"";
500 500
501 if (!p.type) { 501 if (!p.type) {
502 event.append(L"NONE"); 502 event.append(L"NONE");
503 } else { 503 } else {
504 event.append(L"("); 504 event.append(L"(");
505 if (p.type & ContextNode::PAGE) 505 if (p.type & ContextNodeType::PAGE)
506 event.append(L"PAGE|"); 506 event.append(L"PAGE|");
507 if (p.type & ContextNode::FRAME) 507 if (p.type & ContextNodeType::FRAME)
508 event.append(L"FRAME|"); 508 event.append(L"FRAME|");
509 if (p.type & ContextNode::LINK) 509 if (p.type & ContextNodeType::LINK)
510 event.append(L"LINK|"); 510 event.append(L"LINK|");
511 if (p.type & ContextNode::IMAGE) 511 if (p.type & ContextNodeType::IMAGE)
512 event.append(L"IMAGE|"); 512 event.append(L"IMAGE|");
513 if (p.type & ContextNode::SELECTION) 513 if (p.type & ContextNodeType::SELECTION)
514 event.append(L"SELECTION|"); 514 event.append(L"SELECTION|");
515 if (p.type & ContextNode::EDITABLE) 515 if (p.type & ContextNodeType::EDITABLE)
516 event.append(L"EDITABLE|"); 516 event.append(L"EDITABLE|");
517 if (p.type & ContextNode::MISSPELLED_WORD) 517 if (p.type & ContextNodeType::MISSPELLED_WORD)
518 event.append(L"MISSPELLED_WORD|"); 518 event.append(L"MISSPELLED_WORD|");
519 event.append(L")"); 519 event.append(L")");
520 } 520 }
521 521
522 LogParam(event, l); 522 LogParam(event, l);
523 } 523 }
524 }; 524 };
525 525
526 template <> 526 template <>
527 struct ParamTraits<webkit_glue::WebAccessibility::InParams> { 527 struct ParamTraits<webkit_glue::WebAccessibility::InParams> {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 return 830 return
831 ReadParam(m, iter, &p->player_state) && 831 ReadParam(m, iter, &p->player_state) &&
832 ReadParam(m, iter, &p->playback_rate); 832 ReadParam(m, iter, &p->playback_rate);
833 } 833 }
834 }; 834 };
835 835
836 template <> 836 template <>
837 struct ParamTraits<ContextMenuParams> { 837 struct ParamTraits<ContextMenuParams> {
838 typedef ContextMenuParams param_type; 838 typedef ContextMenuParams param_type;
839 static void Write(Message* m, const param_type& p) { 839 static void Write(Message* m, const param_type& p) {
840 WriteParam(m, p.node); 840 WriteParam(m, p.node_type);
841 WriteParam(m, p.x); 841 WriteParam(m, p.x);
842 WriteParam(m, p.y); 842 WriteParam(m, p.y);
843 WriteParam(m, p.link_url); 843 WriteParam(m, p.link_url);
844 WriteParam(m, p.unfiltered_link_url); 844 WriteParam(m, p.unfiltered_link_url);
845 WriteParam(m, p.src_url); 845 WriteParam(m, p.src_url);
846 WriteParam(m, p.page_url); 846 WriteParam(m, p.page_url);
847 WriteParam(m, p.frame_url); 847 WriteParam(m, p.frame_url);
848 WriteParam(m, p.media_params); 848 WriteParam(m, p.media_params);
849 WriteParam(m, p.selection_text); 849 WriteParam(m, p.selection_text);
850 WriteParam(m, p.misspelled_word); 850 WriteParam(m, p.misspelled_word);
851 WriteParam(m, p.dictionary_suggestions); 851 WriteParam(m, p.dictionary_suggestions);
852 WriteParam(m, p.spellcheck_enabled); 852 WriteParam(m, p.spellcheck_enabled);
853 WriteParam(m, p.edit_flags); 853 WriteParam(m, p.edit_flags);
854 WriteParam(m, p.security_info); 854 WriteParam(m, p.security_info);
855 WriteParam(m, p.frame_charset); 855 WriteParam(m, p.frame_charset);
856 } 856 }
857 static bool Read(const Message* m, void** iter, param_type* p) { 857 static bool Read(const Message* m, void** iter, param_type* p) {
858 return 858 return
859 ReadParam(m, iter, &p->node) && 859 ReadParam(m, iter, &p->node_type) &&
860 ReadParam(m, iter, &p->x) && 860 ReadParam(m, iter, &p->x) &&
861 ReadParam(m, iter, &p->y) && 861 ReadParam(m, iter, &p->y) &&
862 ReadParam(m, iter, &p->link_url) && 862 ReadParam(m, iter, &p->link_url) &&
863 ReadParam(m, iter, &p->unfiltered_link_url) && 863 ReadParam(m, iter, &p->unfiltered_link_url) &&
864 ReadParam(m, iter, &p->src_url) && 864 ReadParam(m, iter, &p->src_url) &&
865 ReadParam(m, iter, &p->page_url) && 865 ReadParam(m, iter, &p->page_url) &&
866 ReadParam(m, iter, &p->frame_url) && 866 ReadParam(m, iter, &p->frame_url) &&
867 ReadParam(m, iter, &p->media_params) && 867 ReadParam(m, iter, &p->media_params) &&
868 ReadParam(m, iter, &p->selection_text) && 868 ReadParam(m, iter, &p->selection_text) &&
869 ReadParam(m, iter, &p->misspelled_word) && 869 ReadParam(m, iter, &p->misspelled_word) &&
870 ReadParam(m, iter, &p->dictionary_suggestions) && 870 ReadParam(m, iter, &p->dictionary_suggestions) &&
871 ReadParam(m, iter, &p->spellcheck_enabled) && 871 ReadParam(m, iter, &p->spellcheck_enabled) &&
872 ReadParam(m, iter, &p->edit_flags) && 872 ReadParam(m, iter, &p->edit_flags) &&
873 ReadParam(m, iter, &p->security_info) && 873 ReadParam(m, iter, &p->security_info) &&
874 ReadParam(m, iter, &p->frame_charset); 874 ReadParam(m, iter, &p->frame_charset);
875 } 875 }
876 static void Log(const param_type& p, std::wstring* l) { 876 static void Log(const param_type& p, std::wstring* l) {
877 l->append(L"<ContextMenuParams>"); 877 l->append(L"<ContextMenuParams>");
878 } 878 }
879 }; 879 };
880 880
881 template <>
882 struct ParamTraits<MediaPlayerAction> {
883 typedef MediaPlayerAction param_type;
884 static void Write(Message* m, const param_type& p) {
885 WriteParam(m, p.command);
886 WriteParam(m, p.playback_rate);
887 }
888 static bool Read(const Message* m, void** iter, param_type* p) {
889 return
890 ReadParam(m, iter, &p->command) &&
891 ReadParam(m, iter, &p->playback_rate);
892 }
893 static void Log(const param_type& p, std::wstring* l) {
894 std::wstring event = L"";
895 if (!p.command) {
896 l->append(L"NONE");
897 } else {
898 l->append(L"(");
899 if (p.command & MediaPlayerAction::PLAY)
900 l->append(L"PLAY|");
901 if (p.command & MediaPlayerAction::PAUSE)
902 l->append(L"PAUSE|");
903 if (p.command & MediaPlayerAction::MUTE)
904 l->append(L"MUTE|");
905 if (p.command & MediaPlayerAction::UNMUTE)
906 l->append(L"UNMUTE|");
907 if (p.command & MediaPlayerAction::LOOP)
908 l->append(L"LOOP|");
909 if (p.command & MediaPlayerAction::NO_LOOP)
910 l->append(L"NO_LOOP|");
911 if (p.command & MediaPlayerAction::SET_PLAYBACK_RATE) {
912 l->append(L"SET_PLAYBACK_RATE [");
913 LogParam(p.playback_rate, l);
914 l->append(L"]|");
915 }
916 l->append(L")");
917 }
918 }
919 };
920
881 // Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack. 921 // Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack.
882 template <> 922 template <>
883 struct ParamTraits<ViewHostMsg_PaintRect_Params> { 923 struct ParamTraits<ViewHostMsg_PaintRect_Params> {
884 typedef ViewHostMsg_PaintRect_Params param_type; 924 typedef ViewHostMsg_PaintRect_Params param_type;
885 static void Write(Message* m, const param_type& p) { 925 static void Write(Message* m, const param_type& p) {
886 WriteParam(m, p.bitmap); 926 WriteParam(m, p.bitmap);
887 WriteParam(m, p.bitmap_rect); 927 WriteParam(m, p.bitmap_rect);
888 WriteParam(m, p.view_size); 928 WriteParam(m, p.view_size);
889 WriteParam(m, p.plugin_window_moves); 929 WriteParam(m, p.plugin_window_moves);
890 WriteParam(m, p.flags); 930 WriteParam(m, p.flags);
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 }; 1961 };
1922 1962
1923 1963
1924 } // namespace IPC 1964 } // namespace IPC
1925 1965
1926 1966
1927 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" 1967 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h"
1928 #include "chrome/common/ipc_message_macros.h" 1968 #include "chrome/common/ipc_message_macros.h"
1929 1969
1930 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ 1970 #endif // CHROME_COMMON_RENDER_MESSAGES_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/tab_contents/render_view_context_menu_win.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698