| 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 SERVICES_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ | 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ |
| 6 #define SERVICES_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ | 6 #define SERVICES_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Called once a bidirectional connection with the shell has been established. | 29 // Called once a bidirectional connection with the shell has been established. |
| 30 // |identity| is the identity of the instance. | 30 // |identity| is the identity of the instance. |
| 31 // |id| is a unique identifier the shell uses to identify this specific | 31 // |id| is a unique identifier the shell uses to identify this specific |
| 32 // instance of the application. | 32 // instance of the application. |
| 33 // Called exactly once before any other method. | 33 // Called exactly once before any other method. |
| 34 virtual void Initialize(Connector* connector, | 34 virtual void Initialize(Connector* connector, |
| 35 const Identity& identity, | 35 const Identity& identity, |
| 36 uint32_t id); | 36 uint32_t id); |
| 37 | 37 |
| 38 virtual InterfaceProvider* GetInterfaceProviderForConnection(); |
| 39 virtual InterfaceRegistry* GetInterfaceRegistryForConnection(); |
| 40 |
| 38 // Called when a connection to this client is brokered by the shell. Override | 41 // Called when a connection to this client is brokered by the shell. Override |
| 39 // to expose services to the remote application. Return true if the connection | 42 // to expose services to the remote application. Return true if the connection |
| 40 // should succeed. Return false if the connection should be rejected and the | 43 // should succeed. Return false if the connection should be rejected and the |
| 41 // underlying pipe closed. The default implementation returns false. | 44 // underlying pipe closed. The default implementation returns false. |
| 42 virtual bool AcceptConnection(Connection* connection); | 45 virtual bool AcceptConnection(Connection* connection); |
| 43 | 46 |
| 44 // Called when ShellConnection's ShellClient binding (i.e. the pipe the | 47 // Called when ShellConnection's ShellClient binding (i.e. the pipe the |
| 45 // Mojo Shell has to talk to us over) is closed. A shell client may use this | 48 // Mojo Shell has to talk to us over) is closed. A shell client may use this |
| 46 // as a signal to terminate. Return true from this method to tell the | 49 // as a signal to terminate. Return true from this method to tell the |
| 47 // ShellConnection to run its connection lost closure if it has one, false to | 50 // ShellConnection to run its connection lost closure if it has one, false to |
| 48 // prevent it from being run. The default implementation returns true. | 51 // prevent it from being run. The default implementation returns true. |
| 49 // When used in conjunction with ApplicationRunner, returning true here quits | 52 // When used in conjunction with ApplicationRunner, returning true here quits |
| 50 // the message loop created by ApplicationRunner, which results in the app | 53 // the message loop created by ApplicationRunner, which results in the app |
| 51 // quitting. | 54 // quitting. |
| 52 virtual bool ShellConnectionLost(); | 55 virtual bool ShellConnectionLost(); |
| 53 | 56 |
| 54 private: | 57 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(ShellClient); | 58 DISALLOW_COPY_AND_ASSIGN(ShellClient); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 } // namespace shell | 61 } // namespace shell |
| 59 | 62 |
| 60 #endif // SERVICES_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ | 63 #endif // SERVICES_SHELL_PUBLIC_CPP_SHELL_CLIENT_H_ |
| OLD | NEW |