| 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 23 matching lines...) Expand all Loading... |
| 34 // Implementation of ErrorHandler | 34 // Implementation of ErrorHandler |
| 35 virtual void OnConnectionError() override; | 35 virtual 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. | |
| 45 // TODO(cmasone): Once the pipe for shell can be placed in a FIFO relationship | |
| 46 // with the one underlying registrar_, the callback becomes unneeded. | |
| 47 void Register(const GURL& app_url, | 44 void Register(const GURL& app_url, |
| 48 ShellPtr* shell, | 45 base::Callback<void(ShellPtr)> register_complete_callback); |
| 49 base::Closure register_complete_callback); | |
| 50 | 46 |
| 51 private: | 47 private: |
| 52 // Handles the result of Connect(). If it was successful, promotes the socket | 48 // Handles the result of Connect(). If it was successful, promotes the socket |
| 53 // to a MessagePipe and binds it to registrar_. | 49 // to a MessagePipe and binds it to registrar_. |
| 54 // Hands rv to callback regardless. | 50 // Hands rv to callback regardless. |
| 55 void OnConnect(net::CompletionCallback callback, int rv); | 51 void OnConnect(net::CompletionCallback callback, int rv); |
| 56 | 52 |
| 57 scoped_ptr<net::UnixDomainClientSocket> client_socket_; | 53 scoped_ptr<net::UnixDomainClientSocket> client_socket_; |
| 58 mojo::embedder::ChannelInit channel_init_; | 54 mojo::embedder::ChannelInit channel_init_; |
| 59 ExternalApplicationRegistrarPtr registrar_; | 55 ExternalApplicationRegistrarPtr registrar_; |
| 60 }; | 56 }; |
| 61 | 57 |
| 62 } // namespace shell | 58 } // namespace shell |
| 63 } // namespace mojo | 59 } // namespace mojo |
| 64 | 60 |
| 65 #endif // MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ | 61 #endif // MOJO_SHELL_EXTERNAL_APPLICATION_REGISTRAR_CONNECTION_H_ |
| OLD | NEW |