Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / content / browser / mojo / mojo_application_host.h
blob68f6c3208b8a379d6926e1a62f38054df65cef2d
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_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
8 #include "base/process/process_handle.h"
9 #include "mojo/common/channel_init.h"
10 #include "mojo/embedder/scoped_platform_handle.h"
11 #include "mojo/public/cpp/bindings/remote_ptr.h"
12 #include "mojo/public/interfaces/shell/shell.mojom.h"
14 namespace IPC {
15 class Sender;
18 namespace content {
20 // MojoApplicationHost represents the code needed on the browser side to setup
21 // a child process as a Mojo application via Chrome IPC. The child process
22 // should use MojoApplication to handle messages generated by an instance of
23 // MojoApplicationHost. MojoApplicationHost makes the mojo::ShellClient
24 // interface available so that child-provided services can be invoked.
25 class MojoApplicationHost {
26 public:
27 MojoApplicationHost();
28 ~MojoApplicationHost();
30 // Two-phase initialization:
31 // 1- Init makes the shell_client() available synchronously.
32 // 2- Activate establishes the actual connection to the peer process.
33 bool Init();
34 bool Activate(IPC::Sender* sender, base::ProcessHandle process_handle);
36 bool did_activate() const { return did_activate_; }
38 mojo::ShellClient* shell_client() { return shell_client_.get(); }
40 private:
41 mojo::common::ChannelInit channel_init_;
42 mojo::embedder::ScopedPlatformHandle client_handle_;
43 mojo::RemotePtr<mojo::ShellClient> shell_client_;
44 bool did_activate_;
46 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost);
49 } // namespace content
51 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_