| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_NAMES_H_ | 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_NAMES_H_ |
| 6 #define SERVICES_SHELL_PUBLIC_CPP_NAMES_H_ | 6 #define SERVICES_SHELL_PUBLIC_CPP_NAMES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace shell { | 10 namespace shell { |
| 11 | 11 |
| 12 extern const char kNameType_Mojo[]; | 12 extern const char kNameType_Mojo[]; |
| 13 extern const char kNameType_Exe[]; | 13 extern const char kNameType_Exe[]; |
| 14 | 14 |
| 15 // Mojo services and applications are identified by structured "names", of the | 15 // Mojo services are identified by structured "names", of the form: |
| 16 // form: | |
| 17 // | 16 // |
| 18 // type:path. | 17 // type:path. |
| 19 // | 18 // |
| 20 // The type field tells the shell how to load the application. Two types are | 19 // The type field tells the shell how to load the service. Two types are |
| 21 // currently recognized: | 20 // recognized: |
| 22 // | 21 // |
| 23 // mojo | 22 // mojo |
| 24 // Represents an application packaged as a .mojo, launched from the | 23 // Represents a service packaged as a .library, launched from the NativeRunner |
| 25 // NativeRunner launch path. .mojo files are assumed to live alongside the | 24 // launch path. .library files are assumed to live alongside the executable |
| 26 // shell executable at a path matching <path>/<path>.mojo. .mojo applications | 25 // hosting the service manager at a path matching <path>/<path>.library. |
| 27 // have a MojoMain() entrypoint that receives a handle to a ServiceRequest | 26 // .library files have a MojoMain() entrypoint that receives a handle to a |
| 28 // that must be bound to enable further communication with the shell. | 27 // ServiceRequest that must be bound to enable further communication with the |
| 28 // Service Manager. |
| 29 // | 29 // |
| 30 // exe | 30 // exe |
| 31 // Represents a native executable on the host platform, expected to live | 31 // Represents a native executable on the host platform, expected to live |
| 32 // alongside the shell executable. Executables launched via this mechanism are | 32 // alongside the shell executable. Executables launched via this mechanism are |
| 33 // passed a handle to the shell on the command line and are expected to bind | 33 // passed a handle to the shell on the command line and are expected to bind |
| 34 // a ServiceRequest enabling further communication with the shell. The | 34 // a ServiceRequest enabling further communication with the Service Manager. |
| 35 // path component contains the executable name, minus any platform-specific | 35 // The path component contains the executable name, minus any platform |
| 36 // extension. | 36 // specific extension. |
| 37 // | 37 // |
| 38 // Other types may be supplied but are not recognized by any of the | 38 // Other types may be supplied but are not recognized by any of the |
| 39 // NativeRunners, and as such custom loaders must be specified for such names. | 39 // NativeRunners, and as such custom loaders must be specified for such names. |
| 40 // | 40 // |
| 41 // Any name type may serve as an alias for any other name type. Aliasing is | 41 // Any name type may serve as an alias for any other name type. Aliasing is |
| 42 // resolved implicitly by the Shell. | 42 // resolved implicitly by the Shell. |
| 43 | 43 |
| 44 // Returns true if the name is a valid form, i.e. type:path. path cannot start | 44 // Returns true if the name is a valid form, i.e. type:path. path cannot start |
| 45 // with a "//" sequence. These are _not_ urls. | 45 // with a "//" sequence. These are _not_ urls. |
| 46 bool IsValidName(const std::string& name); | 46 bool IsValidName(const std::string& name); |
| 47 | 47 |
| 48 // Get the type component of the specified name. | 48 // Get the type component of the specified name. |
| 49 std::string GetNameType(const std::string& name); | 49 std::string GetNameType(const std::string& name); |
| 50 | 50 |
| 51 // Get the path component of the specified name. | 51 // Get the path component of the specified name. |
| 52 std::string GetNamePath(const std::string& name); | 52 std::string GetNamePath(const std::string& name); |
| 53 | 53 |
| 54 } // namespace shell | 54 } // namespace shell |
| 55 | 55 |
| 56 #endif // SERVICES_SHELL_PUBLIC_CPP_NAMES_H_ | 56 #endif // SERVICES_SHELL_PUBLIC_CPP_NAMES_H_ |
| OLD | NEW |