Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / shell / browser / ipc_echo_message_filter.cc
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
9 namespace content {
10
11 IPCEchoMessageFilter::IPCEchoMessageFilter()
12     : BrowserMessageFilter(ShellMsgStart) {
13 }
14
15 IPCEchoMessageFilter::~IPCEchoMessageFilter() {
16 }
17
18 bool 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
28 void 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