| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // for details. | 43 // for details. |
| 44 // | 44 // |
| 45 class ShellConnection : public shell::mojom::ShellClient { | 45 class ShellConnection : public shell::mojom::ShellClient { |
| 46 public: | 46 public: |
| 47 // Does not take ownership of |delegate|, which must remain valid for the | 47 // Does not take ownership of |delegate|, which must remain valid for the |
| 48 // lifetime of ShellConnection. | 48 // lifetime of ShellConnection. |
| 49 ShellConnection(mojo::ShellClient* client, | 49 ShellConnection(mojo::ShellClient* client, |
| 50 InterfaceRequest<shell::mojom::ShellClient> request); | 50 InterfaceRequest<shell::mojom::ShellClient> request); |
| 51 ~ShellConnection() override; | 51 ~ShellConnection() override; |
| 52 | 52 |
| 53 // Block the calling thread until the Initialize() method is called by the | |
| 54 // shell. | |
| 55 void WaitForInitialize(); | |
| 56 | |
| 57 Connector* connector() { return connector_.get(); } | 53 Connector* connector() { return connector_.get(); } |
| 58 | 54 |
| 59 private: | 55 private: |
| 60 // shell::mojom::ShellClient: | 56 // shell::mojom::ShellClient: |
| 61 void Initialize(shell::mojom::ConnectorPtr connector, | 57 void Initialize(shell::mojom::ConnectorPtr connector, |
| 62 shell::mojom::IdentityPtr identity, | 58 shell::mojom::IdentityPtr identity, |
| 63 uint32_t id) override; | 59 uint32_t id) override; |
| 64 void AcceptConnection( | 60 void AcceptConnection( |
| 65 shell::mojom::IdentityPtr source, | 61 shell::mojom::IdentityPtr source, |
| 66 uint32_t source_id, | 62 uint32_t source_id, |
| 67 shell::mojom::InterfaceProviderRequest remote_interfaces, | 63 shell::mojom::InterfaceProviderRequest remote_interfaces, |
| 68 shell::mojom::InterfaceProviderPtr local_interfaces, | 64 shell::mojom::InterfaceProviderPtr local_interfaces, |
| 69 shell::mojom::CapabilityRequestPtr allowed_capabilities, | 65 shell::mojom::CapabilityRequestPtr allowed_capabilities, |
| 70 const String& name) override; | 66 const String& name) override; |
| 71 | 67 |
| 72 void OnConnectionError(); | 68 void OnConnectionError(); |
| 73 | 69 |
| 74 // We track the lifetime of incoming connection registries as it more | 70 // We track the lifetime of incoming connection registries as it more |
| 75 // convenient for the client. | 71 // convenient for the client. |
| 72 shell::mojom::ConnectorRequest pending_connector_request_; |
| 76 ScopedVector<Connection> incoming_connections_; | 73 ScopedVector<Connection> incoming_connections_; |
| 77 mojo::ShellClient* client_; | 74 mojo::ShellClient* client_; |
| 78 Binding<shell::mojom::ShellClient> binding_; | 75 Binding<shell::mojom::ShellClient> binding_; |
| 79 scoped_ptr<Connector> connector_; | 76 scoped_ptr<Connector> connector_; |
| 80 base::WeakPtrFactory<ShellConnection> weak_factory_; | 77 base::WeakPtrFactory<ShellConnection> weak_factory_; |
| 81 | 78 |
| 82 DISALLOW_COPY_AND_ASSIGN(ShellConnection); | 79 DISALLOW_COPY_AND_ASSIGN(ShellConnection); |
| 83 }; | 80 }; |
| 84 | 81 |
| 85 } // namespace mojo | 82 } // namespace mojo |
| 86 | 83 |
| 87 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ | 84 #endif // MOJO_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_ |
| OLD | NEW |