コード例 #1
0
void IpcClientHost::onMessageReceived(const PIpcMessage& msg)
{
	if (msg.routing_id() != MSG_ROUTING_CONTROL) {
		// ROUTED MESSAGE, forward it to the correct host window
		HostWindow* win = static_cast<HostWindow*>(findWindow(msg.routing_id()));
		if (!win) {
			return;
		}
		win->onMessageReceived(msg);
	} else {
		// CONTROL MESSAGE, Handle it here
		bool msgIsOk;

		IPC_BEGIN_MESSAGE_MAP(IpcClientHost, msg, msgIsOk)
			IPC_MESSAGE_HANDLER(View_Host_ReturnedKeyEvent, onReturnedInputEvent)
			IPC_MESSAGE_HANDLER(ViewHost_PrepareAddWindow, onPrepareAddWindow)
			IPC_MESSAGE_HANDLER(ViewHost_AddWindow, onAddWindow)
			IPC_MESSAGE_HANDLER(ViewHost_RemoveWindow, onRemoveWindow)
			IPC_MESSAGE_HANDLER(ViewHost_SetWindowProperties, onSetWindowProperties)
			IPC_MESSAGE_HANDLER(ViewHost_FocusWindow, onFocusWindow)
			IPC_MESSAGE_HANDLER(ViewHost_UnfocusWindow, onUnfocusWindow)
			IPC_MESSAGE_UNHANDLED( g_critical("%s (%d). IPC Message Not Handled: (0x%x : 0x%x : 0x%x)",
											  __PRETTY_FUNCTION__, __LINE__, msg.routing_id(), msg.type(), msg.message_id()));
		IPC_END_MESSAGE_MAP()
	}
}
コード例 #2
0
bool MemoryRenderWidgetHost::OnMessageReceived(const IPC::Message& msg) {
  bool msg_is_ok = true;
  bool handled = true;
  IPC_BEGIN_MESSAGE_MAP_EX(MemoryRenderWidgetHost, msg, msg_is_ok)
    IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, Memory_OnMsgUpdateRect)
    IPC_MESSAGE_UNHANDLED(handled = this->RenderWidgetHost::OnMessageReceived(msg))
  IPC_END_MESSAGE_MAP_EX()
      ;

  if (!msg_is_ok) {
    // The message had a handler, but its de-serialization failed.
    // Kill the renderer.
    process()->ReceivedBadMessage();
  }
  return handled;
}