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.
5 #include "content/child/mojo/mojo_application.h"
7 #include "content/child/child_process.h"
8 #include "content/common/mojo/mojo_messages.h"
9 #include "ipc/ipc_message.h"
13 MojoApplication::MojoApplication() {
16 MojoApplication::~MojoApplication() {
19 bool MojoApplication::OnMessageReceived(const IPC::Message& msg) {
21 IPC_BEGIN_MESSAGE_MAP(MojoApplication, msg)
22 IPC_MESSAGE_HANDLER(MojoMsg_Activate, OnActivate)
23 IPC_MESSAGE_UNHANDLED(handled = false)
28 void MojoApplication::OnActivate(
29 const IPC::PlatformFileForTransit& file) {
31 base::PlatformFile handle = file.fd;
33 base::PlatformFile handle = file;
35 mojo::ScopedMessagePipeHandle message_pipe =
36 channel_init_.Init(handle,
37 ChildProcess::current()->io_message_loop_proxy());
38 DCHECK(message_pipe.is_valid());
39 service_registry_.BindRemoteServiceProvider(message_pipe.Pass());
42 } // namespace content