| 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 // Specify a function to be called when the connection to the shell is lost. | 64 private: |
| 65 void set_connection_lost_closure(const base::Closure& closure) { | |
| 66 connection_lost_closure_ = closure; | |
| 67 } | |
| 68 | |
| 69 private: | |
| 70 // shell::mojom::ShellClient: | 65 // shell::mojom::ShellClient: |
| 71 void Initialize(shell::mojom::IdentityPtr identity, | 66 void Initialize(shell::mojom::IdentityPtr identity, |
| 72 uint32_t id, | 67 uint32_t id, |
| 73 const InitializeCallback& callback) override; | 68 const InitializeCallback& callback) override; |
| 74 void AcceptConnection( | 69 void AcceptConnection( |
| 75 shell::mojom::IdentityPtr source, | 70 shell::mojom::IdentityPtr source, |
| 76 uint32_t source_id, | 71 uint32_t source_id, |
| 77 shell::mojom::InterfaceProviderRequest remote_interfaces, | 72 shell::mojom::InterfaceProviderRequest remote_interfaces, |
| 78 shell::mojom::InterfaceProviderPtr local_interfaces, | 73 shell::mojom::InterfaceProviderPtr local_interfaces, |
| 79 shell::mojom::CapabilityRequestPtr allowed_capabilities, | 74 shell::mojom::CapabilityRequestPtr allowed_capabilities, |
| 80 const String& name) override; | 75 const String& name) override; |
| 81 | 76 |
| 82 void OnConnectionError(); | 77 void OnConnectionError(); |
| 83 | 78 |
| 84 // A callback called when Initialize() is run. | 79 // A callback called when Initialize() is run. |
| 85 base::Closure initialize_handler_; | 80 base::Closure initialize_handler_; |
| 86 | 81 |
| 87 // We track the lifetime of incoming connection registries as it more | 82 // We track the lifetime of incoming connection registries as it more |
| 88 // convenient for the client. | 83 // convenient for the client. |
| 89 ScopedVector<Connection> incoming_connections_; | 84 ScopedVector<Connection> incoming_connections_; |
| 90 | 85 |
| 91 // A pending Connector request which will eventually be passed to the shell. | 86 // A pending Connector request which will eventually be passed to the shell. |
| 92 shell::mojom::ConnectorRequest pending_connector_request_; | 87 shell::mojom::ConnectorRequest pending_connector_request_; |
| 93 | 88 |
| 94 mojo::ShellClient* client_; | 89 mojo::ShellClient* client_; |
| 95 Binding<shell::mojom::ShellClient> binding_; | 90 Binding<shell::mojom::ShellClient> binding_; |
| 96 scoped_ptr<Connector> connector_; | 91 scoped_ptr<Connector> connector_; |
| 97 | 92 |
| 98 base::Closure connection_lost_closure_; | |
| 99 | |
| 100 DISALLOW_COPY_AND_ASSIGN(ShellConnection); | 93 DISALLOW_COPY_AND_ASSIGN(ShellConnection); |
| 101 }; | 94 }; |
| 102 | 95 |
| 103 } // namespace mojo | 96 } // namespace mojo |
| 104 | 97 |
| 105 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ | 98 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ |
| OLD | NEW |