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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/render_messages.h
===================================================================
--- chrome/common/render_messages.h (revision 8273)
+++ chrome/common/render_messages.h (working copy)
@@ -123,7 +123,7 @@
// could be used for more contextual actions.
struct ViewHostMsg_ContextMenu_Params {
// This is the type of Context Node that the context menu was invoked on.
- ContextNode::Type type;
+ ContextNode node;
// These values represent the coordinates of the mouse when the context menu
// was invoked. Coords are relative to the associated RenderView's origin.
@@ -542,16 +542,57 @@
};
template <>
-struct ParamTraits<ContextNode::Type> {
- typedef ContextNode::Type param_type;
+struct ParamTraits<ContextNode> {
+ typedef ContextNode param_type;
static void Write(Message* m, const param_type& p) {
+ m->WriteInt(p.type);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ *p = ContextNode(type);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring event = L"";
+
+ if (!p.type)
+ event.append(L"NONE");
+ else {
+ event.append(L"(");
+ if (p.type & ContextNode::PAGE)
+ event.append(L"PAGE|");
+ if (p.type & ContextNode::FRAME)
+ event.append(L"FRAME|");
+ if (p.type & ContextNode::LINK)
+ event.append(L"LINK|");
+ if (p.type & ContextNode::IMAGE)
+ event.append(L"IMAGE|");
+ if (p.type & ContextNode::SELECTION)
+ event.append(L"SELECTION|");
+ if (p.type & ContextNode::EDITABLE)
+ event.append(L"EDITABLE|");
+ if (p.type & ContextNode::MISSPELLED_WORD)
+ event.append(L"MISSPELLED_WORD|");
+ event.append(L")");
+ }
+
+ LogParam(event, l);
+ }
+};
+
+template <>
+struct ParamTraits<WebInputEvent::Type> {
+ typedef WebInputEvent::Type param_type;
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type))
return false;
- *p = ContextNode::FromInt(type);
+ *p = static_cast<WebInputEvent::Type>(type);
return true;
}
static void Log(const param_type& p, std::wstring* l) {
@@ -590,58 +631,6 @@
}
};
-template <>
-struct ParamTraits<WebInputEvent::Type> {
- typedef WebInputEvent::Type param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteInt(p);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<WebInputEvent::Type>(type);
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- std::wstring event;
- switch (p) {
- case ContextNode::NONE:
- event = L"NONE";
- break;
- case ContextNode::PAGE:
- event = L"PAGE";
- break;
- case ContextNode::FRAME:
- event = L"FRAME";
- break;
- case ContextNode::LINK:
- event = L"LINK";
- break;
- case ContextNode::IMAGE:
- event = L"IMAGE";
- break;
- case ContextNode::IMAGE_LINK:
- event = L"IMAGE_LINK";
- break;
- case ContextNode::SELECTION:
- event = L"SELECTION";
- break;
- case ContextNode::EDITABLE:
- event = L"EDITABLE";
- break;
- case ContextNode::MISPELLED_WORD:
- event = L"MISPELLED_WORD";
- break;
- default:
- event = L"UNKNOWN";
- break;
- }
-
- LogParam(event, l);
- }
-};
-
// Traits for ViewMsg_Accessibility_In_Params structure to pack/unpack.
template <>
struct ParamTraits<ViewMsg_Accessibility_In_Params> {
@@ -942,7 +931,7 @@
struct ParamTraits<ViewHostMsg_ContextMenu_Params> {
typedef ViewHostMsg_ContextMenu_Params param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.type);
+ WriteParam(m, p.node);
WriteParam(m, p.x);
WriteParam(m, p.y);
WriteParam(m, p.link_url);
@@ -958,7 +947,7 @@
}
static bool Read(const Message* m, void** iter, param_type* p) {
return
- ReadParam(m, iter, &p->type) &&
+ ReadParam(m, iter, &p->node) &&
ReadParam(m, iter, &p->x) &&
ReadParam(m, iter, &p->y) &&
ReadParam(m, iter, &p->link_url) &&
« 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