OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ | 5 #ifndef CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ |
6 #define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ | 6 #define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/common/mojo_shell_connection.h" | 12 #include "content/public/common/mojo_shell_connection.h" |
13 #include "mojo/public/cpp/system/message_pipe.h" | 13 #include "mojo/public/cpp/system/message_pipe.h" |
14 #include "mojo/shell/public/cpp/shell.h" | 14 #include "mojo/shell/public/cpp/shell.h" |
15 #include "mojo/shell/public/cpp/shell_client.h" | 15 #include "mojo/shell/public/cpp/shell_client.h" |
16 #include "mojo/shell/public/cpp/shell_connection.h" | 16 #include "mojo/shell/public/cpp/shell_connection.h" |
17 | 17 |
18 namespace mojo { | |
19 namespace shell { | |
20 class RunnerConnection; | |
21 } | |
22 } | |
23 | |
24 namespace content { | 18 namespace content { |
25 | 19 |
26 // Returns true for processes launched from an external mojo shell. | 20 // Returns true for processes launched from an external mojo shell. |
27 bool IsRunningInMojoShell(); | 21 bool IsRunningInMojoShell(); |
28 | 22 |
29 class MojoShellConnectionImpl : public MojoShellConnection, | 23 class MojoShellConnectionImpl : public MojoShellConnection, |
30 public mojo::ShellClient { | 24 public mojo::ShellClient { |
31 public: | 25 public: |
32 // Creates an instance of this class and stuffs it in TLS on the calling | 26 // Creates an instance of this class and stuffs it in TLS on the calling |
33 // thread. Retrieve it using MojoShellConnection::Get(). | 27 // thread. Retrieve it using MojoShellConnection::Get(). |
(...skipping 23 matching lines...) Expand all Loading... |
57 bool AcceptConnection(mojo::Connection* connection) override; | 51 bool AcceptConnection(mojo::Connection* connection) override; |
58 | 52 |
59 // MojoShellConnection: | 53 // MojoShellConnection: |
60 mojo::Connector* GetConnector() override; | 54 mojo::Connector* GetConnector() override; |
61 bool UsingExternalShell() const override; | 55 bool UsingExternalShell() const override; |
62 void AddListener(Listener* listener) override; | 56 void AddListener(Listener* listener) override; |
63 void RemoveListener(Listener* listener) override; | 57 void RemoveListener(Listener* listener) override; |
64 | 58 |
65 bool external_; | 59 bool external_; |
66 scoped_ptr<mojo::ShellConnection> shell_connection_; | 60 scoped_ptr<mojo::ShellConnection> shell_connection_; |
67 scoped_ptr<mojo::shell::RunnerConnection> runner_connection_; | |
68 std::vector<Listener*> listeners_; | 61 std::vector<Listener*> listeners_; |
69 | 62 |
70 DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl); | 63 DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl); |
71 }; | 64 }; |
72 | 65 |
73 } // namespace content | 66 } // namespace content |
74 | 67 |
75 #endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ | 68 #endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ |
OLD | NEW |