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 MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ |
6 #define MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ | 6 #define MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ~ShellConnection() override; | 54 ~ShellConnection() override; |
55 | 55 |
56 Connector* connector() { return connector_.get(); } | 56 Connector* connector() { return connector_.get(); } |
57 | 57 |
58 // TODO(rockot): Remove this. http://crbug.com/594852. | 58 // TODO(rockot): Remove this. http://crbug.com/594852. |
59 void set_initialize_handler(const base::Closure& callback); | 59 void set_initialize_handler(const base::Closure& callback); |
60 | 60 |
61 // TODO(rockot): Remove this once we get rid of app tests. | 61 // TODO(rockot): Remove this once we get rid of app tests. |
62 void SetAppTestConnectorForTesting(shell::mojom::ConnectorPtr connector); | 62 void SetAppTestConnectorForTesting(shell::mojom::ConnectorPtr connector); |
63 | 63 |
64 private: | 64 // Specify a function to be called when the connection to the shell is lost. |
| 65 void set_connection_lost_closure(const base::Closure& closure) { |
| 66 connection_lost_closure_ = closure; |
| 67 } |
| 68 |
| 69 private: |
65 // shell::mojom::ShellClient: | 70 // shell::mojom::ShellClient: |
66 void Initialize(shell::mojom::IdentityPtr identity, | 71 void Initialize(shell::mojom::IdentityPtr identity, |
67 uint32_t id, | 72 uint32_t id, |
68 const InitializeCallback& callback) override; | 73 const InitializeCallback& callback) override; |
69 void AcceptConnection( | 74 void AcceptConnection( |
70 shell::mojom::IdentityPtr source, | 75 shell::mojom::IdentityPtr source, |
71 uint32_t source_id, | 76 uint32_t source_id, |
72 shell::mojom::InterfaceProviderRequest remote_interfaces, | 77 shell::mojom::InterfaceProviderRequest remote_interfaces, |
73 shell::mojom::InterfaceProviderPtr local_interfaces, | 78 shell::mojom::InterfaceProviderPtr local_interfaces, |
74 shell::mojom::CapabilityRequestPtr allowed_capabilities, | 79 shell::mojom::CapabilityRequestPtr allowed_capabilities, |
75 const String& name) override; | 80 const String& name) override; |
76 | 81 |
77 void OnConnectionError(); | 82 void OnConnectionError(); |
78 | 83 |
79 // A callback called when Initialize() is run. | 84 // A callback called when Initialize() is run. |
80 base::Closure initialize_handler_; | 85 base::Closure initialize_handler_; |
81 | 86 |
82 // We track the lifetime of incoming connection registries as it more | 87 // We track the lifetime of incoming connection registries as it more |
83 // convenient for the client. | 88 // convenient for the client. |
84 ScopedVector<Connection> incoming_connections_; | 89 ScopedVector<Connection> incoming_connections_; |
85 | 90 |
86 // A pending Connector request which will eventually be passed to the shell. | 91 // A pending Connector request which will eventually be passed to the shell. |
87 shell::mojom::ConnectorRequest pending_connector_request_; | 92 shell::mojom::ConnectorRequest pending_connector_request_; |
88 | 93 |
89 mojo::ShellClient* client_; | 94 mojo::ShellClient* client_; |
90 Binding<shell::mojom::ShellClient> binding_; | 95 Binding<shell::mojom::ShellClient> binding_; |
91 scoped_ptr<Connector> connector_; | 96 scoped_ptr<Connector> connector_; |
92 | 97 |
| 98 base::Closure connection_lost_closure_; |
| 99 |
93 DISALLOW_COPY_AND_ASSIGN(ShellConnection); | 100 DISALLOW_COPY_AND_ASSIGN(ShellConnection); |
94 }; | 101 }; |
95 | 102 |
96 } // namespace mojo | 103 } // namespace mojo |
97 | 104 |
98 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ | 105 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ |
OLD | NEW |