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 <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // Will return null if no connection has been established (either because it | 33 // Will return null if no connection has been established (either because it |
34 // hasn't happened yet or the application was not spawned from the external | 34 // hasn't happened yet or the application was not spawned from the external |
35 // Mojo shell). | 35 // Mojo shell). |
36 static MojoShellConnectionImpl* Get(); | 36 static MojoShellConnectionImpl* Get(); |
37 | 37 |
38 // Binds the shell connection to a ShellClientFactory request pipe from the | 38 // Binds the shell connection to a ShellClientFactory request pipe from the |
39 // command line. This must only be called once. | 39 // command line. This must only be called once. |
40 void BindToRequestFromCommandLine(); | 40 void BindToRequestFromCommandLine(); |
41 | 41 |
| 42 // TODO(rockot): Remove this. http://crbug.com/594852. |
| 43 shell::ShellConnection* shell_connection() { return shell_connection_.get(); } |
| 44 |
42 private: | 45 private: |
43 friend class MojoShellConnection; | 46 friend class MojoShellConnection; |
44 | 47 |
45 explicit MojoShellConnectionImpl(bool external); | 48 explicit MojoShellConnectionImpl(bool external); |
46 ~MojoShellConnectionImpl() override; | 49 ~MojoShellConnectionImpl() override; |
47 | 50 |
48 void WaitForShellIfNecessary(); | |
49 | |
50 // shell::ShellClient: | 51 // shell::ShellClient: |
51 void Initialize(shell::Connector* connector, | 52 void Initialize(shell::Connector* connector, |
52 const shell::Identity& identity, | 53 const shell::Identity& identity, |
53 uint32_t id) override; | 54 uint32_t id) override; |
54 bool AcceptConnection(shell::Connection* connection) override; | 55 bool AcceptConnection(shell::Connection* connection) override; |
55 | 56 |
56 // MojoShellConnection: | 57 // MojoShellConnection: |
57 shell::Connector* GetConnector() override; | 58 shell::Connector* GetConnector() override; |
58 const shell::Identity& GetIdentity() const override; | 59 const shell::Identity& GetIdentity() const override; |
59 bool UsingExternalShell() const override; | 60 bool UsingExternalShell() const override; |
60 void SetConnectionLostClosure(const base::Closure& closure) override; | 61 void SetConnectionLostClosure(const base::Closure& closure) override; |
61 void AddListener(std::unique_ptr<Listener> listener) override; | 62 void AddListener(std::unique_ptr<Listener> listener) override; |
62 std::unique_ptr<Listener> RemoveListener(Listener* listener) override; | 63 std::unique_ptr<Listener> RemoveListener(Listener* listener) override; |
63 | 64 |
64 const bool external_; | 65 const bool external_; |
65 std::unique_ptr<shell::ShellConnection> shell_connection_; | 66 std::unique_ptr<shell::ShellConnection> shell_connection_; |
66 std::vector<Listener*> listeners_; | 67 std::vector<Listener*> listeners_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl); | 69 DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl); |
69 }; | 70 }; |
70 | 71 |
71 } // namespace content | 72 } // namespace content |
72 | 73 |
73 #endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ | 74 #endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_ |
OLD | NEW |