1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "content/shell/browser/ipc_echo_message_filter.h"
6
7#include "content/shell/common/shell_messages.h"
8
9namespace content {
10
11IPCEchoMessageFilter::IPCEchoMessageFilter()
12    : BrowserMessageFilter(ShellMsgStart) {
13}
14
15IPCEchoMessageFilter::~IPCEchoMessageFilter() {
16}
17
18bool IPCEchoMessageFilter::OnMessageReceived(const IPC::Message& message) {
19  bool handled = true;
20  IPC_BEGIN_MESSAGE_MAP(IPCEchoMessageFilter, message)
21    IPC_MESSAGE_HANDLER(ShellViewHostMsg_EchoPing, OnEchoPing)
22    IPC_MESSAGE_UNHANDLED(handled = false)
23  IPC_END_MESSAGE_MAP()
24
25  return handled;
26}
27
28void IPCEchoMessageFilter::OnEchoPing(int routing_id, int id,
29                                    const std::string& body) {
30  Send(new ShellViewMsg_EchoPong(routing_id, id, body));
31}
32
33}  // namespace content
34