| 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_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ | 5 #ifndef MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ |
| 6 #define MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ | 6 #define MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace shell { | 22 namespace shell { |
| 23 | 23 |
| 24 // Externally-running applications can use this class to discover and register | 24 // Externally-running applications can use this class to discover and register |
| 25 // with a running mojo_shell instance. | 25 // with a running mojo_shell instance. |
| 26 // MUST be run on an IO thread | 26 // MUST be run on an IO thread |
| 27 class ExternalApplicationRegistrarConnection : public ErrorHandler { | 27 class ExternalApplicationRegistrarConnection : public ErrorHandler { |
| 28 public: | 28 public: |
| 29 // Configures client_socket_ to point at socket_path. | 29 // Configures client_socket_ to point at socket_path. |
| 30 explicit ExternalApplicationRegistrarConnection( | 30 explicit ExternalApplicationRegistrarConnection( |
| 31 const base::FilePath& socket_path); | 31 const base::FilePath& socket_path); |
| 32 virtual ~ExternalApplicationRegistrarConnection(); | 32 ~ExternalApplicationRegistrarConnection() override; |
| 33 | 33 |
| 34 // Implementation of ErrorHandler | 34 // Implementation of ErrorHandler |
| 35 virtual void OnConnectionError() override; | 35 void OnConnectionError() override; |
| 36 | 36 |
| 37 // Connects client_socket_ and binds it to registrar_. | 37 // Connects client_socket_ and binds it to registrar_. |
| 38 // Status code is passed to callback upon success or failure. | 38 // Status code is passed to callback upon success or failure. |
| 39 // May return either synchronously or asynchronously, depending on the | 39 // May return either synchronously or asynchronously, depending on the |
| 40 // status of the underlying socket. | 40 // status of the underlying socket. |
| 41 void Connect(const net::CompletionCallback& callback); | 41 void Connect(const net::CompletionCallback& callback); |
| 42 | 42 |
| 43 // Registers this app with the shell at the provided URL. | 43 // Registers this app with the shell at the provided URL. |
| 44 // shell is not ready for use until register_complete_callback fires. | 44 // shell is not ready for use until register_complete_callback fires. |
| 45 // TODO(cmasone): Once the pipe for shell can be placed in a FIFO relationship | 45 // TODO(cmasone): Once the pipe for shell can be placed in a FIFO relationship |
| (...skipping 10 matching lines...) Expand all Loading... |
| 56 | 56 |
| 57 scoped_ptr<net::UnixDomainClientSocket> client_socket_; | 57 scoped_ptr<net::UnixDomainClientSocket> client_socket_; |
| 58 mojo::embedder::ChannelInit channel_init_; | 58 mojo::embedder::ChannelInit channel_init_; |
| 59 ExternalApplicationRegistrarPtr registrar_; | 59 ExternalApplicationRegistrarPtr registrar_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace shell | 62 } // namespace shell |
| 63 } // namespace mojo | 63 } // namespace mojo |
| 64 | 64 |
| 65 #endif // MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ | 65 #endif // MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ |
| OLD | NEW |