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_SERVICE_H_ | 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_ |
6 #define SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_ | 6 #define SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // Called when a connection to this service is brokered by the Service | 36 // Called when a connection to this service is brokered by the Service |
37 // Manager. Override to expose interfaces to the remote service. Return true | 37 // Manager. Override to expose interfaces to the remote service. Return true |
38 // if the connection should succeed. Return false if the connection should | 38 // if the connection should succeed. Return false if the connection should |
39 // be rejected and the underlying pipe closed. The default implementation | 39 // be rejected and the underlying pipe closed. The default implementation |
40 // returns false. | 40 // returns false. |
41 virtual bool OnConnect(Connection* connection); | 41 virtual bool OnConnect(Connection* connection); |
42 | 42 |
43 // Called when the Service Manager has stopped tracking this instance. The | 43 // Called when the Service Manager has stopped tracking this instance. The |
44 // service should use this as a signal to exit, and in fact its process may | 44 // service should use this as a signal to exit, and in fact its process may |
45 // be reaped shortly afterward. | 45 // be reaped shortly afterward. |
46 // Return true from this method to tell the ShellConnection to run its | 46 // Return true from this method to tell the ServiceContext to run its |
47 // connection lost closure if it has one, false to prevent it from being run. | 47 // connection lost closure if it has one, false to prevent it from being run. |
48 // The default implementation returns true. | 48 // The default implementation returns true. |
49 // When used in conjunction with ApplicationRunner, returning true here quits | 49 // When used in conjunction with ApplicationRunner, returning true here quits |
50 // the message loop created by ApplicationRunner, which results in the service | 50 // the message loop created by ApplicationRunner, which results in the service |
51 // quitting. | 51 // quitting. |
52 virtual bool OnStop(); | 52 virtual bool OnStop(); |
53 | 53 |
54 // TODO(rockot): remove | 54 // TODO(rockot): remove |
55 virtual InterfaceProvider* GetInterfaceProviderForConnection(); | 55 virtual InterfaceProvider* GetInterfaceProviderForConnection(); |
56 virtual InterfaceRegistry* GetInterfaceRegistryForConnection(); | 56 virtual InterfaceRegistry* GetInterfaceRegistryForConnection(); |
57 | 57 |
58 private: | 58 private: |
59 DISALLOW_COPY_AND_ASSIGN(Service); | 59 DISALLOW_COPY_AND_ASSIGN(Service); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace shell | 62 } // namespace shell |
63 | 63 |
64 #endif // SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_ | 64 #endif // SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_ |
OLD | NEW |