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

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

Issue 16510: Fixes bug 1925 (context menus for text selections in... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/web_contents_view_win.cc ('k') | chrome/renderer/render_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 // Parameters structure for ViewHostMsg_ContextMenu, which has too many data 117 // Parameters structure for ViewHostMsg_ContextMenu, which has too many data
118 // parameters to be reasonably put in a predefined IPC message. 118 // parameters to be reasonably put in a predefined IPC message.
119 // FIXME(beng): This would be more useful in the future and more efficient 119 // FIXME(beng): This would be more useful in the future and more efficient
120 // if the parameters here weren't so literally mapped to what 120 // if the parameters here weren't so literally mapped to what
121 // they contain for the ContextMenu task. It might be better 121 // they contain for the ContextMenu task. It might be better
122 // to make the string fields more generic so that this object 122 // to make the string fields more generic so that this object
123 // could be used for more contextual actions. 123 // could be used for more contextual actions.
124 struct ViewHostMsg_ContextMenu_Params { 124 struct ViewHostMsg_ContextMenu_Params {
125 // This is the type of Context Node that the context menu was invoked on. 125 // This is the type of Context Node that the context menu was invoked on.
126 ContextNode::Type type; 126 ContextNode node;
127 127
128 // These values represent the coordinates of the mouse when the context menu 128 // These values represent the coordinates of the mouse when the context menu
129 // was invoked. Coords are relative to the associated RenderView's origin. 129 // was invoked. Coords are relative to the associated RenderView's origin.
130 int x; 130 int x;
131 int y; 131 int y;
132 132
133 // This is the URL of the link that encloses the node the context menu was 133 // This is the URL of the link that encloses the node the context menu was
134 // invoked on. 134 // invoked on.
135 GURL link_url; 135 GURL link_url;
136 136
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 default: 535 default:
536 type = L"UNKNOWN"; 536 type = L"UNKNOWN";
537 break; 537 break;
538 } 538 }
539 539
540 LogParam(type, l); 540 LogParam(type, l);
541 } 541 }
542 }; 542 };
543 543
544 template <> 544 template <>
545 struct ParamTraits<ContextNode::Type> { 545 struct ParamTraits<ContextNode> {
546 typedef ContextNode::Type param_type; 546 typedef ContextNode param_type;
547 static void Write(Message* m, const param_type& p) {
548 m->WriteInt(p.type);
549 }
550 static bool Read(const Message* m, void** iter, param_type* p) {
551 int type;
552 if (!m->ReadInt(iter, &type))
553 return false;
554 *p = ContextNode(type);
555 return true;
556 }
557 static void Log(const param_type& p, std::wstring* l) {
558 std::wstring event = L"";
559
560 if (!p.type)
561 event.append(L"NONE");
562 else {
563 event.append(L"(");
564 if (p.type & ContextNode::PAGE)
565 event.append(L"PAGE|");
566 if (p.type & ContextNode::FRAME)
567 event.append(L"FRAME|");
568 if (p.type & ContextNode::LINK)
569 event.append(L"LINK|");
570 if (p.type & ContextNode::IMAGE)
571 event.append(L"IMAGE|");
572 if (p.type & ContextNode::SELECTION)
573 event.append(L"SELECTION|");
574 if (p.type & ContextNode::EDITABLE)
575 event.append(L"EDITABLE|");
576 if (p.type & ContextNode::MISSPELLED_WORD)
577 event.append(L"MISSPELLED_WORD|");
578 event.append(L")");
579 }
580
581 LogParam(event, l);
582 }
583 };
584
585 template <>
586 struct ParamTraits<WebInputEvent::Type> {
587 typedef WebInputEvent::Type param_type;
547 static void Write(Message* m, const param_type& p) { 588 static void Write(Message* m, const param_type& p) {
548 m->WriteInt(p); 589 m->WriteInt(p);
549 } 590 }
550 static bool Read(const Message* m, void** iter, param_type* p) { 591 static bool Read(const Message* m, void** iter, param_type* p) {
551 int type; 592 int type;
552 if (!m->ReadInt(iter, &type)) 593 if (!m->ReadInt(iter, &type))
553 return false; 594 return false;
554 *p = ContextNode::FromInt(type); 595 *p = static_cast<WebInputEvent::Type>(type);
555 return true; 596 return true;
556 } 597 }
557 static void Log(const param_type& p, std::wstring* l) { 598 static void Log(const param_type& p, std::wstring* l) {
558 std::wstring type; 599 std::wstring type;
559 switch (p) { 600 switch (p) {
560 case WebInputEvent::MOUSE_DOWN: 601 case WebInputEvent::MOUSE_DOWN:
561 type = L"MOUSE_DOWN"; 602 type = L"MOUSE_DOWN";
562 break; 603 break;
563 case WebInputEvent::MOUSE_UP: 604 case WebInputEvent::MOUSE_UP:
564 type = L"MOUSE_UP"; 605 type = L"MOUSE_UP";
(...skipping 18 matching lines...) Expand all
583 break; 624 break;
584 default: 625 default:
585 type = L"UNKNOWN"; 626 type = L"UNKNOWN";
586 break; 627 break;
587 } 628 }
588 629
589 LogParam(type, l); 630 LogParam(type, l);
590 } 631 }
591 }; 632 };
592 633
593 template <>
594 struct ParamTraits<WebInputEvent::Type> {
595 typedef WebInputEvent::Type param_type;
596 static void Write(Message* m, const param_type& p) {
597 m->WriteInt(p);
598 }
599 static bool Read(const Message* m, void** iter, param_type* p) {
600 int type;
601 if (!m->ReadInt(iter, &type))
602 return false;
603 *p = static_cast<WebInputEvent::Type>(type);
604 return true;
605 }
606 static void Log(const param_type& p, std::wstring* l) {
607 std::wstring event;
608 switch (p) {
609 case ContextNode::NONE:
610 event = L"NONE";
611 break;
612 case ContextNode::PAGE:
613 event = L"PAGE";
614 break;
615 case ContextNode::FRAME:
616 event = L"FRAME";
617 break;
618 case ContextNode::LINK:
619 event = L"LINK";
620 break;
621 case ContextNode::IMAGE:
622 event = L"IMAGE";
623 break;
624 case ContextNode::IMAGE_LINK:
625 event = L"IMAGE_LINK";
626 break;
627 case ContextNode::SELECTION:
628 event = L"SELECTION";
629 break;
630 case ContextNode::EDITABLE:
631 event = L"EDITABLE";
632 break;
633 case ContextNode::MISPELLED_WORD:
634 event = L"MISPELLED_WORD";
635 break;
636 default:
637 event = L"UNKNOWN";
638 break;
639 }
640
641 LogParam(event, l);
642 }
643 };
644
645 // Traits for ViewMsg_Accessibility_In_Params structure to pack/unpack. 634 // Traits for ViewMsg_Accessibility_In_Params structure to pack/unpack.
646 template <> 635 template <>
647 struct ParamTraits<ViewMsg_Accessibility_In_Params> { 636 struct ParamTraits<ViewMsg_Accessibility_In_Params> {
648 typedef ViewMsg_Accessibility_In_Params param_type; 637 typedef ViewMsg_Accessibility_In_Params param_type;
649 static void Write(Message* m, const param_type& p) { 638 static void Write(Message* m, const param_type& p) {
650 WriteParam(m, p.iaccessible_id); 639 WriteParam(m, p.iaccessible_id);
651 WriteParam(m, p.iaccessible_function_id); 640 WriteParam(m, p.iaccessible_function_id);
652 WriteParam(m, p.input_variant_lval); 641 WriteParam(m, p.input_variant_lval);
653 WriteParam(m, p.input_long1); 642 WriteParam(m, p.input_long1);
654 WriteParam(m, p.input_long2); 643 WriteParam(m, p.input_long2);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 LogParam(p.is_content_filtered, l); 924 LogParam(p.is_content_filtered, l);
936 l->append(L")"); 925 l->append(L")");
937 } 926 }
938 }; 927 };
939 928
940 // Traits for ViewHostMsg_ContextMenu_Params structure to pack/unpack. 929 // Traits for ViewHostMsg_ContextMenu_Params structure to pack/unpack.
941 template <> 930 template <>
942 struct ParamTraits<ViewHostMsg_ContextMenu_Params> { 931 struct ParamTraits<ViewHostMsg_ContextMenu_Params> {
943 typedef ViewHostMsg_ContextMenu_Params param_type; 932 typedef ViewHostMsg_ContextMenu_Params param_type;
944 static void Write(Message* m, const param_type& p) { 933 static void Write(Message* m, const param_type& p) {
945 WriteParam(m, p.type); 934 WriteParam(m, p.node);
946 WriteParam(m, p.x); 935 WriteParam(m, p.x);
947 WriteParam(m, p.y); 936 WriteParam(m, p.y);
948 WriteParam(m, p.link_url); 937 WriteParam(m, p.link_url);
949 WriteParam(m, p.image_url); 938 WriteParam(m, p.image_url);
950 WriteParam(m, p.page_url); 939 WriteParam(m, p.page_url);
951 WriteParam(m, p.frame_url); 940 WriteParam(m, p.frame_url);
952 WriteParam(m, p.selection_text); 941 WriteParam(m, p.selection_text);
953 WriteParam(m, p.misspelled_word); 942 WriteParam(m, p.misspelled_word);
954 WriteParam(m, p.dictionary_suggestions); 943 WriteParam(m, p.dictionary_suggestions);
955 WriteParam(m, p.spellcheck_enabled); 944 WriteParam(m, p.spellcheck_enabled);
956 WriteParam(m, p.edit_flags); 945 WriteParam(m, p.edit_flags);
957 WriteParam(m, p.security_info); 946 WriteParam(m, p.security_info);
958 } 947 }
959 static bool Read(const Message* m, void** iter, param_type* p) { 948 static bool Read(const Message* m, void** iter, param_type* p) {
960 return 949 return
961 ReadParam(m, iter, &p->type) && 950 ReadParam(m, iter, &p->node) &&
962 ReadParam(m, iter, &p->x) && 951 ReadParam(m, iter, &p->x) &&
963 ReadParam(m, iter, &p->y) && 952 ReadParam(m, iter, &p->y) &&
964 ReadParam(m, iter, &p->link_url) && 953 ReadParam(m, iter, &p->link_url) &&
965 ReadParam(m, iter, &p->image_url) && 954 ReadParam(m, iter, &p->image_url) &&
966 ReadParam(m, iter, &p->page_url) && 955 ReadParam(m, iter, &p->page_url) &&
967 ReadParam(m, iter, &p->frame_url) && 956 ReadParam(m, iter, &p->frame_url) &&
968 ReadParam(m, iter, &p->selection_text) && 957 ReadParam(m, iter, &p->selection_text) &&
969 ReadParam(m, iter, &p->misspelled_word) && 958 ReadParam(m, iter, &p->misspelled_word) &&
970 ReadParam(m, iter, &p->dictionary_suggestions) && 959 ReadParam(m, iter, &p->dictionary_suggestions) &&
971 ReadParam(m, iter, &p->spellcheck_enabled) && 960 ReadParam(m, iter, &p->spellcheck_enabled) &&
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 ReadParam(m, iter, &p->available_rect); 1708 ReadParam(m, iter, &p->available_rect);
1720 } 1709 }
1721 static void Log(const param_type& p, std::wstring* l) { 1710 static void Log(const param_type& p, std::wstring* l) {
1722 l->append(L"<webkit_glue::ScreenInfo>"); 1711 l->append(L"<webkit_glue::ScreenInfo>");
1723 } 1712 }
1724 }; 1713 };
1725 1714
1726 } // namespace IPC 1715 } // namespace IPC
1727 1716
1728 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ 1717 #endif // CHROME_COMMON_RENDER_MESSAGES_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_contents_view_win.cc ('k') | chrome/renderer/render_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698