diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 05:50:28 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 05:50:28 +0000 |
commit | 952cb7063b41fc2afaa9d1c265d38158b0e7d3e0 (patch) | |
tree | a454f8e01ee6ce946e475f8451ba4e1fd1407007 /chrome/common | |
parent | 71cd6a943b2b677adabbafdd12b2e024106e78f6 (diff) | |
download | chromium_src-952cb7063b41fc2afaa9d1c265d38158b0e7d3e0.zip chromium_src-952cb7063b41fc2afaa9d1c265d38158b0e7d3e0.tar.gz chromium_src-952cb7063b41fc2afaa9d1c265d38158b0e7d3e0.tar.bz2 |
Move MediaPlayerAction to WebMediaPlayerAction. Switch to an enum and a
boolean to express the action.
R=ajwong
BUG=10033
TEST=none
Review URL: http://codereview.chromium.org/251103
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/render_messages.h | 34 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 9 | ||||
-rw-r--r-- | chrome/common/webkit_param_traits.h | 39 |
3 files changed, 42 insertions, 40 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index afce5d9..5a6b335 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -37,7 +37,6 @@ #include "webkit/glue/autofill_form.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/form_data.h" -#include "webkit/glue/media_player_action.h" #include "webkit/glue/password_form.h" #include "webkit/glue/password_form_dom_manager.h" #include "webkit/glue/resource_loader_bridge.h" @@ -953,39 +952,6 @@ struct ParamTraits<ContextMenuParams> { } }; -template <> -struct ParamTraits<MediaPlayerAction> { - typedef MediaPlayerAction param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.command); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->command); - } - 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|"); - l->append(L")"); - } - } -}; - // Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack. template <> struct ParamTraits<ViewHostMsg_PaintRect_Params> { diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 006118e..9ec8ca9 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -93,11 +93,10 @@ IPC_BEGIN_MESSAGES(View) RendererPreferences) // Tells the renderer to perform the given action on the media player - // located at |x|, |y|. - IPC_MESSAGE_ROUTED3(ViewMsg_MediaPlayerActionAt, - int32 /* x */, - int32 /* y */, - MediaPlayerAction) + // located at the given point. + IPC_MESSAGE_ROUTED2(ViewMsg_MediaPlayerActionAt, + gfx::Point, /* location */ + WebKit::WebMediaPlayerAction) // Tells the render view to close. IPC_MESSAGE_ROUTED0(ViewMsg_Close) diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h index 335ba9e..8a32741 100644 --- a/chrome/common/webkit_param_traits.h +++ b/chrome/common/webkit_param_traits.h @@ -30,6 +30,7 @@ #include "webkit/api/public/WebDragOperation.h" #include "webkit/api/public/WebFindOptions.h" #include "webkit/api/public/WebInputEvent.h" +#include "webkit/api/public/WebMediaPlayerAction.h" #include "webkit/api/public/WebScreenInfo.h" #include "webkit/api/public/WebTextDirection.h" @@ -304,7 +305,7 @@ struct ParamTraits<WebKit::WebTextDirection> { }; template <> - struct ParamTraits<WebKit::WebDragOperation> { +struct ParamTraits<WebKit::WebDragOperation> { typedef WebKit::WebDragOperation param_type; static void Write(Message* m, const param_type& p) { m->WriteInt(p); @@ -320,6 +321,42 @@ template <> } }; +template <> +struct ParamTraits<WebKit::WebMediaPlayerAction> { + typedef WebKit::WebMediaPlayerAction param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, static_cast<int>(p.type)); + WriteParam(m, p.enable); + } + static bool Read(const Message* m, void** iter, param_type* r) { + int temp; + if (!ReadParam(m, iter, &temp)) + return false; + r->type = static_cast<param_type::Type>(temp); + return ReadParam(m, iter, &r->enable); + } + static void Log(const param_type& p, std::wstring* l) { + l->append(L"("); + switch (p.type) { + case WebKit::WebMediaPlayerAction::Play: + l->append(L"Play"); + break; + case WebKit::WebMediaPlayerAction::Mute: + l->append(L"Mute"); + break; + case WebKit::WebMediaPlayerAction::Loop: + l->append(L"Loop"); + break; + default: + l->append(L"Unknown"); + break; + } + l->append(L", "); + LogParam(p.enable, l); + l->append(L")"); + } +}; + } // namespace IPC #endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |