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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/render_messages.h
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 41b946653ab1a105f7ecc1a5d33516f49b4a1e79..856214f8036a9167bc9f051a999ae650cd4c73f5 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -483,8 +483,8 @@ struct ParamTraits<FilterPolicy::Type> {
};
template <>
-struct ParamTraits<ContextNode> {
- typedef ContextNode param_type;
+struct ParamTraits<ContextNodeType> {
+ typedef ContextNodeType param_type;
static void Write(Message* m, const param_type& p) {
m->WriteInt(p.type);
}
@@ -492,7 +492,7 @@ struct ParamTraits<ContextNode> {
int type;
if (!m->ReadInt(iter, &type))
return false;
- *p = ContextNode(type);
+ *p = ContextNodeType(type);
return true;
}
static void Log(const param_type& p, std::wstring* l) {
@@ -502,19 +502,19 @@ struct ParamTraits<ContextNode> {
event.append(L"NONE");
} else {
event.append(L"(");
- if (p.type & ContextNode::PAGE)
+ if (p.type & ContextNodeType::PAGE)
event.append(L"PAGE|");
- if (p.type & ContextNode::FRAME)
+ if (p.type & ContextNodeType::FRAME)
event.append(L"FRAME|");
- if (p.type & ContextNode::LINK)
+ if (p.type & ContextNodeType::LINK)
event.append(L"LINK|");
- if (p.type & ContextNode::IMAGE)
+ if (p.type & ContextNodeType::IMAGE)
event.append(L"IMAGE|");
- if (p.type & ContextNode::SELECTION)
+ if (p.type & ContextNodeType::SELECTION)
event.append(L"SELECTION|");
- if (p.type & ContextNode::EDITABLE)
+ if (p.type & ContextNodeType::EDITABLE)
event.append(L"EDITABLE|");
- if (p.type & ContextNode::MISSPELLED_WORD)
+ if (p.type & ContextNodeType::MISSPELLED_WORD)
event.append(L"MISSPELLED_WORD|");
event.append(L")");
}
@@ -837,7 +837,7 @@ template <>
struct ParamTraits<ContextMenuParams> {
typedef ContextMenuParams param_type;
static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.node);
+ WriteParam(m, p.node_type);
WriteParam(m, p.x);
WriteParam(m, p.y);
WriteParam(m, p.link_url);
@@ -856,7 +856,7 @@ struct ParamTraits<ContextMenuParams> {
}
static bool Read(const Message* m, void** iter, param_type* p) {
return
- ReadParam(m, iter, &p->node) &&
+ ReadParam(m, iter, &p->node_type) &&
ReadParam(m, iter, &p->x) &&
ReadParam(m, iter, &p->y) &&
ReadParam(m, iter, &p->link_url) &&
@@ -878,6 +878,46 @@ struct ParamTraits<ContextMenuParams> {
}
};
+template <>
+struct ParamTraits<MediaPlayerAction> {
+ typedef MediaPlayerAction param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.command);
+ WriteParam(m, p.playback_rate);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->command) &&
+ ReadParam(m, iter, &p->playback_rate);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring event = L"";
+ if (!p.command) {
+ l->append(L"NONE");
+ } else {
+ l->append(L"(");
+ if (p.command & MediaPlayerAction::PLAY)
+ l->append(L"PLAY|");
+ if (p.command & MediaPlayerAction::PAUSE)
+ l->append(L"PAUSE|");
+ if (p.command & MediaPlayerAction::MUTE)
+ l->append(L"MUTE|");
+ if (p.command & MediaPlayerAction::UNMUTE)
+ l->append(L"UNMUTE|");
+ if (p.command & MediaPlayerAction::LOOP)
+ l->append(L"LOOP|");
+ if (p.command & MediaPlayerAction::NO_LOOP)
+ l->append(L"NO_LOOP|");
+ if (p.command & MediaPlayerAction::SET_PLAYBACK_RATE) {
+ l->append(L"SET_PLAYBACK_RATE [");
+ LogParam(p.playback_rate, l);
+ l->append(L"]|");
+ }
+ l->append(L")");
+ }
+ }
+};
+
// Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack.
template <>
struct ParamTraits<ViewHostMsg_PaintRect_Params> {
« 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