diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-25 20:20:51 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-25 20:20:51 +0000 |
commit | f0557936f14a7421e269cf16bf7430514577d9f9 (patch) | |
tree | 8f40892d1a491fb8efad3abe80ce4b12a3ae0125 /chrome/common | |
parent | ac9ade0a9c4438ac69efc3463bd26993ce9dec82 (diff) | |
download | chromium_src-f0557936f14a7421e269cf16bf7430514577d9f9.zip chromium_src-f0557936f14a7421e269cf16bf7430514577d9f9.tar.gz chromium_src-f0557936f14a7421e269cf16bf7430514577d9f9.tar.bz2 |
Move non-file-system Pepper IPC messages to chrome/common/pepper_messages.*.
BUG=none
TEST=builds everywhere
Review URL: http://codereview.chromium.org/6388004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/pepper_messages.cc | 42 | ||||
-rw-r--r-- | chrome/common/pepper_messages.h | 52 | ||||
-rw-r--r-- | chrome/common/render_messages.cc | 30 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 8 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 21 |
5 files changed, 94 insertions, 59 deletions
diff --git a/chrome/common/pepper_messages.cc b/chrome/common/pepper_messages.cc new file mode 100644 index 0000000..60dad0d --- /dev/null +++ b/chrome/common/pepper_messages.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/common_param_traits.h" +#include "ppapi/c/private/ppb_flash.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/pepper_messages.h" + +namespace IPC { + +void ParamTraits<PP_Flash_NetAddress>::Write(Message* m, const param_type& p) { + WriteParam(m, p.size); + m->WriteBytes(p.data, static_cast<int>(p.size)); +} + +bool ParamTraits<PP_Flash_NetAddress>::Read(const Message* m, + void** iter, + param_type* p) { + uint16 size; + if (!ReadParam(m, iter, &size)) + return false; + if (size > sizeof(p->data)) + return false; + p->size = size; + + const char* data; + if (!m->ReadBytes(iter, &data, size)) + return false; + memcpy(p->data, data, size); + return true; +} + +void ParamTraits<PP_Flash_NetAddress>::Log(const param_type& p, + std::string* l) { + l->append("<PP_Flash_NetAddress ("); + LogParam(p.size, l); + l->append(" bytes)>"); +} + +} // namespace IPC diff --git a/chrome/common/pepper_messages.h b/chrome/common/pepper_messages.h new file mode 100644 index 0000000..60bf768 --- /dev/null +++ b/chrome/common/pepper_messages.h @@ -0,0 +1,52 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_PEPPER_MESSAGES_H_ +#define CHROME_COMMON_PEPPER_MESSAGES_H_ +#pragma once + +#include "chrome/common/common_param_traits.h" +#include "ipc/ipc_message_macros.h" +#include "ipc/ipc_param_traits.h" +#include "ipc/ipc_platform_file.h" + +#define IPC_MESSAGE_START PepperMsgStart + +struct PP_Flash_NetAddress; + +namespace IPC { + +template <> +struct ParamTraits<PP_Flash_NetAddress> { + typedef PP_Flash_NetAddress param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +// Pepper (non-file-system) messages sent from the browser to the renderer. + +// The response to PepperMsg_ConnectTcp(Address). +IPC_MESSAGE_ROUTED4(PepperMsg_ConnectTcpACK, + int /* request_id */, + IPC::PlatformFileForTransit /* socket */, + PP_Flash_NetAddress /* local_addr */, + PP_Flash_NetAddress /* remote_addr */) + +// Pepper (non-file-system) messages sent from the renderer to the browser. + +IPC_MESSAGE_CONTROL4(PepperMsg_ConnectTcp, + int /* routing_id */, + int /* request_id */, + std::string /* host */, + uint16 /* port */) + +IPC_MESSAGE_CONTROL3(PepperMsg_ConnectTcpAddress, + int /* routing_id */, + int /* request_id */, + PP_Flash_NetAddress /* addr */) + +#endif // CHROME_COMMON_PEPPER_MESSAGES_H_ diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index a49ea2e..bab7445 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -16,7 +16,6 @@ #include "media/audio/audio_buffers_state.h" #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" -#include "ppapi/c/private/ppb_flash.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/appcache/appcache_interfaces.h" @@ -1221,33 +1220,4 @@ void ParamTraits<AudioBuffersState>::Log(const param_type& p, std::string* l) { l->append(")"); } -void ParamTraits<PP_Flash_NetAddress>::Write(Message* m, const param_type& p) { - WriteParam(m, p.size); - m->WriteBytes(p.data, p.size); -} - -bool ParamTraits<PP_Flash_NetAddress>::Read(const Message* m, - void** iter, - param_type* p) { - uint16 size; - if (!ReadParam(m, iter, &size)) - return false; - if (size > sizeof(p->data)) - return false; - p->size = size; - - const char* data; - if (!m->ReadBytes(iter, &data, size)) - return false; - memcpy(p->data, data, size); - return true; -} - -void ParamTraits<PP_Flash_NetAddress>::Log(const param_type& p, - std::string* l) { - l->append("<PP_Flash_NetAddress ("); - LogParam(p.size, l); - l->append(" bytes)>"); -} - } // namespace IPC diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index b681f8f..8cc75ff 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -552,14 +552,6 @@ struct ParamTraits<AudioBuffersState> { static void Log(const param_type& p, std::string* l); }; -template <> -struct ParamTraits<PP_Flash_NetAddress> { - typedef PP_Flash_NetAddress param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - } // namespace IPC #include "chrome/common/render_messages_internal.h" diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index d8f3fb6..b93e606 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -50,7 +50,6 @@ typedef std::map<std::string, std::string> SubstitutionMap; class Value; class GPUInfo; -struct PP_Flash_NetAddress; class SkBitmap; struct ThumbnailScore; class WebCursor; @@ -1070,13 +1069,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_SelectPopupMenuItem, IPC_MESSAGE_CONTROL1(ViewMsg_SpeechInput_SetFeatureEnabled, bool /* enabled */) -// The response to ViewHostMsg_PepperConnectTcp(Address). -IPC_MESSAGE_ROUTED4(ViewMsg_PepperConnectTcpACK, - int /* request_id */, - IPC::PlatformFileForTransit /* socket */, - PP_Flash_NetAddress /* local_addr */, - PP_Flash_NetAddress /* remote_addr */) - // Sent in response to a ViewHostMsg_ContextMenu to let the renderer know that // the menu has been closed. IPC_MESSAGE_ROUTED0(ViewMsg_ContextMenuClosed) @@ -2592,19 +2584,6 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions, // The currently displayed PDF has an unsupported feature. IPC_MESSAGE_ROUTED0(ViewHostMsg_PDFHasUnsupportedFeature) -// Pepper-related messages ----------------------------------------------------- - -IPC_MESSAGE_CONTROL4(ViewHostMsg_PepperConnectTcp, - int /* routing_id */, - int /* request_id */, - std::string /* host */, - uint16 /* port */) - -IPC_MESSAGE_CONTROL3(ViewHostMsg_PepperConnectTcpAddress, - int /* routing_id */, - int /* request_id */, - PP_Flash_NetAddress /* addr */) - // JavaScript related messages ----------------------------------------------- // Notify the JavaScript engine in the render to change its parameters |