Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / child / mojo / mojo_application.h
blobd7454027808ffba1f34e617d7448b8e84209b5be
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 #ifndef CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
6 #define CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
8 #include "content/common/mojo/service_registry_impl.h"
9 #include "ipc/ipc_platform_file.h"
10 #include "mojo/embedder/channel_init.h"
12 namespace IPC {
13 class Message;
16 namespace content {
18 // MojoApplication represents the code needed to setup a child process as a
19 // Mojo application via Chrome IPC. Instantiate MojoApplication and call its
20 // OnMessageReceived method to give it a shot at handling Chrome IPC messages.
21 // It makes the ServiceRegistry interface available.
22 class MojoApplication {
23 public:
24 MojoApplication();
25 virtual ~MojoApplication();
27 bool OnMessageReceived(const IPC::Message& msg);
29 ServiceRegistry* service_registry() { return &service_registry_; }
31 private:
32 void OnActivate(const IPC::PlatformFileForTransit& file);
34 mojo::embedder::ChannelInit channel_init_;
36 ServiceRegistryImpl service_registry_;
38 DISALLOW_COPY_AND_ASSIGN(MojoApplication);
41 } // namespace content
43 #endif // CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_