OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IPC_MOJO_IPC_MOJO_BOOTSTRAP_H_ | 5 #ifndef IPC_MOJO_IPC_MOJO_BOOTSTRAP_H_ |
6 #define IPC_MOJO_IPC_MOJO_BOOTSTRAP_H_ | 6 #define IPC_MOJO_IPC_MOJO_BOOTSTRAP_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "ipc/ipc_channel.h" | 10 #include "ipc/ipc_channel.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Clients should implement MojoBootstrapDelegate to get the pipe | 21 // Clients should implement MojoBootstrapDelegate to get the pipe |
22 // from MojoBootstrap object. | 22 // from MojoBootstrap object. |
23 // | 23 // |
24 // This lives on IO thread other than Create(), which can be called from | 24 // This lives on IO thread other than Create(), which can be called from |
25 // UI thread as Channel::Create() can be. | 25 // UI thread as Channel::Create() can be. |
26 class IPC_MOJO_EXPORT MojoBootstrap : public Listener { | 26 class IPC_MOJO_EXPORT MojoBootstrap : public Listener { |
27 public: | 27 public: |
28 class Delegate { | 28 class Delegate { |
29 public: | 29 public: |
30 virtual void OnPipeAvailable( | 30 virtual void OnPipeAvailable( |
31 mojo::embedder::ScopedPlatformHandle handle) = 0; | 31 mojo::embedder::ScopedPlatformHandle handle, |
| 32 int32 peer_pid) = 0; |
32 virtual void OnBootstrapError() = 0; | 33 virtual void OnBootstrapError() = 0; |
33 }; | 34 }; |
34 | 35 |
35 // Create the MojoBootstrap instance. | 36 // Create the MojoBootstrap instance. |
36 // Instead of creating IPC::Channel, passs its ChannelHandle as |handle|, | 37 // Instead of creating IPC::Channel, passs its ChannelHandle as |handle|, |
37 // mode as |mode|. The result is notified to passed |delegate|. | 38 // mode as |mode|. The result is notified to passed |delegate|. |
38 static scoped_ptr<MojoBootstrap> Create(ChannelHandle handle, | 39 static scoped_ptr<MojoBootstrap> Create(ChannelHandle handle, |
39 Channel::Mode mode, | 40 Channel::Mode mode, |
40 Delegate* delegate); | 41 Delegate* delegate); |
41 | 42 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 scoped_ptr<Channel> channel_; | 78 scoped_ptr<Channel> channel_; |
78 Delegate* delegate_; | 79 Delegate* delegate_; |
79 State state_; | 80 State state_; |
80 | 81 |
81 DISALLOW_COPY_AND_ASSIGN(MojoBootstrap); | 82 DISALLOW_COPY_AND_ASSIGN(MojoBootstrap); |
82 }; | 83 }; |
83 | 84 |
84 } // namespace IPC | 85 } // namespace IPC |
85 | 86 |
86 #endif // IPC_MOJO_IPC_MOJO_BOOTSTRAP_H_ | 87 #endif // IPC_MOJO_IPC_MOJO_BOOTSTRAP_H_ |
OLD | NEW |